Skip to content

Commit

Permalink
staging: unisys: visorchannel: Make visorchannel_create take a gfp_t
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jes Sorensen authored and Greg Kroah-Hartman committed May 8, 2015
1 parent 1210f8e commit df94247
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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, \
Expand Down
7 changes: 4 additions & 3 deletions drivers/staging/unisys/include/visorbus.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion drivers/staging/unisys/visorbus/visorbus_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
18 changes: 10 additions & 8 deletions drivers/staging/unisys/visorbus/visorchannel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -112,18 +113,19 @@ visorchannel_create_guts(u64 physaddr, ulong channel_bytes,
}

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);
Expand Down
8 changes: 4 additions & 4 deletions drivers/staging/unisys/visorbus/visorchipset.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit df94247

Please sign in to comment.