staging: unisys: visorchannel: Make visorchannel_create take a gfp_t
authorJes Sorensen <Jes.Sorensen@redhat.com>
Tue, 5 May 2015 22:37:10 +0000 (18:37 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 May 2015 13:27:32 +0000 (15:27 +0200)
This allows the caller to specify an appropriate GFP flag instead of
hardcoding the lowest common denominator.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h
drivers/staging/unisys/include/visorbus.h
drivers/staging/unisys/visorbus/visorbus_main.c
drivers/staging/unisys/visorbus/visorchannel.c
drivers/staging/unisys/visorbus/visorchipset.c

index d8ed52edd9380794361fa10c1d503de65caccc4d..f1c86fbc126c0a54e3355eed38d85e70331cd452 100644 (file)
@@ -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, \
index 0f1966ceda6ce23c13af7df6c7d1924ffebc85da..d54282222f659fd8b22690c25bbd0f9a35d01c98 100644 (file)
@@ -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);
index 2e00e424958273aab97895af6658e32a92e0f300..77afa9dbbdc800eaa6593b297e7318d5e940afaa 100644 (file)
@@ -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,
index 44ea4346280344eedade1c2f82a31ce8eb6d44ba..2d3e4d6defead8d10d194aaba2d24f69dfcccf51 100644 (file)
@@ -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);
index 776bf2e59026858c6c0731193c626da9ec522b6a..e61ec342c2ea3b68436e36cd92e82538d94c78d7 100644 (file)
@@ -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();