[PATCH 093/141] staging: unisys: visorchannel: Make visorchannel_create take a gfp_t

Benjamin Romer benjamin.romer at unisys.com
Tue May 5 22:37:10 UTC 2015


From: Jes Sorensen <Jes.Sorensen at redhat.com>

This allows the caller to specify an appropriate GFP flag instead of
hardcoding the lowest common denominator.

Signed-off-by: Jes Sorensen <Jes.Sorensen at redhat.com>
Signed-off-by: Benjamin Romer <benjamin.romer at unisys.com>
---
 .../common-spar/include/channels/controlvmchannel.h    |  5 +----
 drivers/staging/unisys/include/visorbus.h              |  7 ++++---
 drivers/staging/unisys/visorbus/visorbus_main.c        |  3 ++-
 drivers/staging/unisys/visorbus/visorchannel.c         | 18 ++++++++++--------
 drivers/staging/unisys/visorbus/visorchipset.c         |  8 ++++----
 5 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h b/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h
index d8ed52e..f1c86fb 100644
--- a/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h
+++ b/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h
@@ -25,9 +25,6 @@
 		UUID_LE(0x2b3c2d10, 0x7ef5, 0x4ad8, \
 			0xb9, 0x66, 0x34, 0x48, 0xb7, 0x38, 0x6b, 0x3d)
 
-static const uuid_le spar_controlvm_channel_protocol_uuid =
-	SPAR_CONTROLVM_CHANNEL_PROTOCOL_UUID;
-
 #define ULTRA_CONTROLVM_CHANNEL_PROTOCOL_SIGNATURE \
 	ULTRA_CHANNEL_PROTOCOL_SIGNATURE
 #define CONTROLVM_MESSAGE_MAX 64
@@ -42,7 +39,7 @@ static const uuid_le spar_controlvm_channel_protocol_uuid =
 
 #define SPAR_CONTROLVM_CHANNEL_OK_CLIENT(ch)           \
 	spar_check_channel_client(ch, \
-		spar_controlvm_channel_protocol_uuid, \
+		SPAR_CONTROLVM_CHANNEL_PROTOCOL_UUID, \
 		"controlvm", \
 		sizeof(struct spar_controlvm_channel_protocol), \
 		ULTRA_CONTROLVM_CHANNEL_PROTOCOL_VERSIONID, \
diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h
index 0f1966c..d542822 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -168,10 +168,11 @@ void visorbus_disable_channel_interrupts(struct visor_device *dev);
  * In this case, the values can simply be read from the channel header.
  */
 struct visorchannel *visorchannel_create(u64 physaddr,
-					 ulong channel_bytes, uuid_le guid);
+					 unsigned long channel_bytes,
+					 gfp_t gfp, uuid_le guid);
 struct visorchannel *visorchannel_create_with_lock(u64 physaddr,
-						   ulong channel_bytes,
-						   uuid_le guid);
+						   unsigned long channel_bytes,
+						   gfp_t gfp, uuid_le guid);
 void visorchannel_destroy(struct visorchannel *channel);
 int visorchannel_read(struct visorchannel *channel, ulong offset,
 		      void *local, ulong nbytes);
diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index 2e00e42..77afa9d 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -1308,8 +1308,8 @@ create_visor_device(struct visorbus_devdata *devdata,
 			 POSTCODE_SEVERITY_INFO);
 	/* prepare chan_hdr (abstraction to read/write channel memory) */
 	visorchannel = visorchannel_create(chan_info.channel_addr,
-					   (unsigned long)
 					   chan_info.n_channel_bytes,
+					   GFP_KERNEL,
 					   chan_info.channel_type_uuid);
 	if (!visorchannel) {
 		POSTCODE_LINUX_3(DEVICE_CREATE_FAILURE_PC, chipset_dev_no,
@@ -1676,6 +1676,7 @@ create_bus_instance(int id)
 
 		devdata->chan = visorchannel_create(channel_addr,
 						    n_channel_bytes,
+						    GFP_KERNEL,
 						    channel_type_guid);
 		if (!devdata->chan) {
 			POSTCODE_LINUX_3(DEVICE_CREATE_FAILURE_PC, channel_addr,
diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c
index 44ea434..2d3e4d6 100644
--- a/drivers/staging/unisys/visorbus/visorchannel.c
+++ b/drivers/staging/unisys/visorbus/visorchannel.c
@@ -50,14 +50,15 @@ struct visorchannel {
  * but does NOT modify this data area.
  */
 static struct visorchannel *
-visorchannel_create_guts(u64 physaddr, ulong channel_bytes,
-			 ulong off, uuid_le guid, bool needs_lock)
+visorchannel_create_guts(u64 physaddr, unsigned long channel_bytes,
+			 gfp_t gfp, unsigned long off,
+			 uuid_le guid, bool needs_lock)
 {
 	struct visorchannel *channel;
 	int err;
 	size_t size = sizeof(struct channel_header);
 
-	channel = kzalloc(sizeof(*channel), GFP_KERNEL|__GFP_NORETRY);
+	channel = kzalloc(sizeof(*channel), gfp);
 	if (!channel)
 		goto cleanup;
 
@@ -112,18 +113,19 @@ cleanup:
 }
 
 struct visorchannel *
-visorchannel_create(u64 physaddr, ulong channel_bytes, uuid_le guid)
+visorchannel_create(u64 physaddr, unsigned long channel_bytes,
+		    gfp_t gfp, uuid_le guid)
 {
-	return visorchannel_create_guts(physaddr, channel_bytes, 0, guid,
+	return visorchannel_create_guts(physaddr, channel_bytes, gfp, 0, guid,
 					false);
 }
 EXPORT_SYMBOL_GPL(visorchannel_create);
 
 struct visorchannel *
-visorchannel_create_with_lock(u64 physaddr, ulong channel_bytes,
-			      uuid_le guid)
+visorchannel_create_with_lock(u64 physaddr, unsigned long channel_bytes,
+			      gfp_t gfp, uuid_le guid)
 {
-	return visorchannel_create_guts(physaddr, channel_bytes, 0, guid,
+	return visorchannel_create_guts(physaddr, channel_bytes, gfp, 0, guid,
 					true);
 }
 EXPORT_SYMBOL_GPL(visorchannel_create_with_lock);
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 776bf2e..e61ec34 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -2659,11 +2659,11 @@ visorchipset_init(struct acpi_device *acpi_device)
 
 	addr = controlvm_get_channel_address();
 	if (addr) {
+		int tmp_sz = sizeof(struct spar_controlvm_channel_protocol);
+		uuid_le uuid = SPAR_CONTROLVM_CHANNEL_PROTOCOL_UUID;
 		controlvm_channel =
-		    visorchannel_create_with_lock
-		    (addr,
-		     sizeof(struct spar_controlvm_channel_protocol),
-		     spar_controlvm_channel_protocol_uuid);
+			visorchannel_create_with_lock(addr, tmp_sz,
+						      GFP_KERNEL, uuid);
 		if (SPAR_CONTROLVM_CHANNEL_OK_CLIENT(
 				visorchannel_get_header(controlvm_channel))) {
 			initialize_controlvm_payload();
-- 
2.1.4



More information about the devel mailing list