staging: unisys: visorchannel: Make visorchannel_create take a gfp_t

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>
This commit is contained in:
Jes Sorensen 2015-05-05 18:37:10 -04:00 committed by Greg Kroah-Hartman
parent 1210f8e72b
commit df94247a89
5 changed files with 21 additions and 20 deletions

View 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, \

View 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);

View 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,

View 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 @@ 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);

View 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();