Commit 73509681 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Greg Kroah-Hartman

staging/hv/osd: don't reimplement ALIGN macro

The ALIGN_DOWN macro was only used in NUM_PAGES_SPANNED.  So make the
latter easier and get rid of the former.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent cc04acf5
...@@ -85,7 +85,7 @@ int blk_vsc_initialize(struct hv_driver *driver) ...@@ -85,7 +85,7 @@ int blk_vsc_initialize(struct hv_driver *driver)
*/ */
stor_driver->max_outstanding_req_per_channel = stor_driver->max_outstanding_req_per_channel =
((stor_driver->ring_buffer_size - PAGE_SIZE) / ((stor_driver->ring_buffer_size - PAGE_SIZE) /
ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET + ALIGN(MAX_MULTIPAGE_BUFFER_PACKET +
sizeof(struct vstor_packet) + sizeof(u64), sizeof(struct vstor_packet) + sizeof(u64),
sizeof(u64))); sizeof(u64)));
......
...@@ -726,7 +726,7 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer, ...@@ -726,7 +726,7 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer,
{ {
struct vmpacket_descriptor desc; struct vmpacket_descriptor desc;
u32 packetlen = sizeof(struct vmpacket_descriptor) + bufferlen; u32 packetlen = sizeof(struct vmpacket_descriptor) + bufferlen;
u32 packetlen_aligned = ALIGN_UP(packetlen, sizeof(u64)); u32 packetlen_aligned = ALIGN(packetlen, sizeof(u64));
struct scatterlist bufferlist[3]; struct scatterlist bufferlist[3];
u64 aligned_data = 0; u64 aligned_data = 0;
int ret; int ret;
...@@ -793,7 +793,7 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel, ...@@ -793,7 +793,7 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
((MAX_PAGE_BUFFER_COUNT - pagecount) * ((MAX_PAGE_BUFFER_COUNT - pagecount) *
sizeof(struct hv_page_buffer)); sizeof(struct hv_page_buffer));
packetlen = descsize + bufferlen; packetlen = descsize + bufferlen;
packetlen_aligned = ALIGN_UP(packetlen, sizeof(u64)); packetlen_aligned = ALIGN(packetlen, sizeof(u64));
/* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */ /* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */
...@@ -862,7 +862,7 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel, ...@@ -862,7 +862,7 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,
((MAX_MULTIPAGE_BUFFER_COUNT - pfncount) * ((MAX_MULTIPAGE_BUFFER_COUNT - pfncount) *
sizeof(u64)); sizeof(u64));
packetlen = descsize + bufferlen; packetlen = descsize + bufferlen;
packetlen_aligned = ALIGN_UP(packetlen, sizeof(u64)); packetlen_aligned = ALIGN(packetlen, sizeof(u64));
/* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */ /* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */
......
...@@ -267,7 +267,7 @@ int hv_init(void) ...@@ -267,7 +267,7 @@ int hv_init(void)
hv_context.signal_event_param = hv_context.signal_event_param =
(struct hv_input_signal_event *) (struct hv_input_signal_event *)
(ALIGN_UP((unsigned long) (ALIGN((unsigned long)
hv_context.signal_event_buffer, hv_context.signal_event_buffer,
HV_HYPERCALL_PARAM_ALIGN)); HV_HYPERCALL_PARAM_ALIGN));
hv_context.signal_event_param->connectionid.asu32 = 0; hv_context.signal_event_param->connectionid.asu32 = 0;
...@@ -338,7 +338,7 @@ u16 hv_post_message(union hv_connection_id connection_id, ...@@ -338,7 +338,7 @@ u16 hv_post_message(union hv_connection_id connection_id,
return -1; return -1;
aligned_msg = (struct hv_input_post_message *) aligned_msg = (struct hv_input_post_message *)
(ALIGN_UP(addr, HV_HYPERCALL_PARAM_ALIGN)); (ALIGN(addr, HV_HYPERCALL_PARAM_ALIGN));
aligned_msg->connectionid = connection_id; aligned_msg->connectionid = connection_id;
aligned_msg->message_type = message_type; aligned_msg->message_type = message_type;
......
...@@ -25,16 +25,12 @@ ...@@ -25,16 +25,12 @@
#ifndef _OSD_H_ #ifndef _OSD_H_
#define _OSD_H_ #define _OSD_H_
#include <linux/kernel.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
/* Defines */ /* Defines */
#define ALIGN_UP(value, align) (((value) & (align-1)) ? \ #define NUM_PAGES_SPANNED(addr, len) ((PAGE_ALIGN(addr + len) >> PAGE_SHIFT) - \
(((value) + (align-1)) & ~(align-1)) : \ (addr >> PAGE_SHIFT))
(value))
#define ALIGN_DOWN(value, align) ((value) & ~(align-1))
#define NUM_PAGES_SPANNED(addr, len) ((ALIGN_UP(addr+len, PAGE_SIZE) - \
ALIGN_DOWN(addr, PAGE_SIZE)) >> \
PAGE_SHIFT)
#define LOWORD(dw) ((unsigned short)(dw)) #define LOWORD(dw) ((unsigned short)(dw))
#define HIWORD(dw) ((unsigned short)(((unsigned int) (dw) >> 16) & 0xFFFF)) #define HIWORD(dw) ((unsigned short)(((unsigned int) (dw) >> 16) & 0xFFFF))
......
...@@ -437,7 +437,7 @@ static void stor_vsc_on_channel_callback(void *context) ...@@ -437,7 +437,7 @@ static void stor_vsc_on_channel_callback(void *context)
struct storvsc_device *stor_device; struct storvsc_device *stor_device;
u32 bytes_recvd; u32 bytes_recvd;
u64 request_id; u64 request_id;
unsigned char packet[ALIGN_UP(sizeof(struct vstor_packet), 8)]; unsigned char packet[ALIGN(sizeof(struct vstor_packet), 8)];
struct storvsc_request_extension *request; struct storvsc_request_extension *request;
int ret; int ret;
...@@ -452,7 +452,7 @@ static void stor_vsc_on_channel_callback(void *context) ...@@ -452,7 +452,7 @@ static void stor_vsc_on_channel_callback(void *context)
do { do {
ret = vmbus_recvpacket(device->channel, packet, ret = vmbus_recvpacket(device->channel, packet,
ALIGN_UP(sizeof(struct vstor_packet), 8), ALIGN(sizeof(struct vstor_packet), 8),
&bytes_recvd, &request_id); &bytes_recvd, &request_id);
if (ret == 0 && bytes_recvd > 0) { if (ret == 0 && bytes_recvd > 0) {
DPRINT_DBG(STORVSC, "receive %d bytes - tid %llx", DPRINT_DBG(STORVSC, "receive %d bytes - tid %llx",
...@@ -802,7 +802,7 @@ int stor_vsc_initialize(struct hv_driver *driver) ...@@ -802,7 +802,7 @@ int stor_vsc_initialize(struct hv_driver *driver)
*/ */
stor_driver->max_outstanding_req_per_channel = stor_driver->max_outstanding_req_per_channel =
((stor_driver->ring_buffer_size - PAGE_SIZE) / ((stor_driver->ring_buffer_size - PAGE_SIZE) /
ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET + ALIGN(MAX_MULTIPAGE_BUFFER_PACKET +
sizeof(struct vstor_packet) + sizeof(u64), sizeof(struct vstor_packet) + sizeof(u64),
sizeof(u64))); sizeof(u64)));
......
...@@ -434,7 +434,7 @@ static struct scatterlist *create_bounce_buffer(struct scatterlist *sgl, ...@@ -434,7 +434,7 @@ static struct scatterlist *create_bounce_buffer(struct scatterlist *sgl,
struct scatterlist *bounce_sgl; struct scatterlist *bounce_sgl;
struct page *page_buf; struct page *page_buf;
num_pages = ALIGN_UP(len, PAGE_SIZE) >> PAGE_SHIFT; num_pages = ALIGN(len, PAGE_SIZE) >> PAGE_SHIFT;
bounce_sgl = kcalloc(num_pages, sizeof(struct scatterlist), GFP_ATOMIC); bounce_sgl = kcalloc(num_pages, sizeof(struct scatterlist), GFP_ATOMIC);
if (!bounce_sgl) if (!bounce_sgl)
...@@ -720,7 +720,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd, ...@@ -720,7 +720,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
} }
cmd_request->bounce_sgl_count = cmd_request->bounce_sgl_count =
ALIGN_UP(scsi_bufflen(scmnd), PAGE_SIZE) >> ALIGN(scsi_bufflen(scmnd), PAGE_SIZE) >>
PAGE_SHIFT; PAGE_SHIFT;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment