[PATCH 04/19] staging: unisys: visorchipset: Do not use confuse size of long with size of u32

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>

struct visorcipset_device_info defines bus_no and dev_no as u32, while
the deprecated ulong type is 64 bits. Hence avoid promoting the values
to 64 bit just to truncate them again later.

Signed-off-by: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>
Tested-by: Benjamin Romer <benjamin.romer@xxxxxxxxxx>
---
 drivers/staging/unisys/visorchipset/visorchipset.h | 35 ++++++-----
 .../unisys/visorchipset/visorchipset_main.c        | 67 +++++++++++-----------
 2 files changed, 50 insertions(+), 52 deletions(-)

diff --git a/drivers/staging/unisys/visorchipset/visorchipset.h b/drivers/staging/unisys/visorchipset/visorchipset.h
index 4c1a74f..3a8aa56 100644
--- a/drivers/staging/unisys/visorchipset/visorchipset.h
+++ b/drivers/staging/unisys/visorchipset/visorchipset.h
@@ -162,12 +162,12 @@ findbus(struct list_head *list, u32 bus_no)
  *  visorchipset.)
  */
 struct visorchipset_busdev_notifiers {
-	void (*bus_create)(ulong bus_no);
-	void (*bus_destroy)(ulong bus_no);
-	void (*device_create)(ulong bus_no, ulong dev_no);
-	void (*device_destroy)(ulong bus_no, ulong dev_no);
-	void (*device_pause)(ulong bus_no, ulong dev_no);
-	void (*device_resume)(ulong bus_no, ulong dev_no);
+	void (*bus_create)(u32 bus_no);
+	void (*bus_destroy)(u32 bus_no);
+	void (*device_create)(u32 bus_no, u32 dev_no);
+	void (*device_destroy)(u32 bus_no, u32 dev_no);
+	void (*device_pause)(u32 bus_no, u32 dev_no);
+	void (*device_resume)(u32 bus_no, u32 dev_no);
 	int (*get_channel_info)(uuid_le type_uuid, ulong *min_size,
 				ulong *max_size);
 };
@@ -179,12 +179,12 @@ struct visorchipset_busdev_notifiers {
  *      -1 = it failed
  */
 struct visorchipset_busdev_responders {
-	void (*bus_create)(ulong bus_no, int response);
-	void (*bus_destroy)(ulong bus_no, int response);
-	void (*device_create)(ulong bus_no, ulong dev_no, int response);
-	void (*device_destroy)(ulong bus_no, ulong dev_no, int response);
-	void (*device_pause)(ulong bus_no, ulong dev_no, int response);
-	void (*device_resume)(ulong bus_no, ulong dev_no, int response);
+	void (*bus_create)(u32 bus_no, int response);
+	void (*bus_destroy)(u32 bus_no, int response);
+	void (*device_create)(u32 bus_no, u32 dev_no, int response);
+	void (*device_destroy)(u32 bus_no, u32 dev_no, int response);
+	void (*device_pause)(u32 bus_no, u32 dev_no, int response);
+	void (*device_resume)(u32 bus_no, u32 dev_no, int response);
 };
 
 /** Register functions (in the bus driver) to get called by visorchipset
@@ -214,15 +214,14 @@ visorchipset_register_busdev_server(
 typedef void (*SPARREPORTEVENT_COMPLETE_FUNC) (struct controlvm_message *msg,
 					       int status);
 
-void visorchipset_device_pause_response(ulong bus_no, ulong dev_no,
-					int response);
+void visorchipset_device_pause_response(u32 bus_no, u32 dev_no, int response);
 
-bool visorchipset_get_bus_info(ulong bus_no,
+bool visorchipset_get_bus_info(u32 bus_no,
 			       struct visorchipset_bus_info *bus_info);
-bool visorchipset_get_device_info(ulong bus_no, ulong dev_no,
+bool visorchipset_get_device_info(u32 bus_no, u32 dev_no,
 				  struct visorchipset_device_info *dev_info);
-bool visorchipset_set_bus_context(ulong bus_no, void *context);
-bool visorchipset_set_device_context(ulong bus_no, ulong dev_no, void *context);
+bool visorchipset_set_bus_context(u32 bus_no, void *context);
+bool visorchipset_set_device_context(u32 bus_no, u32 dev_no, void *context);
 int visorchipset_chipset_ready(void);
 int visorchipset_chipset_selftest(void);
 int visorchipset_chipset_notready(void);
diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c
index 0b016e3..54abe13 100644
--- a/drivers/staging/unisys/visorchipset/visorchipset_main.c
+++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c
@@ -48,8 +48,8 @@
 * message, we switch back to fast polling mode.
 */
 #define MIN_IDLE_SECONDS 10
-static ulong poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST;
-static ulong most_recent_message_jiffies;	/* when we got our last
+static unsigned long poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST;
+static unsigned long most_recent_message_jiffies;	/* when we got our last
 						 * controlvm message */
 static int serverregistered;
 static int clientregistered;
@@ -67,8 +67,8 @@ static struct controlvm_message_header g_del_dump_msg_hdr;
 static const uuid_le spar_diag_pool_channel_protocol_uuid =
 	SPAR_DIAG_POOL_CHANNEL_PROTOCOL_UUID;
 /* 0xffffff is an invalid Bus/Device number */
-static ulong g_diagpool_bus_no = 0xffffff;
-static ulong g_diagpool_dev_no = 0xffffff;
+static u32 g_diagpool_bus_no = 0xffffff;
+static u32 g_diagpool_dev_no = 0xffffff;
 static struct controlvm_message_packet g_devicechangestate_packet;
 
 /* Only VNIC and VHBA channels are sent to visorclientbus (aka
@@ -109,9 +109,9 @@ struct visor_livedump_info {
 	struct controlvm_message_header dumpcomplete_header;
 	bool gettextdump_outstanding;
 	u32 crc32;
-	ulong length;
+	unsigned long length;
 	atomic_t buffers_in_use;
-	ulong destination;
+	unsigned long destination;
 };
 
 static struct visor_livedump_info livedump_info;
@@ -218,11 +218,11 @@ static void parahotplug_process_list(void);
 static struct visorchipset_busdev_notifiers busdev_server_notifiers;
 static struct visorchipset_busdev_notifiers busdev_client_notifiers;
 
-static void bus_create_response(ulong bus_no, int response);
-static void bus_destroy_response(ulong bus_no, int response);
-static void device_create_response(ulong bus_no, ulong dev_no, int response);
-static void device_destroy_response(ulong bus_no, ulong dev_no, int response);
-static void device_resume_response(ulong bus_no, ulong dev_no, int response);
+static void bus_create_response(u32 bus_no, int response);
+static void bus_destroy_response(u32 bus_no, int response);
+static void device_create_response(u32 bus_no, u32 dev_no, int response);
+static void device_destroy_response(u32 bus_no, u32 dev_no, int response);
+static void device_resume_response(u32 bus_no, u32 dev_no, int response);
 
 static struct visorchipset_busdev_responders busdev_responders = {
 	.bus_create = bus_create_response,
@@ -772,7 +772,7 @@ visorchipset_save_message(struct controlvm_message *msg,
 EXPORT_SYMBOL_GPL(visorchipset_save_message);
 
 static void
-bus_responder(enum controlvm_id cmd_id, ulong bus_no, int response)
+bus_responder(enum controlvm_id cmd_id, u32 bus_no, int response)
 {
 	struct visorchipset_bus_info *p = NULL;
 	bool need_clear = false;
@@ -807,7 +807,7 @@ bus_responder(enum controlvm_id cmd_id, ulong bus_no, int response)
 
 static void
 device_changestate_responder(enum controlvm_id cmd_id,
-			     ulong bus_no, ulong dev_no, int response,
+			     u32 bus_no, u32 dev_no, int response,
 			     struct spar_segment_state response_state)
 {
 	struct visorchipset_device_info *p = NULL;
@@ -835,8 +835,7 @@ device_changestate_responder(enum controlvm_id cmd_id,
 }
 
 static void
-device_responder(enum controlvm_id cmd_id, ulong bus_no, ulong dev_no,
-		 int response)
+device_responder(enum controlvm_id cmd_id, u32 bus_no, u32 dev_no, int response)
 {
 	struct visorchipset_device_info *p = NULL;
 	bool need_clear = false;
@@ -1032,7 +1031,7 @@ static void
 bus_create(struct controlvm_message *inmsg)
 {
 	struct controlvm_message_packet *cmd = &inmsg->cmd;
-	ulong bus_no = cmd->create_bus.bus_no;
+	u32 bus_no = cmd->create_bus.bus_no;
 	int rc = CONTROLVM_RESP_SUCCESS;
 	struct visorchipset_bus_info *bus_info = NULL;
 
@@ -1082,7 +1081,7 @@ static void
 bus_destroy(struct controlvm_message *inmsg)
 {
 	struct controlvm_message_packet *cmd = &inmsg->cmd;
-	ulong bus_no = cmd->destroy_bus.bus_no;
+	u32 bus_no = cmd->destroy_bus.bus_no;
 	struct visorchipset_bus_info *bus_info;
 	int rc = CONTROLVM_RESP_SUCCESS;
 
@@ -1101,7 +1100,7 @@ bus_configure(struct controlvm_message *inmsg,
 	      struct parser_context *parser_ctx)
 {
 	struct controlvm_message_packet *cmd = &inmsg->cmd;
-	ulong bus_no = cmd->configure_bus.bus_no;
+	u32 bus_no = cmd->configure_bus.bus_no;
 	struct visorchipset_bus_info *bus_info = NULL;
 	int rc = CONTROLVM_RESP_SUCCESS;
 	char s[99];
@@ -1141,8 +1140,8 @@ static void
 my_device_create(struct controlvm_message *inmsg)
 {
 	struct controlvm_message_packet *cmd = &inmsg->cmd;
-	ulong bus_no = cmd->create_device.bus_no;
-	ulong dev_no = cmd->create_device.dev_no;
+	u32 bus_no = cmd->create_device.bus_no;
+	u32 dev_no = cmd->create_device.dev_no;
 	struct visorchipset_device_info *dev_info = NULL;
 	struct visorchipset_bus_info *bus_info = NULL;
 	int rc = CONTROLVM_RESP_SUCCESS;
@@ -1211,8 +1210,8 @@ static void
 my_device_changestate(struct controlvm_message *inmsg)
 {
 	struct controlvm_message_packet *cmd = &inmsg->cmd;
-	ulong bus_no = cmd->device_change_state.bus_no;
-	ulong dev_no = cmd->device_change_state.dev_no;
+	u32 bus_no = cmd->device_change_state.bus_no;
+	u32 dev_no = cmd->device_change_state.dev_no;
 	struct spar_segment_state state = cmd->device_change_state.state;
 	struct visorchipset_device_info *dev_info = NULL;
 	int rc = CONTROLVM_RESP_SUCCESS;
@@ -1239,8 +1238,8 @@ static void
 my_device_destroy(struct controlvm_message *inmsg)
 {
 	struct controlvm_message_packet *cmd = &inmsg->cmd;
-	ulong bus_no = cmd->destroy_device.bus_no;
-	ulong dev_no = cmd->destroy_device.dev_no;
+	u32 bus_no = cmd->destroy_device.bus_no;
+	u32 dev_no = cmd->destroy_device.dev_no;
 	struct visorchipset_device_info *dev_info = NULL;
 	int rc = CONTROLVM_RESP_SUCCESS;
 
@@ -1955,31 +1954,31 @@ cleanup:
 }
 
 static void
-bus_create_response(ulong bus_no, int response)
+bus_create_response(u32 bus_no, int response)
 {
 	bus_responder(CONTROLVM_BUS_CREATE, bus_no, response);
 }
 
 static void
-bus_destroy_response(ulong bus_no, int response)
+bus_destroy_response(u32 bus_no, int response)
 {
 	bus_responder(CONTROLVM_BUS_DESTROY, bus_no, response);
 }
 
 static void
-device_create_response(ulong bus_no, ulong dev_no, int response)
+device_create_response(u32 bus_no, u32 dev_no, int response)
 {
 	device_responder(CONTROLVM_DEVICE_CREATE, bus_no, dev_no, response);
 }
 
 static void
-device_destroy_response(ulong bus_no, ulong dev_no, int response)
+device_destroy_response(u32 bus_no, u32 dev_no, int response)
 {
 	device_responder(CONTROLVM_DEVICE_DESTROY, bus_no, dev_no, response);
 }
 
 void
-visorchipset_device_pause_response(ulong bus_no, ulong dev_no, int response)
+visorchipset_device_pause_response(u32 bus_no, u32 dev_no, int response)
 {
 	device_changestate_responder(CONTROLVM_DEVICE_CHANGESTATE,
 				     bus_no, dev_no, response,
@@ -1988,7 +1987,7 @@ visorchipset_device_pause_response(ulong bus_no, ulong dev_no, int response)
 EXPORT_SYMBOL_GPL(visorchipset_device_pause_response);
 
 static void
-device_resume_response(ulong bus_no, ulong dev_no, int response)
+device_resume_response(u32 bus_no, u32 dev_no, int response)
 {
 	device_changestate_responder(CONTROLVM_DEVICE_CHANGESTATE,
 				     bus_no, dev_no, response,
@@ -1996,7 +1995,7 @@ device_resume_response(ulong bus_no, ulong dev_no, int response)
 }
 
 bool
-visorchipset_get_bus_info(ulong bus_no, struct visorchipset_bus_info *bus_info)
+visorchipset_get_bus_info(u32 bus_no, struct visorchipset_bus_info *bus_info)
 {
 	void *p = findbus(&bus_info_list, bus_no);
 
@@ -2008,7 +2007,7 @@ visorchipset_get_bus_info(ulong bus_no, struct visorchipset_bus_info *bus_info)
 EXPORT_SYMBOL_GPL(visorchipset_get_bus_info);
 
 bool
-visorchipset_set_bus_context(ulong bus_no, void *context)
+visorchipset_set_bus_context(u32 bus_no, void *context)
 {
 	struct visorchipset_bus_info *p = findbus(&bus_info_list, bus_no);
 
@@ -2020,7 +2019,7 @@ visorchipset_set_bus_context(ulong bus_no, void *context)
 EXPORT_SYMBOL_GPL(visorchipset_set_bus_context);
 
 bool
-visorchipset_get_device_info(ulong bus_no, ulong dev_no,
+visorchipset_get_device_info(u32 bus_no, u32 dev_no,
 			     struct visorchipset_device_info *dev_info)
 {
 	void *p = finddevice(&dev_info_list, bus_no, dev_no);
@@ -2033,7 +2032,7 @@ visorchipset_get_device_info(ulong bus_no, ulong dev_no,
 EXPORT_SYMBOL_GPL(visorchipset_get_device_info);
 
 bool
-visorchipset_set_device_context(ulong bus_no, ulong dev_no, void *context)
+visorchipset_set_device_context(u32 bus_no, u32 dev_no, void *context)
 {
 	struct visorchipset_device_info *p =
 			finddevice(&dev_info_list, bus_no, dev_no);
-- 
2.1.0

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux