[PATCH 2/6] staging: unisys: visorinput: Clean up Makefile includes
The driver no longer needs to include drivers/staging/unisys/include, so we can get rid of it. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorinput/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/unisys/visorinput/Makefile b/drivers/staging/unisys/visorinput/Makefile index beedca7..6e4bfa0 100644 --- a/drivers/staging/unisys/visorinput/Makefile +++ b/drivers/staging/unisys/visorinput/Makefile @@ -4,4 +4,3 @@ obj-$(CONFIG_UNISYS_VISORINPUT)+= visorinput.o -ccflags-y += -Idrivers/staging/unisys/include -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/6] staging: unisys: visorinput: Fix spacing after open paranthesis
Checkpatch was giving errors about an open parenthesis being the last thing on a line. This patch cleans up some names and removes the checkpatch warnings. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorinput/visorinput.c | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/staging/unisys/visorinput/visorinput.c b/drivers/staging/unisys/visorinput/visorinput.c index 634b16b..aae3fe5 100644 --- a/drivers/staging/unisys/visorinput/visorinput.c +++ b/drivers/staging/unisys/visorinput/visorinput.c @@ -91,7 +91,7 @@ struct visor_input_channel_data { }; } __packed; -enum visorinput_device_type { +enum visorinput_dev_type { visorinput_keyboard, visorinput_mouse, }; @@ -397,16 +397,15 @@ static struct input_dev *setup_client_mouse(void *devdata, unsigned int xres, return visorinput_dev; } -static struct visorinput_devdata *devdata_create( - struct visor_device *dev, - enum visorinput_device_type devtype) +static struct visorinput_devdata *devdata_create(struct visor_device *dev, +enum visorinput_dev_type dtype) { struct visorinput_devdata *devdata = NULL; unsigned int extra_bytes = 0; unsigned int size, xres, yres, err; struct visor_input_channel_data data; - if (devtype == visorinput_keyboard) + if (dtype == visorinput_keyboard) /* allocate room for devdata->keycode_table, filled in below */ extra_bytes = KEYCODE_TABLE_BYTES * 2; devdata = kzalloc(sizeof(*devdata) + extra_bytes, GFP_KERNEL); @@ -429,7 +428,7 @@ static struct visorinput_devdata *devdata_create( * so we need to create whatever input nodes are necessary to * deliver our inputs to the guest OS. */ - switch (devtype) { + switch (dtype) { case visorinput_keyboard: devdata->keycode_table_bytes = extra_bytes; memcpy(devdata->keycode_table, visorkbd_keycode, @@ -497,17 +496,17 @@ static struct visorinput_devdata *devdata_create( static int visorinput_probe(struct visor_device *dev) { const guid_t *guid; - enum visorinput_device_type devtype; + enum visorinput_dev_type dtype; guid = visorchannel_get_guid(dev->visorchannel); if (guid_equal(guid, &visor_mouse_channel_guid)) - devtype = visorinput_mouse; + dtype = visorinput_mouse; else if (guid_equal(guid, &visor_keyboard_channel_guid)) - devtype = visorinput_keyboard; + dtype = visorinput_keyboard; else return -ENODEV; visorbus_disable_channel_interrupts(dev); - if (!devdata_create(dev, devtype)) + if (!devdata_create(dev, dtype)) return -ENOMEM; return 0; } -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/6] staging: unisys: visorinput: Updates to visorinput
Miscellaneous patches to the visorinput driver. David Kershner (5): staging: unisys: visorinput: Clean up Makefile includes staging: unisys: visorinput: remove duplicate comments staging: unisys: visorinput: combine ultrainputreport.h with visorinput.c staging: unisys: visorinput: Fix spacing after open paranthesis staging: unisys: visorinput: use the full 80 characters of the screen Tim Sell (1): staging: unisys: visorinput: remove need for 'depends on FB' drivers/staging/unisys/visorinput/Kconfig| 2 +- drivers/staging/unisys/visorinput/Makefile | 1 +- drivers/staging/unisys/visorinput/ultrainputreport.h | 57 + drivers/staging/unisys/visorinput/visorinput.c | 169 +++- 4 files changed, 113 insertions(+), 116 deletions(-) delete mode 100644 drivers/staging/unisys/visorinput/ultrainputreport.h base-commit: 3384e01179eff2b2fe91ba7bcad98ee2be5f87f7 -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/6] staging: unisys: visorinput: remove need for 'depends on FB'
From: Tim Sell Previously, we used a hack to determine the max x,y resolution of the visor virtual mouse: we just looked at the resolution of the first-registered framebuffer device, using the currently-valid assumption that in a Unisys s-Par guest environment the video will be provided by an efifb framebuffer device. This hack has been removed, by instead determining the default mouse resolution by looking at fields within the visor mouse channel memory, mouse.x_res and mouse.y_res. If these fields are 0, a default resolution of 1024x768 is assumed. Signed-off-by: Tim Sell Signed-off-by: David Kershner --- drivers/staging/unisys/visorinput/Kconfig | 2 +- drivers/staging/unisys/visorinput/visorinput.c | 43 +-- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/drivers/staging/unisys/visorinput/Kconfig b/drivers/staging/unisys/visorinput/Kconfig index 655cd62..a3817e0 100644 --- a/drivers/staging/unisys/visorinput/Kconfig +++ b/drivers/staging/unisys/visorinput/Kconfig @@ -4,7 +4,7 @@ config UNISYS_VISORINPUT tristate "Unisys visorinput driver" - depends on UNISYSSPAR && UNISYS_VISORBUS && FB && INPUT + depends on UNISYSSPAR && UNISYS_VISORBUS && INPUT ---help--- The Unisys s-Par visorinput driver provides a virtualized system console (keyboard and mouse) that is accessible through the diff --git a/drivers/staging/unisys/visorinput/visorinput.c b/drivers/staging/unisys/visorinput/visorinput.c index d8048e4..9973040 100644 --- a/drivers/staging/unisys/visorinput/visorinput.c +++ b/drivers/staging/unisys/visorinput/visorinput.c @@ -32,10 +32,24 @@ 0x81, 0xc3, 0x61, 0xab, 0xcd, 0xbd, 0xbd, 0x87) #define VISOR_MOUSE_CHANNEL_GUID_STR "addf07d4-94a9-46e2-81c3-61abcdbdbd87" -#define PIXELS_ACROSS_DEFAULT 800 -#define PIXELS_DOWN_DEFAULT 600 +#define PIXELS_ACROSS_DEFAULT 1024 +#define PIXELS_DOWN_DEFAULT 768 #define KEYCODE_TABLE_BYTES 256 +/* header of keyboard/mouse channels */ +struct visor_input_channel_data { + u32 n_input_reports; + union { + struct { + u16 x_res; + u16 y_res; + } mouse; + struct { + u32 flags; + } keyboard; + }; +} __packed; + enum visorinput_device_type { visorinput_keyboard, visorinput_mouse, @@ -306,10 +320,9 @@ static struct input_dev *setup_client_keyboard(void *devdata, return visorinput_dev; } -static struct input_dev *setup_client_mouse(void *devdata) +static struct input_dev *setup_client_mouse(void *devdata, unsigned int xres, + unsigned int yres) { - int xres, yres; - struct fb_info *fb0; struct input_dev *visorinput_dev = input_allocate_device(); if (!visorinput_dev) @@ -327,14 +340,10 @@ static struct input_dev *setup_client_mouse(void *devdata) set_bit(BTN_RIGHT, visorinput_dev->keybit); set_bit(BTN_MIDDLE, visorinput_dev->keybit); - if (registered_fb[0]) { - fb0 = registered_fb[0]; - xres = fb0->var.xres_virtual; - yres = fb0->var.yres_virtual; - } else { + if (xres == 0) xres = PIXELS_ACROSS_DEFAULT; + if (yres == 0) yres = PIXELS_DOWN_DEFAULT; - } input_set_abs_params(visorinput_dev, ABS_X, 0, xres, 0, 0); input_set_abs_params(visorinput_dev, ABS_Y, 0, yres, 0, 0); @@ -353,6 +362,8 @@ static struct visorinput_devdata *devdata_create( { struct visorinput_devdata *devdata = NULL; unsigned int extra_bytes = 0; + unsigned int size, xres, yres, err; + struct visor_input_channel_data data; if (devtype == visorinput_keyboard) /* allocate room for devdata->keycode_table, filled in below */ @@ -390,7 +401,15 @@ static struct visorinput_devdata *devdata_create( goto cleanups_register; break; case visorinput_mouse: - devdata->visorinput_dev = setup_client_mouse(devdata); + size = sizeof(struct visor_input_channel_data); + err = visorbus_read_channel(dev, sizeof(struct channel_header), + &data, size); + if (err) + goto cleanups_register; + xres = data.mouse.x_res; + yres = data.mouse.y_res; + devdata->visorinput_dev = setup_client_mouse(devdata, xres, +yres); if (!devdata->visorinput_dev) goto cleanups_register; break; -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/6] staging: unisys: visorinput: remove duplicate comments
Comments were based on individual entries, if we group the entries, we can get rid of duplicate comments. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorinput/ultrainputreport.h | 16 + 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/staging/unisys/visorinput/ultrainputreport.h b/drivers/staging/unisys/visorinput/ultrainputreport.h index 67dac43..5eafa6c 100644 --- a/drivers/staging/unisys/visorinput/ultrainputreport.h +++ b/drivers/staging/unisys/visorinput/ultrainputreport.h @@ -12,35 +12,33 @@ /* These defines identify mouse and keyboard activity which is specified by the * firmware to the host using the cmsimpleinput protocol. @ingroup coretypes */ - /* only motion; arg1=x, arg2=y */ +/* only motion; arg1=x, arg2=y */ #define INPUTACTION_XY_MOTION 1 + /* arg1: 1=left,2=center,3=right */ #define INPUTACTION_MOUSE_BUTTON_DOWN 2 -/* arg1: 1=left,2=center,3=right */ #define INPUTACTION_MOUSE_BUTTON_UP 3 -/* arg1: 1=left,2=center,3=right */ #define INPUTACTION_MOUSE_BUTTON_CLICK 4 -/* arg1: 1=left,2=center 3=right */ #define INPUTACTION_MOUSE_BUTTON_DCLICK 5 -/* arg1: wheel rotation away from user */ + +/* arg1: wheel rotation away from/toward user */ #define INPUTACTION_WHEEL_ROTATE_AWAY 6 -/* arg1: wheel rotation toward user */ #define INPUTACTION_WHEEL_ROTATE_TOWARD 7 + /* arg1: scancode, as follows: If arg1 <= 0xff, it's a 1-byte scancode and arg1 * is that scancode. If arg1 > 0xff, it's a 2-byte scanecode, with the 1st * byte in the low 8 bits, and the 2nd byte in the high 8 bits. * E.g., the right ALT key would appear as x'38e0'. */ #define INPUTACTION_KEY_DOWN 64 -/* arg1: scancode (in same format as inputaction_keyDown) */ #define INPUTACTION_KEY_UP 65 +#define INPUTACTION_KEY_DOWN_UP 67 + /* arg1: scancode (in same format as inputaction_keyDown); MUST refer to one of * the locking keys, like capslock, numlock, or scrolllock. * arg2: 1 iff locking key should be in the LOCKED position (e.g., light is ON) */ #define INPUTACTION_SET_LOCKING_KEY_STATE 66 -/* arg1: scancode (in same format as inputaction_keyDown */ -#define INPUTACTION_KEY_DOWN_UP 67 struct visor_inputactivity { u16 action; -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 6/6] staging: unisys: visorinput: use the full 80 characters of the screen
Several of the comments in the code were not using the full 80 characters of the screen. This patch combines the lines to make full use of the screen. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorinput/visorinput.c | 64 --- 1 file changed, 30 insertions(+), 34 deletions(-) diff --git a/drivers/staging/unisys/visorinput/visorinput.c b/drivers/staging/unisys/visorinput/visorinput.c index aae3fe5..9693fb5 100644 --- a/drivers/staging/unisys/visorinput/visorinput.c +++ b/drivers/staging/unisys/visorinput/visorinput.c @@ -97,9 +97,9 @@ enum visorinput_dev_type { }; /* - * This is the private data that we store for each device. - * A pointer to this struct is maintained via - * dev_get_drvdata() / dev_set_drvdata() for each struct device. + * This is the private data that we store for each device. A pointer to this + * struct is maintained via dev_get_drvdata() / dev_set_drvdata() for each + * struct device. */ struct visorinput_devdata { struct visor_device *dev; @@ -270,10 +270,9 @@ static int visorinput_open(struct input_dev *visorinput_dev) dev_dbg(&visorinput_dev->dev, "%s opened\n", __func__); /* -* If we're not paused, really enable interrupts. -* Regardless of whether we are paused, set a flag indicating -* interrupts should be enabled so when we resume, interrupts -* will really be enabled. +* If we're not paused, really enable interrupts. Regardless of whether +* we are paused, set a flag indicating interrupts should be enabled so +* when we resume, interrupts will really be enabled. */ mutex_lock(&devdata->lock_visor_dev); devdata->interrupts_enabled = true; @@ -299,10 +298,9 @@ static void visorinput_close(struct input_dev *visorinput_dev) dev_dbg(&visorinput_dev->dev, "%s closed\n", __func__); /* -* If we're not paused, really disable interrupts. -* Regardless of whether we are paused, set a flag indicating -* interrupts should be disabled so when we resume we will -* not re-enable them. +* If we're not paused, really disable interrupts. Regardless of +* whether we are paused, set a flag indicating interrupts should be +* disabled so when we resume we will not re-enable them. */ mutex_lock(&devdata->lock_visor_dev); devdata->interrupts_enabled = false; @@ -315,9 +313,9 @@ static void visorinput_close(struct input_dev *visorinput_dev) } /* - * setup_client_keyboard() initializes and returns a Linux input node that - * we can use to deliver keyboard inputs to Linux. We of course do this when - * we see keyboard inputs coming in on a keyboard channel. + * setup_client_keyboard() initializes and returns a Linux input node that we + * can use to deliver keyboard inputs to Linux. We of course do this when we + * see keyboard inputs coming in on a keyboard channel. */ static struct input_dev *setup_client_keyboard(void *devdata, unsigned char *keycode_table) @@ -424,9 +422,9 @@ static struct visorinput_devdata *devdata_create(struct visor_device *dev, devdata->paused = true; /* -* This is an input device in a client guest partition, -* so we need to create whatever input nodes are necessary to -* deliver our inputs to the guest OS. +* This is an input device in a client guest partition, so we need to +* create whatever input nodes are necessary to deliver our inputs to +* the guest OS. */ switch (dtype) { case visorinput_keyboard: @@ -463,10 +461,9 @@ static struct visorinput_devdata *devdata_create(struct visor_device *dev, /* * Device struct is completely set up now, with the exception of -* visorinput_dev being registered. -* We need to unlock before we register the device, because this -* can cause an on-stack call of visorinput_open(), which would -* deadlock if we had the lock. +* visorinput_dev being registered. We need to unlock before we +* register the device, because this can cause an on-stack call of +* visorinput_open(), which would deadlock if we had the lock. */ if (input_register_device(devdata->visorinput_dev)) { input_free_device(devdata->visorinput_dev); @@ -475,9 +472,9 @@ static struct visorinput_devdata *devdata_create(struct visor_device *dev, mutex_lock(&devdata->lock_visor_dev); /* -* Establish calls to visorinput_channel_interrupt() if that is -* the desired state that we've kept track of in interrupts_enabled -* while the device was being created. +* Establish calls to visorinput_channel_interrupt
[PATCH 4/6] staging: unisys: visorinput: combine ultrainputreport.h with visorinput.c
The file ultrainputreport.h was just being used by visorinput.c. Move the definitions into visorinput.c and get rid of the file. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorinput/ultrainputreport.h | 55 +- drivers/staging/unisys/visorinput/visorinput.c | 43 +- 2 files changed, 42 insertions(+), 56 deletions(-) delete mode 100644 drivers/staging/unisys/visorinput/ultrainputreport.h diff --git a/drivers/staging/unisys/visorinput/ultrainputreport.h b/drivers/staging/unisys/visorinput/ultrainputreport.h deleted file mode 100644 index 5eafa6c..000 --- a/drivers/staging/unisys/visorinput/ultrainputreport.h +++ /dev/null @@ -1,55 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 2010 - 2015 UNISYS CORPORATION - * All rights reserved. - */ - -#ifndef __SPAR_ULTRAINPUTREPORT_H__ -#define __SPAR_ULTRAINPUTREPORT_H__ - -#include - -/* These defines identify mouse and keyboard activity which is specified by the - * firmware to the host using the cmsimpleinput protocol. @ingroup coretypes - */ -/* only motion; arg1=x, arg2=y */ -#define INPUTACTION_XY_MOTION 1 - -/* arg1: 1=left,2=center,3=right */ -#define INPUTACTION_MOUSE_BUTTON_DOWN 2 -#define INPUTACTION_MOUSE_BUTTON_UP 3 -#define INPUTACTION_MOUSE_BUTTON_CLICK 4 -#define INPUTACTION_MOUSE_BUTTON_DCLICK 5 - -/* arg1: wheel rotation away from/toward user */ -#define INPUTACTION_WHEEL_ROTATE_AWAY 6 -#define INPUTACTION_WHEEL_ROTATE_TOWARD 7 - -/* arg1: scancode, as follows: If arg1 <= 0xff, it's a 1-byte scancode and arg1 - * is that scancode. If arg1 > 0xff, it's a 2-byte scanecode, with the 1st - * byte in the low 8 bits, and the 2nd byte in the high 8 bits. - * E.g., the right ALT key would appear as x'38e0'. - */ -#define INPUTACTION_KEY_DOWN 64 -#define INPUTACTION_KEY_UP 65 -#define INPUTACTION_KEY_DOWN_UP 67 - -/* arg1: scancode (in same format as inputaction_keyDown); MUST refer to one of - * the locking keys, like capslock, numlock, or scrolllock. - * arg2: 1 iff locking key should be in the LOCKED position (e.g., light is ON) - */ -#define INPUTACTION_SET_LOCKING_KEY_STATE 66 - -struct visor_inputactivity { - u16 action; - u16 arg1; - u16 arg2; - u16 arg3; -} __packed; - -struct visor_inputreport { - u64 seq_no; - struct visor_inputactivity activity; -} __packed; - -#endif diff --git a/drivers/staging/unisys/visorinput/visorinput.c b/drivers/staging/unisys/visorinput/visorinput.c index 9973040..634b16b 100644 --- a/drivers/staging/unisys/visorinput/visorinput.c +++ b/drivers/staging/unisys/visorinput/visorinput.c @@ -18,7 +18,36 @@ #include #include -#include "ultrainputreport.h" +/* These defines identify mouse and keyboard activity which is specified by the + * firmware to the host using the cmsimpleinput protocol. @ingroup coretypes + */ +/* only motion; arg1=x, arg2=y */ +#define INPUTACTION_XY_MOTION 1 + +/* arg1: 1=left,2=center,3=right */ +#define INPUTACTION_MOUSE_BUTTON_DOWN 2 +#define INPUTACTION_MOUSE_BUTTON_UP 3 +#define INPUTACTION_MOUSE_BUTTON_CLICK 4 +#define INPUTACTION_MOUSE_BUTTON_DCLICK 5 + +/* arg1: wheel rotation away from/toward user */ +#define INPUTACTION_WHEEL_ROTATE_AWAY 6 +#define INPUTACTION_WHEEL_ROTATE_TOWARD 7 + +/* arg1: scancode, as follows: If arg1 <= 0xff, it's a 1-byte scancode and arg1 + * is that scancode. If arg1 > 0xff, it's a 2-byte scanecode, with the 1st + * byte in the low 8 bits, and the 2nd byte in the high 8 bits. + * E.g., the right ALT key would appear as x'38e0'. + */ +#define INPUTACTION_KEY_DOWN 64 +#define INPUTACTION_KEY_UP 65 +#define INPUTACTION_KEY_DOWN_UP 67 + +/* arg1: scancode (in same format as inputaction_keyDown); MUST refer to one of + * the locking keys, like capslock, numlock, or scrolllock. + * arg2: 1 iff locking key should be in the LOCKED position (e.g., light is ON) + */ +#define INPUTACTION_SET_LOCKING_KEY_STATE 66 /* Keyboard channel {c73416d0-b0b8-44af-b304-9d2ae99f1b3d} */ #define VISOR_KEYBOARD_CHANNEL_GUID \ @@ -36,6 +65,18 @@ #define PIXELS_DOWN_DEFAULT 768 #define KEYCODE_TABLE_BYTES 256 +struct visor_inputactivity { + u16 action; + u16 arg1; + u16 arg2; + u16 arg3; +} __packed; + +struct visor_inputreport { + u64 seq_no; + struct visor_inputactivity activity; +} __packed; + /* header of keyboard/mouse channels */ struct visor_input_channel_data { u32 n_input_reports; -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] drivers: visorbus: move driver out of staging
Move the visorbus driver out of staging (drivers/staging/unisys/visorbus) and to drivers/visorbus. Modify the configuration and makefiles so they now reference the new location. The s-Par header file visorbus.h that is referenced by all s-Par drivers, is being moved into include/linux. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- The files are based off the latest revision in the staging-next tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git Changes from v1: -- Simplified to one single patch -- Combined include files into a single file -- Fixed the dependency flags that were in the wrong location. MAINTAINERS | 2 ++ drivers/Kconfig | 2 ++ drivers/Makefile | 1 + drivers/staging/unisys/Kconfig | 1 - drivers/staging/unisys/Makefile | 1 - drivers/staging/unisys/include/iochannel.h | 3 +-- drivers/staging/unisys/visorhba/visorhba_main.c | 2 +- drivers/staging/unisys/visorinput/visorinput.c | 2 +- drivers/staging/unisys/visornic/visornic_main.c | 2 +- drivers/{staging/unisys => }/visorbus/Kconfig| 1 - drivers/{staging/unisys => }/visorbus/Makefile | 2 -- drivers/{staging/unisys => }/visorbus/controlvmchannel.h | 3 +-- drivers/{staging/unisys => }/visorbus/vbuschannel.h | 2 +- drivers/{staging/unisys => }/visorbus/visorbus_main.c| 2 +- drivers/{staging/unisys => }/visorbus/visorbus_private.h | 2 +- drivers/{staging/unisys => }/visorbus/visorchannel.c | 2 +- drivers/{staging/unisys => }/visorbus/visorchipset.c | 2 +- {drivers/staging/unisys/include => include/linux}/visorbus.h | 0 18 files changed, 15 insertions(+), 17 deletions(-) rename drivers/{staging/unisys => }/visorbus/Kconfig (95%) rename drivers/{staging/unisys => }/visorbus/Makefile (81%) rename drivers/{staging/unisys => }/visorbus/controlvmchannel.h (99%) rename drivers/{staging/unisys => }/visorbus/vbuschannel.h (99%) rename drivers/{staging/unisys => }/visorbus/visorbus_main.c (99%) rename drivers/{staging/unisys => }/visorbus/visorbus_private.h (98%) rename drivers/{staging/unisys => }/visorbus/visorchannel.c (99%) rename drivers/{staging/unisys => }/visorbus/visorchipset.c (99%) rename {drivers/staging/unisys/include => include/linux}/visorbus.h (100%) diff --git a/MAINTAINERS b/MAINTAINERS index 6308fa7..36f76be 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14006,6 +14006,8 @@ UNISYS S-PAR DRIVERS M: David Kershner L: sparmaintai...@unisys.com (Unisys internal) S: Supported +F: include/linux/visorbus.h +F: drivers/visorbus/ F: drivers/staging/unisys/ UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER diff --git a/drivers/Kconfig b/drivers/Kconfig index 152744c..ef5fb83 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -211,4 +211,6 @@ source "drivers/mux/Kconfig" source "drivers/opp/Kconfig" +source "drivers/visorbus/Kconfig" + endmenu diff --git a/drivers/Makefile b/drivers/Makefile index e06f7f6..7a23300 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -184,3 +184,4 @@ obj-$(CONFIG_FPGA) += fpga/ obj-$(CONFIG_FSI) += fsi/ obj-$(CONFIG_TEE) += tee/ obj-$(CONFIG_MULTIPLEXER) += mux/ +obj-$(CONFIG_UNISYS_VISORBUS) += visorbus/ diff --git a/drivers/staging/unisys/Kconfig b/drivers/staging/unisys/Kconfig index 4d19038..c27dab3 100644 --- a/drivers/staging/unisys/Kconfig +++ b/drivers/staging/unisys/Kconfig @@ -8,7 +8,6 @@ menuconfig UNISYSSPAR if UNISYSSPAR -source "drivers/staging/unisys/visorbus/Kconfig" source "drivers/staging/unisys/visornic/Kconfig" source "drivers/staging/unisys/visorinput/Kconfig" source "drivers/staging/unisys/visorhba/Kconfig" diff --git a/drivers/staging/unisys/Makefile b/drivers/staging/unisys/Makefile index 20eb098..e45f44b 100644 --- a/drivers/staging/unisys/Makefile +++ b/drivers/staging/unisys/Makefile @@ -1,7 +1,6 @@ # # Makefile for Unisys SPAR drivers # -obj-$(CONFIG_UNISYS_VISORBUS) += visorbus/ obj-$(CONFIG_UNISYS_VISORNIC) += visornic/ obj-$(CONFIG_UNISYS_VISORINPUT)+= visorinput/ obj-$(CONFIG_UNISYS_VISORHBA) += visorhba/ diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h index 9023cf5..45c785d 100644 --- a/drivers/staging/unisys/include/iochannel.h +++ b/drivers/staging/unisys/include/iochannel.h @@ -33,8 +33,7 @@ #include #include - -#include "visorbus.h" +#include /* * Must increment these whenever you insert or delete fields within this
[PATCH 3/4] staging: unisys: combine visorchannel.h and visorbus.h
Combine the include files visorchannel.h and visorbus.h so that only one include file is needed for the .c files. Reported-by: Christoph Hellwig Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/include/iochannel.h | 2 +- drivers/staging/unisys/include/visorbus.h | 166 ++- drivers/staging/unisys/include/visorchannel.h | 179 - drivers/staging/unisys/visorbus/controlvmchannel.h | 2 +- drivers/staging/unisys/visorbus/vbuschannel.h | 2 +- 5 files changed, 168 insertions(+), 183 deletions(-) delete mode 100644 drivers/staging/unisys/include/visorchannel.h diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h index a3c8754..9023cf5 100644 --- a/drivers/staging/unisys/include/iochannel.h +++ b/drivers/staging/unisys/include/iochannel.h @@ -34,7 +34,7 @@ #include #include -#include "visorchannel.h" +#include "visorbus.h" /* * Must increment these whenever you insert or delete fields within this channel diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h index fb4d3f8..0d8bd67 100644 --- a/drivers/staging/unisys/include/visorbus.h +++ b/drivers/staging/unisys/include/visorbus.h @@ -19,8 +19,172 @@ #include -#include "visorchannel.h" +#define VISOR_CHANNEL_SIGNATURE ('L' << 24 | 'N' << 16 | 'C' << 8 | 'E') +/* + * enum channel_serverstate + * @CHANNELSRV_UNINITIALIZED: Channel is in an undefined state. + * @CHANNELSRV_READY:Channel has been initialized by server. + */ +enum channel_serverstate { + CHANNELSRV_UNINITIALIZED = 0, + CHANNELSRV_READY = 1 +}; + +/* + * enum channel_clientstate + * @CHANNELCLI_DETACHED: + * @CHANNELCLI_DISABLED: Client can see channel but is NOT allowed to use it + * unless given TBD* explicit request + * (should actually be < DETACHED). + * @CHANNELCLI_ATTACHING: Legacy EFI client request for EFI server to attach. + * @CHANNELCLI_ATTACHED: Idle, but client may want to use channel any time. + * @CHANNELCLI_BUSY: Client either wants to use or is using channel. + * @CHANNELCLI_OWNED:"No worries" state - client can access channel + * anytime. + */ +enum channel_clientstate { + CHANNELCLI_DETACHED = 0, + CHANNELCLI_DISABLED = 1, + CHANNELCLI_ATTACHING = 2, + CHANNELCLI_ATTACHED = 3, + CHANNELCLI_BUSY = 4, + CHANNELCLI_OWNED = 5 +}; + +/* + * Values for VISOR_CHANNEL_PROTOCOL.Features: This define exists so that + * a guest can look at the FeatureFlags in the io channel, and configure the + * driver to use interrupts or not based on this setting. All feature bits for + * all channels should be defined here. The io channel feature bits are defined + * below. + */ +#define VISOR_DRIVER_ENABLES_INTS (0x1ULL << 1) +#define VISOR_CHANNEL_IS_POLLING (0x1ULL << 3) +#define VISOR_IOVM_OK_DRIVER_DISABLING_INTS (0x1ULL << 4) +#define VISOR_DRIVER_DISABLES_INTS (0x1ULL << 5) +#define VISOR_DRIVER_ENHANCED_RCVBUF_CHECKING (0x1ULL << 6) + +/* + * struct channel_header - Common Channel Header + * @signature:Signature. + * @legacy_state: DEPRECATED - being replaced by. + * @header_size: sizeof(struct channel_header). + * @size: Total size of this channel in bytes. + * @features: Flags to modify behavior. + * @chtype: Channel type: data, bus, control, etc.. + * @partition_handle: ID of guest partition. + * @handle: Device number of this channel in client. + * @ch_space_offset: Offset in bytes to channel specific area. + * @version_id: Struct channel_header Version ID. + * @partition_index: Index of guest partition. + * @zone_uuid:Guid of Channel's zone. + * @cli_str_offset:Offset from channel header to null-terminated + *ClientString (0 if ClientString not present). + * @cli_state_boot:CHANNEL_CLIENTSTATE of pre-boot EFI client of this + *channel. + * @cmd_state_cli: CHANNEL_COMMANDSTATE (overloaded in Windows drivers, see + *ServerStateUp, ServerStateDown, etc). + * @cli_state_os: CHANNEL_CLIENTSTATE of Guest OS client of this channel. + * @ch_characteristic: CHANNEL_CHARACTERISTIC_. + * @cmd_state_srv: CHANNEL_COMMANDSTATE (overloaded in Windows drivers, see + *ServerStateUp, ServerStateDown, etc). + * @srv_state:CHANNEL_SERVERSTATE. + * @cli_error_boot:Bits to indicate err states for boot clients, so err + *messages can be throttled. + * @cli_error_os: Bits to indicate err states for OS clients, so err + *messages can be throttled. + * @filler: Pad out to 128 byte
[PATCH 2/4] staging: unisys: remove !UML flag
Remove the dependency that the drivers are not built during UML. Reported-by: Greg Kroah-Hartman Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/unisys/Kconfig b/drivers/staging/unisys/Kconfig index ca1bd9a..f3c92a5 100644 --- a/drivers/staging/unisys/Kconfig +++ b/drivers/staging/unisys/Kconfig @@ -3,7 +3,7 @@ # menuconfig UNISYSSPAR bool "Unisys SPAR driver support" - depends on X86_64 && !UML + depends on X86_64 depends on ACPI ---help--- Support for the Unisys SPAR drivers -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/4] staging: unisys: fix dependencies with UNISYSSPAR Kconfig flag
The Kconfig file for UNISYSSPAR uses select ACPI and select PCI instead of depends on ACPI. This patch fixes the problem. Reported-by: Greg Kroah-Hartman Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/unisys/Kconfig b/drivers/staging/unisys/Kconfig index 4f1f5e6..ca1bd9a 100644 --- a/drivers/staging/unisys/Kconfig +++ b/drivers/staging/unisys/Kconfig @@ -4,8 +4,7 @@ menuconfig UNISYSSPAR bool "Unisys SPAR driver support" depends on X86_64 && !UML - select PCI - select ACPI + depends on ACPI ---help--- Support for the Unisys SPAR drivers -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/4] staging: unisys: fix dependency and include issues
This patch series combines the global include files into a single include and cleans up dependencies that were in the wrong location. We had code dependencies on the UNISYSSPAR Kconfig flag instead of the VISORBUS config flag. UNISYSSPAR is just there for organizational purposes. David Kershner (4): staging: unisys: fix dependencies with UNISYSSPAR Kconfig flag staging: unisys: remove !UML flag staging: unisys: combine visorchannel.h and visorbus.h staging: unisys: move dependencies from UNISYSSPAR to VISORBUS drivers/staging/unisys/Kconfig | 3 - drivers/staging/unisys/include/iochannel.h | 2 +- drivers/staging/unisys/include/visorbus.h | 166 ++- drivers/staging/unisys/include/visorchannel.h | 179 - drivers/staging/unisys/visorbus/Kconfig| 1 + drivers/staging/unisys/visorbus/controlvmchannel.h | 2 +- drivers/staging/unisys/visorbus/vbuschannel.h | 2 +- 7 files changed, 169 insertions(+), 186 deletions(-) delete mode 100644 drivers/staging/unisys/include/visorchannel.h -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/4] staging: unisys: move dependencies from UNISYSSPAR to VISORBUS
The Kconfig flag UNISYSSPAR depended on ACPI and X86, these dependencies really belong to visorbus, so move them there. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/Kconfig | 2 -- drivers/staging/unisys/visorbus/Kconfig | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/unisys/Kconfig b/drivers/staging/unisys/Kconfig index f3c92a5..4d19038 100644 --- a/drivers/staging/unisys/Kconfig +++ b/drivers/staging/unisys/Kconfig @@ -3,8 +3,6 @@ # menuconfig UNISYSSPAR bool "Unisys SPAR driver support" - depends on X86_64 - depends on ACPI ---help--- Support for the Unisys SPAR drivers diff --git a/drivers/staging/unisys/visorbus/Kconfig b/drivers/staging/unisys/visorbus/Kconfig index 5113880..3866804 100644 --- a/drivers/staging/unisys/visorbus/Kconfig +++ b/drivers/staging/unisys/visorbus/Kconfig @@ -5,6 +5,7 @@ config UNISYS_VISORBUS tristate "Unisys visorbus driver" depends on UNISYSSPAR + depends on X86_64 && ACPI ---help--- The visorbus driver is a virtualized bus for the Unisys s-Par firmware. Virtualized devices allow Linux guests on a system to share disks and -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2] drivers: visorbus: move driver out of staging
The s-Par header files that are referenced by all s-Par drivers, are being moved into include/linux/visorbus. Move the visorbus driver out of staging and modify the configuration and makefiles so they now reference the new file, this required moving some lines from drivers/staging/unisys/Kconfig over to drives/visorbus/Kconfig to make sure dependencies were met. Visorbus will now just live in the /drivers directory. Signed-off-by: David Kershner Reviewed-by: David Binder Reviewed-by: Tim Sell --- MAINTAINERS | 2 ++ drivers/Kconfig | 2 ++ drivers/Makefile | 1 + drivers/staging/unisys/Kconfig| 1 - drivers/staging/unisys/Makefile | 1 - drivers/staging/unisys/include/iochannel.h| 3 +-- drivers/staging/unisys/visorhba/visorhba_main.c | 2 +- drivers/staging/unisys/visorinput/visorinput.c| 2 +- drivers/staging/unisys/visornic/visornic_main.c | 2 +- drivers/{staging/unisys => }/visorbus/Kconfig | 4 +++- drivers/{staging/unisys => }/visorbus/Makefile| 2 -- drivers/{staging/unisys => }/visorbus/controlvmchannel.h | 3 +-- drivers/{staging/unisys => }/visorbus/vbuschannel.h | 2 +- drivers/{staging/unisys => }/visorbus/visorbus_main.c | 2 +- drivers/{staging/unisys => }/visorbus/visorbus_private.h | 2 +- drivers/{staging/unisys => }/visorbus/visorchannel.c | 2 +- drivers/{staging/unisys => }/visorbus/visorchipset.c | 2 +- {drivers/staging/unisys/include => include/linux/visorbus}/visorbus.h | 0 .../staging/unisys/include => include/linux/visorbus}/visorchannel.h | 0 19 files changed, 18 insertions(+), 17 deletions(-) rename drivers/{staging/unisys => }/visorbus/Kconfig (90%) rename drivers/{staging/unisys => }/visorbus/Makefile (81%) rename drivers/{staging/unisys => }/visorbus/controlvmchannel.h (99%) rename drivers/{staging/unisys => }/visorbus/vbuschannel.h (98%) rename drivers/{staging/unisys => }/visorbus/visorbus_main.c (99%) rename drivers/{staging/unisys => }/visorbus/visorbus_private.h (98%) rename drivers/{staging/unisys => }/visorbus/visorchannel.c (99%) rename drivers/{staging/unisys => }/visorbus/visorchipset.c (99%) rename {drivers/staging/unisys/include => include/linux/visorbus}/visorbus.h (100%) rename {drivers/staging/unisys/include => include/linux/visorbus}/visorchannel.h (100%) diff --git a/MAINTAINERS b/MAINTAINERS index 650aa0e..a1df0e9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13835,6 +13835,8 @@ UNISYS S-PAR DRIVERS M: David Kershner L: sparmaintai...@unisys.com (Unisys internal) S: Supported +F: include/linux/visorbus/ +F: drivers/visorbus/ F: drivers/staging/unisys/ UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER diff --git a/drivers/Kconfig b/drivers/Kconfig index 152744c..ef5fb83 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -211,4 +211,6 @@ source "drivers/mux/Kconfig" source "drivers/opp/Kconfig" +source "drivers/visorbus/Kconfig" + endmenu diff --git a/drivers/Makefile b/drivers/Makefile index 1d034b6..d5061ed 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -183,3 +183,4 @@ obj-$(CONFIG_FPGA) += fpga/ obj-$(CONFIG_FSI) += fsi/ obj-$(CONFIG_TEE) += tee/ obj-$(CONFIG_MULTIPLEXER) += mux/ +obj-$(CONFIG_UNISYS_VISORBUS) += visorbus/ diff --git a/drivers/staging/unisys/Kconfig b/drivers/staging/unisys/Kconfig index 4f1f5e6..688b5e3 100644 --- a/drivers/staging/unisys/Kconfig +++ b/drivers/staging/unisys/Kconfig @@ -11,7 +11,6 @@ menuconfig UNISYSSPAR if UNISYSSPAR -source "drivers/staging/unisys/visorbus/Kconfig" source "drivers/staging/unisys/visornic/Kconfig" source "drivers/staging/unisys/visorinput/Kconfig" source "drivers/staging/unisys/visorhba/Kconfig" diff --git a/drivers/staging/unisys/Makefile b/drivers/staging/unisys/Makefile index 20eb098..e45f44b 100644 --- a/drivers/staging/unisys/Makefile +++ b/drivers/staging/unisys/Makefile @@ -1,7 +1,6 @@ # # Makefile for Unisys SPAR drivers # -obj-$(CONFIG_UNISYS_VISORBUS) += visorbus/ obj-$(CONFIG_UNISYS_VISORNIC) += visornic/ obj-$(CONFIG_UNISYS_VISORINPUT)+= visorinput/ obj-$(CONFIG_UNISYS_VISORHBA) += visorhba/ diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h index 5cd407c..6e401a7 100644 --- a/drivers/staging/unisys/include/iochannel.h +++ b/drivers/staging/unisys/include/iochannel.h @@ -4
[PATCH 0/2] drivers: Move visorbus from staging to drivers/visorbus
This patch series fixes an issue that was reported by Dan Carpenter, moves the necessary include files to include/linux/visorbus and then moves the visorbus driver from drivers/staging/unisys to drivers/visorbus. Greg, thanks for the review of visorbus and for the assistance to get the driver to this state. David Kershner (1): drivers: visorbus: move driver out of staging Tim Sell (1): staging: unisys: visorbus: address theoretical int overflows MAINTAINERS | 2 ++ drivers/Kconfig | 2 ++ drivers/Makefile | 1 + drivers/staging/unisys/Kconfig | 1 - drivers/staging/unisys/Makefile | 1 - drivers/staging/unisys/include/iochannel.h | 3 +-- drivers/staging/unisys/visorhba/visorhba_main.c | 2 +- drivers/staging/unisys/visorinput/visorinput.c | 2 +- drivers/staging/unisys/visornic/visornic_main.c | 2 +- drivers/{staging/unisys => }/visorbus/Kconfig| 4 +++- drivers/{staging/unisys => }/visorbus/Makefile | 2 -- drivers/{staging/unisys => }/visorbus/controlvmchannel.h | 3 +-- drivers/{staging/unisys => }/visorbus/vbuschannel.h | 2 +- drivers/{staging/unisys => }/visorbus/visorbus_main.c| 2 +- drivers/{staging/unisys => }/visorbus/visorbus_private.h | 2 +- drivers/{staging/unisys => }/visorbus/visorchannel.c | 2 +- drivers/{staging/unisys => }/visorbus/visorchipset.c | 9 + .../staging/unisys/include => include/linux/visorbus}/visorbus.h | 0 .../unisys/include => include/linux/visorbus}/visorchannel.h | 0 19 files changed, 22 insertions(+), 20 deletions(-) rename drivers/{staging/unisys => }/visorbus/Kconfig (90%) rename drivers/{staging/unisys => }/visorbus/Makefile (81%) rename drivers/{staging/unisys => }/visorbus/controlvmchannel.h (99%) rename drivers/{staging/unisys => }/visorbus/vbuschannel.h (98%) rename drivers/{staging/unisys => }/visorbus/visorbus_main.c (99%) rename drivers/{staging/unisys => }/visorbus/visorbus_private.h (98%) rename drivers/{staging/unisys => }/visorbus/visorchannel.c (99%) rename drivers/{staging/unisys => }/visorbus/visorchipset.c (99%) rename {drivers/staging/unisys/include => include/linux/visorbus}/visorbus.h (100%) rename {drivers/staging/unisys/include => include/linux/visorbus}/visorchannel.h (100%) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/2] staging: unisys: visorbus: address theoretical int overflows
From: Tim Sell Add necessary casting to several places where we were doing 32-bit arithmetic (unsigned) to produce a 64-bit (unsigned long) result, to prevent the theoretical possibility of a 32-bit overflow during the arithmetic. FYI, these are unsigned long: ctx->param_bytes ctx->allocbytes These are unsigned int: bytes phdr->name_offset phdr->name_length Here is the test program demonstrating why we really need the casts: void main() { unsigned int i; unsigned long il; printf("sizeof(int) =%dn",sizeof(i)); printf("sizeof(long)=%dn",sizeof(il)); i = (unsigned int)unsigned long)(1)) << 32) - 1); printf("i = %un", i); il = i+1; printf("adding 1 withOUT cast = %lun", il); il = (unsigned long)i+1; printf("adding 1 WITHcast = %lun", il); } [selltc@mac tmp]$ gcc x.c -o x.out [selltc@mac tmp]$ ./x.out sizeof(int) =4 sizeof(long)=8 i = 4294967295 adding 1 withOUT cast = 0 adding 1 WITHcast = 4294967296 Signed-off-by: Tim Sell Reported-by: Dan Carpenter Signed-off-by: David Kershner Reviewed-by: David Binder --- drivers/staging/unisys/visorbus/visorchipset.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index fed554a4..ef2823a 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -590,7 +590,8 @@ static void *parser_name_get(struct parser_context *ctx) struct visor_controlvm_parameters_header *phdr; phdr = &ctx->data; - if (phdr->name_offset + phdr->name_length > ctx->param_bytes) + if ((unsigned long)phdr->name_offset + + (unsigned long)phdr->name_length > ctx->param_bytes) return NULL; ctx->curr = (char *)&phdr + phdr->name_offset; ctx->bytes_remaining = phdr->name_length; @@ -1317,13 +1318,13 @@ static void parser_done(struct parser_context *ctx) static struct parser_context *parser_init_stream(u64 addr, u32 bytes, bool *retry) { - int allocbytes; + unsigned long allocbytes; struct parser_context *ctx; void *mapping; *retry = false; /* alloc an extra byte to ensure payload is \0 terminated */ - allocbytes = bytes + 1 + (sizeof(struct parser_context) - + allocbytes = (unsigned long)bytes + 1 + (sizeof(struct parser_context) - sizeof(struct visor_controlvm_parameters_header)); if ((chipset_dev->controlvm_payload_bytes_buffered + bytes) > MAX_CONTROLVM_PAYLOAD_BYTES) { -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 43/45] staging: unisys: visorbus: Fix extraneous parenthesis
Clean up unneeded () that are being reported by checkpatch. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 4 ++-- drivers/staging/unisys/visorbus/visorchipset.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index cc6a9d8..2f1e8d3 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -185,8 +185,8 @@ static int match_visorbus_dev_by_id(struct device *dev, void *data) struct visor_device *vdev = to_visor_device(dev); struct visor_busdev *id = data; - if ((vdev->chipset_bus_no == id->bus_no) && - (vdev->chipset_dev_no == id->dev_no)) + if (vdev->chipset_bus_no == id->bus_no && + vdev->chipset_dev_no == id->dev_no) return 1; return 0; } diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 6165602..d9045a4 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -463,7 +463,7 @@ static int visorbus_create(struct controlvm_message *inmsg) int err; bus_info = visorbus_get_device_by_id(bus_no, BUS_ROOT_DEVICE, NULL); - if (bus_info && (bus_info->state.created == 1)) { + if (bus_info && bus_info->state.created == 1) { dev_err(&chipset_dev->acpi_device->dev, "failed %s: already exists\n", __func__); err = -EEXIST; @@ -666,7 +666,7 @@ static int visorbus_device_create(struct controlvm_message *inmsg) goto err_respond; } dev_info = visorbus_get_device_by_id(bus_no, dev_no, NULL); - if (dev_info && (dev_info->state.created == 1)) { + if (dev_info && dev_info->state.created == 1) { dev_err(&chipset_dev->acpi_device->dev, "failed to get bus by id: %d/%d\n", bus_no, dev_no); err = -EEXIST; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 45/45] staging: unisys: visornic: clean up parenthesis
Clean up unneeded parenthesis reported by checkpatch.pl. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visornic/visornic_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index f31..735d7e5 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -901,7 +901,7 @@ static int visornic_xmit(struct sk_buff *skb, struct net_device *netdev) return NETDEV_TX_OK; } - if ((len < ETH_MIN_PACKET_SIZE) && + if (len < ETH_MIN_PACKET_SIZE && ((skb_end_pointer(skb) - skb->data) >= ETH_MIN_PACKET_SIZE)) { /* pad the packet out to minimum size */ padlen = ETH_MIN_PACKET_SIZE - len; @@ -1452,7 +1452,7 @@ static ssize_t info_debugfs_read(struct file *file, char __user *buf, rcu_read_lock(); for_each_netdev_rcu(current->nsproxy->net_ns, dev) { /* Only consider netdevs that are visornic, and are open */ - if ((dev->netdev_ops != &visornic_dev_ops) || + if (dev->netdev_ops != &visornic_dev_ops || (!netif_queue_stopped(dev))) continue; @@ -1682,7 +1682,7 @@ static void service_resp_queue(struct uiscmdrsp *cmdrsp, /* only call queue wake if we stopped it */ netdev = ((struct sk_buff *)cmdrsp->net.buf)->dev; /* ASSERT netdev == vnicinfo->netdev; */ - if ((netdev == devdata->netdev) && + if (netdev == devdata->netdev && netif_queue_stopped(netdev)) { /* check if we have crossed the lower watermark * for netif_wake_queue() -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 38/45] staging: unisys: check the whole channel instead of just guid for match
From: Sameer Wadgaonkar Validate that the channel contents match the channel type that we are matching. Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 11 ++- drivers/staging/unisys/visorhba/visorhba_main.c | 3 ++- drivers/staging/unisys/visorinput/visorinput.c | 5 +++-- drivers/staging/unisys/visornic/visornic_main.c | 3 ++- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 7df06f1..cc6a9d8 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -143,14 +143,23 @@ static int visorbus_match(struct device *xdev, struct device_driver *xdrv) int i; struct visor_device *dev; struct visor_driver *drv; + struct visorchannel *chan; dev = to_visor_device(xdev); channel_type = visorchannel_get_guid(dev->visorchannel); drv = to_visor_driver(xdrv); + chan = dev->visorchannel; if (!drv->channel_types) return 0; for (i = 0; !guid_is_null(&drv->channel_types[i].guid); i++) - if (guid_equal(&drv->channel_types[i].guid, channel_type)) + if (guid_equal(&drv->channel_types[i].guid, channel_type) && + visor_check_channel(visorchannel_get_header(chan), + xdev, + &drv->channel_types[i].guid, + (char *)drv->channel_types[i].name, + drv->channel_types[i].min_bytes, + drv->channel_types[i].version, + VISOR_CHANNEL_SIGNATURE)) return i + 1; return 0; } diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c index b84b40e..91e6e35 100644 --- a/drivers/staging/unisys/visorhba/visorhba_main.c +++ b/drivers/staging/unisys/visorhba/visorhba_main.c @@ -40,7 +40,8 @@ /* Note that the only channel type we expect to be reported by the * bus driver is the VISOR_VHBA channel. */ - { VISOR_VHBA_CHANNEL_GUID, "sparvhba" }, + { VISOR_VHBA_CHANNEL_GUID, "sparvhba", sizeof(struct channel_header), + VISOR_VHBA_CHANNEL_VERSIONID }, {} }; diff --git a/drivers/staging/unisys/visorinput/visorinput.c b/drivers/staging/unisys/visorinput/visorinput.c index 1b58663..450f003 100644 --- a/drivers/staging/unisys/visorinput/visorinput.c +++ b/drivers/staging/unisys/visorinput/visorinput.c @@ -712,8 +712,9 @@ static int visorinput_resume(struct visor_device *dev, /* GUIDS for all channel types supported by this driver. */ static struct visor_channeltype_descriptor visorinput_channel_types[] = { - { VISOR_KEYBOARD_CHANNEL_GUID, "keyboard"}, - { VISOR_MOUSE_CHANNEL_GUID, "mouse"}, + { VISOR_KEYBOARD_CHANNEL_GUID, "keyboard", + sizeof(struct channel_header), 0 }, + { VISOR_MOUSE_CHANNEL_GUID, "mouse", sizeof(struct channel_header), 0 }, {} }; diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index c5f0b01..f31 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -49,7 +49,8 @@ /* Note that the only channel type we expect to be reported by the * bus driver is the VISOR_VNIC channel. */ - { VISOR_VNIC_CHANNEL_GUID, "ultravnic" }, + { VISOR_VNIC_CHANNEL_GUID, "ultravnic", sizeof(struct channel_header), + VISOR_VNIC_CHANNEL_VERSIONID }, {} }; MODULE_DEVICE_TABLE(visorbus, visornic_channel_types); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 41/45] staging: unisys: include: fix comments and spacing issues in visorbus.h
From: Sameer Wadgaonkar This patch fixes some comments and spacings in the file visorbus.h to make it more uniform. Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/include/visorbus.h | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h index dc1546e..1a0986b 100644 --- a/drivers/staging/unisys/include/visorbus.h +++ b/drivers/staging/unisys/include/visorbus.h @@ -36,13 +36,12 @@ struct visorchipset_state { u32 attached:1; u32 configured:1; u32 running:1; - /* Add new fields above. */ - /* Remaining bits in this 32-bit word are unused. */ + /* Remaining bits in this 32-bit word are reserved. */ }; /** * struct visor_device - A device type for things "plugged" into the visorbus - * bus + * bus * @visorchannel: Points to the channel that the device is * associated with. * @channel_type_guid: Identifies the channel type to the bus driver. @@ -73,7 +72,6 @@ struct visorchipset_state { * same across all visor_devices in the current * guest. Private use by bus driver only. */ - struct visor_device { struct visorchannel *visorchannel; guid_t channel_type_guid; @@ -104,8 +102,8 @@ typedef void (*visorbus_state_complete_func) (struct visor_device *dev, int status); /* - * This struct describes a specific Supervisor channel, by providing its - * GUID, name, and sizes. + * This struct describes a specific visor channel, by providing its GUID, name, + * and sizes. */ struct visor_channeltype_descriptor { const guid_t guid; @@ -116,7 +114,7 @@ struct visor_channeltype_descriptor { /** * struct visor_driver - Information provided by each visor driver when it - * registers with the visorbus driver. + * registers with the visorbus driver * @name: Name of the visor driver. * @owner: The module owner. * @channel_types: Types of channels handled by this driver, ending with -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 42/45] staging: unisys: visorbus: fix comments in vbuschannel.h
From: Sameer Wadgaonkar This patch fixes some comments in the file vbuschannel.h to make it more uniform. Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/vbuschannel.h | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/unisys/visorbus/vbuschannel.h b/drivers/staging/unisys/visorbus/vbuschannel.h index 9623911..981b180 100644 --- a/drivers/staging/unisys/visorbus/vbuschannel.h +++ b/drivers/staging/unisys/visorbus/vbuschannel.h @@ -49,9 +49,9 @@ * @infostrs: Kernel vversion. * @reserved: Pad size to 256 bytes. * - * An array of this struct is present in the channel area for each vbus. - * (See vbuschannel.h.). It is filled in by the client side to provide info - * about the device and driver from the client's perspective. + * An array of this struct is present in the channel area for each vbus. It is + * filled in by the client side to provide info about the device and driver from + * the client's perspective. */ struct visor_vbus_deviceinfo { u8 devtype[16]; @@ -72,7 +72,7 @@ struct visor_vbus_deviceinfo { * BusInfo struct. * @dev_info_offset: Byte offset from beginning of this struct to the * DevInfo array. - * @reserved:Natural Alignment + * @reserved:Natural alignment. */ struct visor_vbus_headerinfo { u32 struct_bytes; @@ -96,7 +96,6 @@ struct visor_vbus_headerinfo { struct visor_vbus_channel { struct channel_header channel_header; struct visor_vbus_headerinfo hdr_info; - /* The remainder of this channel is filled in by the client */ struct visor_vbus_deviceinfo chp_info; struct visor_vbus_deviceinfo bus_info; struct visor_vbus_deviceinfo dev_info[0]; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 44/45] staging: unisys: visorhba: clean up parenthesis
Clean up unneeded parenthesis reported by checkpatch.pl. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorhba/visorhba_main.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c index 91e6e35..0bcd3ac 100644 --- a/drivers/staging/unisys/visorhba/visorhba_main.c +++ b/drivers/staging/unisys/visorhba/visorhba_main.c @@ -820,9 +820,9 @@ static void do_scsi_linuxstat(struct uiscmdrsp *cmdrsp, memcpy(scsicmd->sense_buffer, cmdrsp->scsi.sensebuf, MAX_SENSE_SIZE); /* Do not log errors for disk-not-present inquiries */ - if ((cmdrsp->scsi.cmnd[0] == INQUIRY) && + if (cmdrsp->scsi.cmnd[0] == INQUIRY && (host_byte(cmdrsp->scsi.linuxstat) == DID_NO_CONNECT) && - (cmdrsp->scsi.addlstat == ADDL_SEL_TIMEOUT)) + cmdrsp->scsi.addlstat == ADDL_SEL_TIMEOUT) return; /* Okay see what our error_count is here */ vdisk = scsidev->hostdata; @@ -870,8 +870,8 @@ static void do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct visordisk_info *vdisk; scsidev = scsicmd->device; - if ((cmdrsp->scsi.cmnd[0] == INQUIRY) && - (cmdrsp->scsi.bufflen >= MIN_INQUIRY_RESULT_LEN)) { + if (cmdrsp->scsi.cmnd[0] == INQUIRY && + cmdrsp->scsi.bufflen >= MIN_INQUIRY_RESULT_LEN) { if (cmdrsp->scsi.no_disk_result == 0) return; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 40/45] staging: unisys: visorbus: fix line over 80 characters checkpatch warning
From: Sameer Wadgaonkar This patch fixes two checkpatch issues of line over 80 characters in visorchipset.c. Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 027e10f..6165602 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -694,8 +694,10 @@ static int visorbus_device_create(struct controlvm_message *inmsg) goto err_free_dev_info; } dev_info->visorchannel = visorchannel; - guid_copy(&dev_info->channel_type_guid, &cmd->create_device.data_type_guid); - if (guid_equal(&cmd->create_device.data_type_guid, &visor_vhba_channel_guid)) { + guid_copy(&dev_info->channel_type_guid, + &cmd->create_device.data_type_guid); + if (guid_equal(&cmd->create_device.data_type_guid, + &visor_vhba_channel_guid)) { err = save_crash_message(inmsg, CRASH_DEV); if (err) goto err_destroy_visorchannel; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 34/45] staging: unisys: visorbus: clean up parameter formatting
Cleans up parameter formatting in visorbus. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 2 +- drivers/staging/unisys/visorbus/visorchipset.c | 17 - 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 3b11fb0..7df06f1 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -251,7 +251,7 @@ static ssize_t nbytes_show(struct device *dev, struct device_attribute *attr, struct visor_device *vdev = to_visor_device(dev); return sprintf(buf, "0x%lx\n", - visorchannel_get_nbytes(vdev->visorchannel)); + visorchannel_get_nbytes(vdev->visorchannel)); } static DEVICE_ATTR_RO(nbytes); diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index d808bbc..c876e54 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -436,10 +436,9 @@ static int controlvm_responder(enum controlvm_id cmd_id, return controlvm_respond(pending_msg_hdr, response, NULL); } -static int device_changestate_responder( - enum controlvm_id cmd_id, - struct visor_device *p, int response, - struct visor_segment_state response_state) +static int device_changestate_responder(enum controlvm_id cmd_id, + struct visor_device *p, int response, + struct visor_segment_state state) { struct controlvm_message outmsg; @@ -449,7 +448,7 @@ static int device_changestate_responder( controlvm_init_response(&outmsg, p->pending_msg_hdr, response); outmsg.cmd.device_change_state.bus_no = p->chipset_bus_no; outmsg.cmd.device_change_state.dev_no = p->chipset_dev_no; - outmsg.cmd.device_change_state.state = response_state; + outmsg.cmd.device_change_state.state = state; return visorchannel_signalinsert(chipset_dev->controlvm_channel, CONTROLVM_QUEUE_REQUEST, &outmsg); } @@ -1044,9 +1043,9 @@ static int parahotplug_request_kickoff(struct parahotplug_request *req) { struct controlvm_message_packet *cmd = &req->msg.cmd; char env_cmd[40], env_id[40], env_state[40], env_bus[40], env_dev[40], - env_func[40]; - char *envp[] = { - env_cmd, env_id, env_state, env_bus, env_dev, env_func, NULL +env_func[40]; + char *envp[] = { env_cmd, env_id, env_state, env_bus, env_dev, +env_func, NULL }; sprintf(env_cmd, "VISOR_PARAHOTPLUG=1"); @@ -1462,7 +1461,7 @@ static int handle_command(struct controlvm_message inmsg, u64 channel_addr) static int read_controlvm_event(struct controlvm_message *msg) { int err = visorchannel_signalremove(chipset_dev->controlvm_channel, - CONTROLVM_QUEUE_EVENT, msg); + CONTROLVM_QUEUE_EVENT, msg); if (err) return err; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 33/45] staging: unisys: visorbus: shrink name of POLLJIFFIES_CONTROLVMCHANNEL_XXX
Shrinks the name of POLLJIFFIES_CONTORLVMCHANNEL_FAST and POLLJIFFIES_CONTROLVMCHANNEL_SLOW to just POLLJIFFIES_CONTROLVM_. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 20 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index ac218f3..d808bbc 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -27,8 +27,8 @@ static const guid_t visor_siovm_guid = VISOR_SIOVM_GUID; static const guid_t visor_controlvm_channel_guid = VISOR_CONTROLVM_CHANNEL_GUID; -#define POLLJIFFIES_CONTROLVMCHANNEL_FAST 1 -#define POLLJIFFIES_CONTROLVMCHANNEL_SLOW 100 +#define POLLJIFFIES_CONTROLVM_FAST 1 +#define POLLJIFFIES_CONTROLVM_SLOW 100 #define MAX_CONTROLVM_PAYLOAD_BYTES (1024 * 128) @@ -1552,15 +1552,11 @@ static void controlvm_periodic_work(struct work_struct *work) * it's been longer than MIN_IDLE_SECONDS since we processed * our last controlvm message; slow down the polling */ - if (chipset_dev->poll_jiffies != - POLLJIFFIES_CONTROLVMCHANNEL_SLOW) - chipset_dev->poll_jiffies = - POLLJIFFIES_CONTROLVMCHANNEL_SLOW; + if (chipset_dev->poll_jiffies != POLLJIFFIES_CONTROLVM_SLOW) + chipset_dev->poll_jiffies = POLLJIFFIES_CONTROLVM_SLOW; } else { - if (chipset_dev->poll_jiffies != - POLLJIFFIES_CONTROLVMCHANNEL_FAST) - chipset_dev->poll_jiffies = - POLLJIFFIES_CONTROLVMCHANNEL_FAST; + if (chipset_dev->poll_jiffies != POLLJIFFIES_CONTROLVM_FAST) + chipset_dev->poll_jiffies = POLLJIFFIES_CONTROLVM_FAST; } schedule_delayed_work(&chipset_dev->periodic_controlvm_work, chipset_dev->poll_jiffies); @@ -1579,7 +1575,7 @@ static int visorchipset_init(struct acpi_device *acpi_device) goto error_free_chipset_dev; acpi_device->driver_data = chipset_dev; chipset_dev->acpi_device = acpi_device; - chipset_dev->poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST; + chipset_dev->poll_jiffies = POLLJIFFIES_CONTROLVM_FAST; err = sysfs_create_groups(&chipset_dev->acpi_device->dev.kobj, visorchipset_dev_groups); if (err < 0) @@ -1601,7 +1597,7 @@ static int visorchipset_init(struct acpi_device *acpi_device) INIT_DELAYED_WORK(&chipset_dev->periodic_controlvm_work, controlvm_periodic_work); chipset_dev->most_recent_message_jiffies = jiffies; - chipset_dev->poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST; + chipset_dev->poll_jiffies = POLLJIFFIES_CONTROLVM_FAST; schedule_delayed_work(&chipset_dev->periodic_controlvm_work, chipset_dev->poll_jiffies); err = visorbus_init(); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 32/45] staging: unisys: visorbus: visorchipset.c: Remove useless initializations
Found several more useless initializations in visorchipset.c get rid of them. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index ab5c5c2..ac218f3 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -457,7 +457,7 @@ static int device_changestate_responder( static int visorbus_create(struct controlvm_message *inmsg) { struct controlvm_message_packet *cmd = &inmsg->cmd; - struct controlvm_message_header *pmsg_hdr = NULL; + struct controlvm_message_header *pmsg_hdr; u32 bus_no = cmd->create_bus.bus_no; struct visor_device *bus_info; struct visorchannel *visorchannel; @@ -524,7 +524,7 @@ static int visorbus_create(struct controlvm_message *inmsg) static int visorbus_destroy(struct controlvm_message *inmsg) { - struct controlvm_message_header *pmsg_hdr = NULL; + struct controlvm_message_header *pmsg_hdr; u32 bus_no = inmsg->cmd.destroy_bus.bus_no; struct visor_device *bus_info; int err; @@ -587,7 +587,7 @@ static void *parser_string_get(u8 *pscan, int nscan) static void *parser_name_get(struct parser_context *ctx) { - struct visor_controlvm_parameters_header *phdr = NULL; + struct visor_controlvm_parameters_header *phdr; phdr = &ctx->data; if (phdr->name_offset + phdr->name_length > ctx->param_bytes) @@ -644,10 +644,10 @@ static int visorbus_configure(struct controlvm_message *inmsg, static int visorbus_device_create(struct controlvm_message *inmsg) { struct controlvm_message_packet *cmd = &inmsg->cmd; - struct controlvm_message_header *pmsg_hdr = NULL; + struct controlvm_message_header *pmsg_hdr; u32 bus_no = cmd->create_device.bus_no; u32 dev_no = cmd->create_device.dev_no; - struct visor_device *dev_info = NULL; + struct visor_device *dev_info; struct visor_device *bus_info; struct visorchannel *visorchannel; int err; @@ -732,7 +732,7 @@ static int visorbus_device_create(struct controlvm_message *inmsg) static int visorbus_device_changestate(struct controlvm_message *inmsg) { struct controlvm_message_packet *cmd = &inmsg->cmd; - struct controlvm_message_header *pmsg_hdr = NULL; + struct controlvm_message_header *pmsg_hdr; u32 bus_no = cmd->device_change_state.bus_no; u32 dev_no = cmd->device_change_state.dev_no; struct visor_segment_state state = cmd->device_change_state.state; @@ -790,7 +790,7 @@ static int visorbus_device_changestate(struct controlvm_message *inmsg) static int visorbus_device_destroy(struct controlvm_message *inmsg) { struct controlvm_message_packet *cmd = &inmsg->cmd; - struct controlvm_message_header *pmsg_hdr = NULL; + struct controlvm_message_header *pmsg_hdr; u32 bus_no = cmd->destroy_device.bus_no; u32 dev_no = cmd->destroy_device.dev_no; struct visor_device *dev_info; @@ -1380,7 +1380,7 @@ static int handle_command(struct controlvm_message inmsg, u64 channel_addr) * makes a difference in how we compute the virtual address. */ if (parm_bytes) { - bool retry = false; + bool retry; parser_ctx = parser_init_stream(parm_addr, parm_bytes, &retry); if (!parser_ctx && retry) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 37/45] staging: unisys: include: Remove unused enum
From: David Binder Removes unused enum that pertains to s-Par diagnostics capabilities. Signed-off-by: David Binder Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/include/visorbus.h | 20 1 file changed, 20 deletions(-) diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h index 8e75c8b..dc1546e 100644 --- a/drivers/staging/unisys/include/visorbus.h +++ b/drivers/staging/unisys/include/visorbus.h @@ -179,26 +179,6 @@ int visorbus_write_channel(struct visor_device *dev, int visorbus_enable_channel_interrupts(struct visor_device *dev); void visorbus_disable_channel_interrupts(struct visor_device *dev); -/* - * Levels of severity for diagnostic events, in order from lowest severity to - * highest (i.e. fatal errors are the most severe, and should always be logged, - * but info events rarely need to be logged except during debugging). The - * values DIAG_SEVERITY_ENUM_BEGIN and DIAG_SEVERITY_ENUM_END are not valid - * severity values. They exist merely to dilineate the list, so that future - * additions won't require changes to the driver (i.e. when checking for - * out-of-range severities in SetSeverity). The values DIAG_SEVERITY_OVERRIDE - * and DIAG_SEVERITY_SHUTOFF are not valid severity values for logging events - * but they are valid for controlling the amount of event data. Changes made - * to the enum, need to be reflected in s-Par. - */ -enum diag_severity { - DIAG_SEVERITY_VERBOSE = 0, - DIAG_SEVERITY_INFO = 1, - DIAG_SEVERITY_WARNING = 2, - DIAG_SEVERITY_ERR = 3, - DIAG_SEVERITY_PRINT = 4, -}; - int visorchannel_signalremove(struct visorchannel *channel, u32 queue, void *msg); int visorchannel_signalinsert(struct visorchannel *channel, u32 queue, -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 39/45] staging: unisys: visorbus: simplify visorchannel_create_guts
From: Sameer Wadgaonkar Removing the two wrapper functions dealing with visorchannel_create() and instead just always use a new version of visorchannel_create() with an additional parameter. Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_private.h | 4 +--- drivers/staging/unisys/visorbus/visorchannel.c | 23 +- drivers/staging/unisys/visorbus/visorchipset.c | 15 +++--- 3 files changed, 14 insertions(+), 28 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h index 841437f..4a8b12d 100644 --- a/drivers/staging/unisys/visorbus/visorbus_private.h +++ b/drivers/staging/unisys/visorbus/visorbus_private.h @@ -39,9 +39,7 @@ void visorbus_device_changestate_response(struct visor_device *p, int response, /* visorchannel access functions */ struct visorchannel *visorchannel_create(u64 physaddr, gfp_t gfp, -const guid_t *guid); -struct visorchannel *visorchannel_create_with_lock(u64 physaddr, gfp_t gfp, - const guid_t *guid); +const guid_t *guid, bool needs_lock); void visorchannel_destroy(struct visorchannel *channel); int visorchannel_read(struct visorchannel *channel, ulong offset, void *dest, ulong nbytes); diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c index 68cfd95..aae1607 100644 --- a/drivers/staging/unisys/visorbus/visorchannel.c +++ b/drivers/staging/unisys/visorbus/visorchannel.c @@ -342,9 +342,9 @@ static int signalinsert_inner(struct visorchannel *channel, u32 queue, } /* - * visorchannel_create_guts() - creates the struct visorchannel abstraction for - * a data area in memory, but does NOT modify this - * data area + * visorchannel_create() - creates the struct visorchannel abstraction for a + * data area in memory, but does NOT modify this data + * area * @physaddr: physical address of start of channel * @gfp: gfp_t to use when allocating memory for the data struct * @guid: GUID that identifies channel type; @@ -355,9 +355,8 @@ static int signalinsert_inner(struct visorchannel *channel, u32 queue, * Return: pointer to visorchannel that was created if successful, * otherwise NULL */ -static struct visorchannel *visorchannel_create_guts(u64 physaddr, gfp_t gfp, -const guid_t *guid, -bool needs_lock) +struct visorchannel *visorchannel_create(u64 physaddr, gfp_t gfp, +const guid_t *guid, bool needs_lock) { struct visorchannel *channel; int err; @@ -416,18 +415,6 @@ static struct visorchannel *visorchannel_create_guts(u64 physaddr, gfp_t gfp, return NULL; } -struct visorchannel *visorchannel_create(u64 physaddr, gfp_t gfp, -const guid_t *guid) -{ - return visorchannel_create_guts(physaddr, gfp, guid, false); -} - -struct visorchannel *visorchannel_create_with_lock(u64 physaddr, gfp_t gfp, - const guid_t *guid) -{ - return visorchannel_create_guts(physaddr, gfp, guid, true); -} - /** * visorchannel_signalinsert() - inserts a message into the designated * channel/queue diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index c876e54..027e10f 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -494,7 +494,8 @@ static int visorbus_create(struct controlvm_message *inmsg) } visorchannel = visorchannel_create(cmd->create_bus.channel_addr, GFP_KERNEL, - &cmd->create_bus.bus_data_type_guid); + &cmd->create_bus.bus_data_type_guid, + false); if (!visorchannel) { err = -ENOMEM; goto err_free_pending_msg; @@ -681,10 +682,10 @@ static int visorbus_device_create(struct controlvm_message *inmsg) dev_info->chipset_dev_no = dev_no; guid_copy(&dev_info->inst, &cmd->create_device.dev_inst_guid); dev_info->device.parent = &bus_info->device; - visorchannel = - visorchannel_create_with_lock(cmd->create_device.channel_addr, -GFP_KERNEL, -
[PATCH 36/45] staging: unisys: include: Remove unnecessary macro to generate signature
From: David Binder Removes unnecessary SIGNATURE_16 macro used to generate a simple 32-bit signature. Signed-off-by: David Binder Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/include/visorchannel.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/unisys/include/visorchannel.h b/drivers/staging/unisys/include/visorchannel.h index 1f4a7b1..3394574 100644 --- a/drivers/staging/unisys/include/visorchannel.h +++ b/drivers/staging/unisys/include/visorchannel.h @@ -20,9 +20,7 @@ #include #include -#define SIGNATURE_16(A, B) ((A) | ((B) << 8)) -#define VISOR_CHANNEL_SIGNATURE \ - (SIGNATURE_16('E', 'C') | (SIGNATURE_16('N', 'L') << 16)) +#define VISOR_CHANNEL_SIGNATURE ('L' << 24 | 'N' << 16 | 'C' << 8 | 'E') /* * enum channel_serverstate -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 35/45] staging: unisys: include: Rename channel.h to visorchannel.h
From: David Binder In order to avoid a potential conflict with other drivers that define a channel.h file, the s-Par channel.h file is renamed in accordance with the surrounding driver-set namespace. Signed-off-by: David Binder Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/include/iochannel.h | 2 +- drivers/staging/unisys/include/visorbus.h| 2 +- drivers/staging/unisys/include/{channel.h => visorchannel.h} | 6 +++--- drivers/staging/unisys/visorbus/controlvmchannel.h | 2 +- drivers/staging/unisys/visorbus/vbuschannel.h| 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) rename drivers/staging/unisys/include/{channel.h => visorchannel.h} (98%) diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h index 69dd9c3..5cd407c 100644 --- a/drivers/staging/unisys/include/iochannel.h +++ b/drivers/staging/unisys/include/iochannel.h @@ -44,7 +44,7 @@ #include #include -#include "channel.h" +#include "visorchannel.h" /* * Must increment these whenever you insert or delete fields within this channel diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h index 6d379e6..8e75c8b 100644 --- a/drivers/staging/unisys/include/visorbus.h +++ b/drivers/staging/unisys/include/visorbus.h @@ -29,7 +29,7 @@ #include -#include "channel.h" +#include "visorchannel.h" struct visorchipset_state { u32 created:1; diff --git a/drivers/staging/unisys/include/channel.h b/drivers/staging/unisys/include/visorchannel.h similarity index 98% rename from drivers/staging/unisys/include/channel.h rename to drivers/staging/unisys/include/visorchannel.h index 6cb8b4d..1f4a7b1 100644 --- a/drivers/staging/unisys/include/channel.h +++ b/drivers/staging/unisys/include/visorchannel.h @@ -14,8 +14,8 @@ * details. */ -#ifndef __CHANNEL_H__ -#define __CHANNEL_H__ +#ifndef __VISORCHANNEL_H__ +#define __VISORCHANNEL_H__ #include #include @@ -181,7 +181,7 @@ struct signal_queue_header { u8 filler[12]; } __packed; -/* CHANNEL Guids */ +/* VISORCHANNEL Guids */ /* {414815ed-c58c-11da-95a9-00e08161165f} */ #define VISOR_VHBA_CHANNEL_GUID \ GUID_INIT(0x414815ed, 0xc58c, 0x11da, \ diff --git a/drivers/staging/unisys/visorbus/controlvmchannel.h b/drivers/staging/unisys/visorbus/controlvmchannel.h index 4735ed8..9ee9886 100644 --- a/drivers/staging/unisys/visorbus/controlvmchannel.h +++ b/drivers/staging/unisys/visorbus/controlvmchannel.h @@ -18,7 +18,7 @@ #include -#include "channel.h" +#include "visorchannel.h" /* {2B3C2D10-7EF5-4ad8-B966-3448B7386B3D} */ #define VISOR_CONTROLVM_CHANNEL_GUID \ diff --git a/drivers/staging/unisys/visorbus/vbuschannel.h b/drivers/staging/unisys/visorbus/vbuschannel.h index 6eae58d..9623911 100644 --- a/drivers/staging/unisys/visorbus/vbuschannel.h +++ b/drivers/staging/unisys/visorbus/vbuschannel.h @@ -26,7 +26,7 @@ */ #include -#include "channel.h" +#include "visorchannel.h" /* {193b331b-c58f-11da-95a9-00e08161165f} */ #define VISOR_VBUS_CHANNEL_GUID \ -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 31/45] staging: unisys: remove visorbus_type extern
The variable visorbus_type could be contained to the visorbus_main.c file by moving the two functions that referenced it visorchipset.c. This allowed us to remove the incorrect extern from the include file visorbus.h. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/include/visorbus.h | 2 -- drivers/staging/unisys/visorbus/visorbus_main.c| 37 +- drivers/staging/unisys/visorbus/visorbus_private.h | 2 ++ drivers/staging/unisys/visorbus/visorchipset.c | 35 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h index 6f27e00..6d379e6 100644 --- a/drivers/staging/unisys/include/visorbus.h +++ b/drivers/staging/unisys/include/visorbus.h @@ -31,8 +31,6 @@ #include "channel.h" -extern struct bus_type visorbus_type; - struct visorchipset_state { u32 created:1; u32 attached:1; diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index c455784..3b11fb0 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -159,13 +159,48 @@ static int visorbus_match(struct device *xdev, struct device_driver *xdrv) * This describes the TYPE of bus. * (Don't confuse this with an INSTANCE of the bus.) */ -struct bus_type visorbus_type = { +static struct bus_type visorbus_type = { .name = "visorbus", .match = visorbus_match, .uevent = visorbus_uevent, .dev_groups = visorbus_dev_groups, }; +struct visor_busdev { + u32 bus_no; + u32 dev_no; +}; + +static int match_visorbus_dev_by_id(struct device *dev, void *data) +{ + struct visor_device *vdev = to_visor_device(dev); + struct visor_busdev *id = data; + + if ((vdev->chipset_bus_no == id->bus_no) && + (vdev->chipset_dev_no == id->dev_no)) + return 1; + return 0; +} + +struct visor_device *visorbus_get_device_by_id(u32 bus_no, u32 dev_no, + struct visor_device *from) +{ + struct device *dev; + struct device *dev_start = NULL; + struct visor_busdev id = { + .bus_no = bus_no, + .dev_no = dev_no + }; + + if (from) + dev_start = &from->device; + dev = bus_find_device(&visorbus_type, dev_start, (void *)&id, + match_visorbus_dev_by_id); + if (!dev) + return NULL; + return to_visor_device(dev); +} + /* * visorbus_release_busdevice() - called when device_unregister() is called for *the bus device instance, after all other tasks diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h index 91f788a..841437f 100644 --- a/drivers/staging/unisys/visorbus/visorbus_private.h +++ b/drivers/staging/unisys/visorbus/visorbus_private.h @@ -23,6 +23,8 @@ #include "vbuschannel.h" #include "visorbus.h" +struct visor_device *visorbus_get_device_by_id(u32 bus_no, u32 dev_no, + struct visor_device *from); int visorbus_create_instance(struct visor_device *dev); void visorbus_remove_instance(struct visor_device *bus_info); int create_visor_device(struct visor_device *dev_info); diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 80a0781..ab5c5c2 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -288,41 +288,6 @@ static ssize_t remaining_steps_store(struct device *dev, } static DEVICE_ATTR_RW(remaining_steps); -struct visor_busdev { - u32 bus_no; - u32 dev_no; -}; - -static int match_visorbus_dev_by_id(struct device *dev, void *data) -{ - struct visor_device *vdev = to_visor_device(dev); - struct visor_busdev *id = data; - - if ((vdev->chipset_bus_no == id->bus_no) && - (vdev->chipset_dev_no == id->dev_no)) - return 1; - return 0; -} - -struct visor_device *visorbus_get_device_by_id(u32 bus_no, u32 dev_no, - struct visor_device *from) -{ - struct device *dev; - struct device *dev_start = NULL; - struct visor_busdev id = { - .bus_no = bus_no, - .dev_no = dev_no - }; - - if (from) - dev_start = &from->device; - dev = bus_find_device(&visorbus_type, dev_start, (void *)&id, - match_visorbus_dev_by_id); - if (!dev) - return NULL; - return to_visor_device(dev); -} - static void control
[PATCH 27/45] staging: unisys: include: reorder to avoid forward declaration
The include file visorbus.h has a forward declaration of visor_device. A simple reorder of the file removed the need for the forward declaration. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/include/visorbus.h | 125 +++--- 1 file changed, 63 insertions(+), 62 deletions(-) diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h index 163..6f27e00 100644 --- a/drivers/staging/unisys/include/visorbus.h +++ b/drivers/staging/unisys/include/visorbus.h @@ -31,12 +31,8 @@ #include "channel.h" -struct visor_device; extern struct bus_type visorbus_type; -typedef void (*visorbus_state_complete_func) (struct visor_device *dev, - int status); - struct visorchipset_state { u32 created:1; u32 attached:1; @@ -46,64 +42,6 @@ struct visorchipset_state { /* Remaining bits in this 32-bit word are unused. */ }; -/* - * This struct describes a specific Supervisor channel, by providing its - * GUID, name, and sizes. - */ -struct visor_channeltype_descriptor { - const guid_t guid; - const char *name; -}; - -/** - * struct visor_driver - Information provided by each visor driver when it - * registers with the visorbus driver. - * @name: Name of the visor driver. - * @owner: The module owner. - * @channel_types: Types of channels handled by this driver, ending with - * a zero GUID. Our specialized BUS.match() method knows - * about this list, and uses it to determine whether this - * driver will in fact handle a new device that it has - * detected. - * @probe: Called when a new device comes online, by our probe() - * function specified by driver.probe() (triggered - * ultimately by some call to driver_register(), - * bus_add_driver(), or driver_attach()). - * @remove:Called when a new device is removed, by our remove() - * function specified by driver.remove() (triggered - * ultimately by some call to device_release_driver()). - * @channel_interrupt: Called periodically, whenever there is a possiblity - * that "something interesting" may have happened to the - * channel. - * @pause: Called to initiate a change of the device's state. If - * the return valu`e is < 0, there was an error and the - * state transition will NOT occur. If the return value - * is >= 0, then the state transition was INITIATED - * successfully, and complete_func() will be called (or - * was just called) with the final status when either the - * state transition fails or completes successfully. - * @resume:Behaves similar to pause. - * @driver:Private reference to the device driver. For use by bus - * driver only. - */ -struct visor_driver { - const char *name; - struct module *owner; - struct visor_channeltype_descriptor *channel_types; - int (*probe)(struct visor_device *dev); - void (*remove)(struct visor_device *dev); - void (*channel_interrupt)(struct visor_device *dev); - int (*pause)(struct visor_device *dev, -visorbus_state_complete_func complete_func); - int (*resume)(struct visor_device *dev, - visorbus_state_complete_func complete_func); - - /* These fields are for private use by the bus driver only. */ - struct device_driver driver; -}; - -#define to_visor_driver(x) (container_of(x, struct visor_driver, driver)) - /** * struct visor_device - A device type for things "plugged" into the visorbus * bus @@ -164,6 +102,69 @@ struct visor_device { #define to_visor_device(x) container_of(x, struct visor_device, device) +typedef void (*visorbus_state_complete_func) (struct visor_device *dev, + int status); + +/* + * This struct describes a specific Supervisor channel, by providing its + * GUID, name, and sizes. + */ +struct visor_channeltype_descriptor { + const guid_t guid; + const char *name; + u64 min_bytes; + u32 version; +}; + +/** + * struct visor_driver - Information provided by each visor driver when it + * registers with the visorbus driver. + * @name: Name of the visor driver. + * @owner: The module owner. + * @channel_types: Types of channels handled by this driver, ending with + * a zero GUID. Our specialized BUS.match() method knows + * about this list, and uses it to determine whether this + *
[PATCH 24/45] staging: unisys: only include a file where it is used.
The header file visorbus.h included several linux headers that were used by the source files that include it. Move the includes to the files that actually use them. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/include/visorbus.h | 2 -- drivers/staging/unisys/visorbus/visorbus_main.c | 2 ++ drivers/staging/unisys/visorbus/visorchannel.c | 1 + drivers/staging/unisys/visorhba/visorhba_main.c | 1 + drivers/staging/unisys/visorinput/visorinput.c | 1 + drivers/staging/unisys/visornic/visornic_main.c | 1 + 6 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h index ea01a21..163 100644 --- a/drivers/staging/unisys/include/visorbus.h +++ b/drivers/staging/unisys/include/visorbus.h @@ -28,8 +28,6 @@ #define __VISORBUS_H__ #include -#include -#include #include "channel.h" diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 46e6a4c..baae38f 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -14,6 +14,8 @@ */ #include +#include +#include #include #include "visorbus.h" diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c index 44eab70..68cfd95 100644 --- a/drivers/staging/unisys/visorbus/visorchannel.c +++ b/drivers/staging/unisys/visorbus/visorchannel.c @@ -20,6 +20,7 @@ #include #include +#include #include "visorbus.h" #include "visorbus_private.h" diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c index 419dba8..b84b40e 100644 --- a/drivers/staging/unisys/visorhba/visorhba_main.c +++ b/drivers/staging/unisys/visorhba/visorhba_main.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/staging/unisys/visorinput/visorinput.c b/drivers/staging/unisys/visorinput/visorinput.c index 9d8cbc5..1b58663 100644 --- a/drivers/staging/unisys/visorinput/visorinput.c +++ b/drivers/staging/unisys/visorinput/visorinput.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "visorbus.h" diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index dc390ea..c5f0b01 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 30/45] staging: unisys: visorbus: keep the success path on the left side
If you can't find the dev, it is an error. Indent for the error, instead of the success. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 416e741..80a0781 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -309,7 +309,6 @@ struct visor_device *visorbus_get_device_by_id(u32 bus_no, u32 dev_no, { struct device *dev; struct device *dev_start = NULL; - struct visor_device *vdev = NULL; struct visor_busdev id = { .bus_no = bus_no, .dev_no = dev_no @@ -319,9 +318,9 @@ struct visor_device *visorbus_get_device_by_id(u32 bus_no, u32 dev_no, dev_start = &from->device; dev = bus_find_device(&visorbus_type, dev_start, (void *)&id, match_visorbus_dev_by_id); - if (dev) - vdev = to_visor_device(dev); - return vdev; + if (!dev) + return NULL; + return to_visor_device(dev); } static void controlvm_init_response(struct controlvm_message *msg, -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 28/45] staging: unisys: include: remove signature_32
Remove signature_32 since it was only being referenced in one location. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/include/channel.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/unisys/include/channel.h b/drivers/staging/unisys/include/channel.h index 59b71a6..6cb8b4d 100644 --- a/drivers/staging/unisys/include/channel.h +++ b/drivers/staging/unisys/include/channel.h @@ -21,9 +21,8 @@ #include #define SIGNATURE_16(A, B) ((A) | ((B) << 8)) -#define SIGNATURE_32(A, B, C, D) \ - (SIGNATURE_16(A, B) | (SIGNATURE_16(C, D) << 16)) -#define VISOR_CHANNEL_SIGNATURE SIGNATURE_32('E', 'C', 'N', 'L') +#define VISOR_CHANNEL_SIGNATURE \ + (SIGNATURE_16('E', 'C') | (SIGNATURE_16('N', 'L') << 16)) /* * enum channel_serverstate -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 29/45] staging: unisys: include: consolidate a comment
Use all 80 characters of the line to consolidate a comment. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/include/iochannel.h | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h index a70760f..69dd9c3 100644 --- a/drivers/staging/unisys/include/iochannel.h +++ b/drivers/staging/unisys/include/iochannel.h @@ -348,10 +348,9 @@ struct sense_data { * the start of the NETWORK LAYER HEADER. * * NOTE: - * The full packet is described in frags but the ethernet header is - * separately kept in ethhdr so that uisnic doesn't have "MAP" the - * guest memory to get to the header. uisnic needs ethhdr to - * determine how to route the packet. + * The full packet is described in frags but the ethernet header is separately + * kept in ethhdr so that uisnic doesn't have "MAP" the guest memory to get to + * the header. uisnic needs ethhdr to determine how to route the packet. */ struct net_pkt_xmt { int len; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 25/45] staging: unisys: include: remove io.h from channel.h
Channel.h was including io.h and not using it. Remove the #include. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/include/channel.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/unisys/include/channel.h b/drivers/staging/unisys/include/channel.h index 2babe93..59b71a6 100644 --- a/drivers/staging/unisys/include/channel.h +++ b/drivers/staging/unisys/include/channel.h @@ -18,7 +18,6 @@ #define __CHANNEL_H__ #include -#include #include #define SIGNATURE_16(A, B) ((A) | ((B) << 8)) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 21/45] staging: unisys: visorbus: visorchipset: clean up blank lines in visorchipset
Remove extraneous blank lines and get consistency of blank lines. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 98 +- 1 file changed, 3 insertions(+), 95 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index df7429d..416e741 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -128,7 +128,6 @@ static ssize_t toolaction_show(struct device *dev, &tool_action, sizeof(u8)); if (err) return err; - return sprintf(buf, "%u\n", tool_action); } @@ -141,7 +140,6 @@ static ssize_t toolaction_store(struct device *dev, if (kstrtou8(buf, 10, &tool_action)) return -EINVAL; - err = visorchannel_write(chipset_dev->controlvm_channel, offsetof(struct visor_controlvm_channel, tool_action), @@ -178,7 +176,6 @@ static ssize_t boottotool_store(struct device *dev, if (kstrtoint(buf, 10, &val)) return -EINVAL; - efi_visor_indication.boot_to_tool = val; err = visorchannel_write(chipset_dev->controlvm_channel, offsetof(struct visor_controlvm_channel, @@ -214,7 +211,6 @@ static ssize_t error_store(struct device *dev, struct device_attribute *attr, if (kstrtou32(buf, 10, &error)) return -EINVAL; - err = visorchannel_write(chipset_dev->controlvm_channel, offsetof(struct visor_controlvm_channel, installation_error), @@ -237,7 +233,6 @@ static ssize_t textid_show(struct device *dev, struct device_attribute *attr, &text_id, sizeof(u32)); if (err) return err; - return sprintf(buf, "%u\n", text_id); } @@ -249,7 +244,6 @@ static ssize_t textid_store(struct device *dev, struct device_attribute *attr, if (kstrtou32(buf, 10, &text_id)) return -EINVAL; - err = visorchannel_write(chipset_dev->controlvm_channel, offsetof(struct visor_controlvm_channel, installation_text_id), @@ -272,7 +266,6 @@ static ssize_t remaining_steps_show(struct device *dev, &remaining_steps, sizeof(u16)); if (err) return err; - return sprintf(buf, "%hu\n", remaining_steps); } @@ -285,7 +278,6 @@ static ssize_t remaining_steps_store(struct device *dev, if (kstrtou16(buf, 10, &remaining_steps)) return -EINVAL; - err = visorchannel_write(chipset_dev->controlvm_channel, offsetof(struct visor_controlvm_channel, installation_remaining_steps), @@ -309,7 +301,6 @@ static int match_visorbus_dev_by_id(struct device *dev, void *data) if ((vdev->chipset_bus_no == id->bus_no) && (vdev->chipset_dev_no == id->dev_no)) return 1; - return 0; } @@ -374,7 +365,6 @@ static int chipset_init(struct controlvm_message *inmsg) goto out_respond; } chipset_inited = 1; - /* * Set features to indicate we support parahotplug (if Command also * supports it). Set the "reply" bit so Command knows this is a @@ -399,12 +389,10 @@ static int controlvm_respond(struct controlvm_message_header *msg_hdr, controlvm_init_response(&outmsg, msg_hdr, response); if (outmsg.hdr.flags.test_message == 1) return -EINVAL; - if (state) { outmsg.cmd.device_change_state.state = *state; outmsg.cmd.device_change_state.flags.phys_device = 1; } - return visorchannel_signalinsert(chipset_dev->controlvm_channel, CONTROLVM_QUEUE_REQUEST, &outmsg); } @@ -430,13 +418,11 @@ static int save_crash_message(struct controlvm_message *msg, "failed to read message count\n"); return err; } - if (local_crash_msg_count != CONTROLVM_CRASHMSG_MAX) { dev_err(&chipset_dev->acpi_device->dev, "invalid number of messages\n"); return -EIO; } - err = visorchannel_read(chipset_dev->controlvm_channel, offsetof(struct visor_controlvm_channel, saved_crash_message_offset), @@ -446,7 +432,6 @@ static int save_crash_message(struct controlvm_mess
[PATCH 26/45] staging: unisys: visorbus: vbuschannel doesn't use ctypes
Don't include ctypes in vbuschannel.h, it isn't used by ctypes, but it is used by visorbus_main.c so include it there. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/controlvmchannel.h | 1 + drivers/staging/unisys/visorbus/vbuschannel.h | 1 - drivers/staging/unisys/visorbus/visorbus_main.c| 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorbus/controlvmchannel.h b/drivers/staging/unisys/visorbus/controlvmchannel.h index 32ff5c1..4735ed8 100644 --- a/drivers/staging/unisys/visorbus/controlvmchannel.h +++ b/drivers/staging/unisys/visorbus/controlvmchannel.h @@ -17,6 +17,7 @@ #define __CONTROLVMCHANNEL_H__ #include + #include "channel.h" /* {2B3C2D10-7EF5-4ad8-B966-3448B7386B3D} */ diff --git a/drivers/staging/unisys/visorbus/vbuschannel.h b/drivers/staging/unisys/visorbus/vbuschannel.h index 27e04de..6eae58d 100644 --- a/drivers/staging/unisys/visorbus/vbuschannel.h +++ b/drivers/staging/unisys/visorbus/vbuschannel.h @@ -26,7 +26,6 @@ */ #include -#include #include "channel.h" /* {193b331b-c58f-11da-95a9-00e08161165f} */ diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index baae38f..c455784 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -13,6 +13,7 @@ * details. */ +#include #include #include #include -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 18/45] staging: unisys: visorbus: simplify debugfs print statment
Simplify debugfs statement so it is clearer and more compact. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index a085713..d10af23 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -417,7 +417,7 @@ static int bus_info_debugfs_show(struct seq_file *seq, void *v) return 0; seq_printf(seq, - "Client device / client driver info for %s partition (vbus #%u):\n", + "Client device/driver info for %s partition (vbus #%u):\n", ((vdev->name) ? (char *)(vdev->name) : ""), vdev->chipset_bus_no); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 16/45] staging: unisys: shrink the name of a variable
The field debugfs_client_bus_info can be reduced to debugfs_bus_info. The word client is extraneous in this context. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/include/visorbus.h | 2 +- drivers/staging/unisys/visorbus/visorbus_main.c | 20 +--- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h index e4ee38c..ea01a21 100644 --- a/drivers/staging/unisys/include/visorbus.h +++ b/drivers/staging/unisys/include/visorbus.h @@ -161,7 +161,7 @@ struct visor_device { void *vbus_hdr_info; guid_t partition_guid; struct dentry *debugfs_dir; - struct dentry *debugfs_client_bus_info; + struct dentry *debugfs_bus_info; }; #define to_visor_device(x) container_of(x, struct visor_device, device) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 308372e..4a128dc 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -179,7 +179,7 @@ static void visorbus_release_busdevice(struct device *xdev) { struct visor_device *dev = dev_get_drvdata(xdev); - debugfs_remove(dev->debugfs_client_bus_info); + debugfs_remove(dev->debugfs_bus_info); debugfs_remove_recursive(dev->debugfs_dir); visorchannel_destroy(dev->visorchannel); kfree(dev); @@ -414,7 +414,7 @@ static void vbuschannel_print_devinfo(struct visor_vbus_deviceinfo *devinfo, devinfo->infostrs); } -static int client_bus_info_debugfs_show(struct seq_file *seq, void *v) +static int bus_info_debugfs_show(struct seq_file *seq, void *v) { int i = 0; unsigned long off; @@ -451,15 +451,14 @@ static int client_bus_info_debugfs_show(struct seq_file *seq, void *v) return 0; } -static int client_bus_info_debugfs_open(struct inode *inode, struct file *file) +static int bus_info_debugfs_open(struct inode *inode, struct file *file) { - return single_open(file, client_bus_info_debugfs_show, - inode->i_private); + return single_open(file, bus_info_debugfs_show, inode->i_private); } -static const struct file_operations client_bus_info_debugfs_fops = { +static const struct file_operations bus_info_debugfs_fops = { .owner = THIS_MODULE, - .open = client_bus_info_debugfs_open, + .open = bus_info_debugfs_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, @@ -1024,10 +1023,9 @@ int visorbus_create_instance(struct visor_device *dev) dev->debugfs_dir = debugfs_create_dir(dev_name(&dev->device), visorbus_debugfs_dir); - dev->debugfs_client_bus_info = - debugfs_create_file("client_bus_info", 0440, dev->debugfs_dir, - dev, &client_bus_info_debugfs_fops); - + dev->debugfs_bus_info = debugfs_create_file("client_bus_info", 0440, + dev->debugfs_dir, dev, + &bus_info_debugfs_fops); dev_set_drvdata(&dev->device, dev); err = get_vbus_header_info(dev->visorchannel, &dev->device, hdr_info); if (err < 0) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 14/45] staging: unisys: visorbus: clean up initializations
Don't compute value of offset during initialization. Assigning a value to offset should happen after we have verified all of its components. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 589dff3..ea12499 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -743,11 +743,12 @@ static void write_vbus_chp_info(struct visorchannel *chan, struct visor_vbus_headerinfo *hdr_info, struct visor_vbus_deviceinfo *info) { - int off = sizeof(struct channel_header) + hdr_info->chp_info_offset; + int off; if (hdr_info->chp_info_offset == 0) return; + off = sizeof(struct channel_header) + hdr_info->chp_info_offset; visorchannel_write(chan, off, info, sizeof(*info)); } @@ -768,11 +769,11 @@ static void write_vbus_bus_info(struct visorchannel *chan, struct visor_vbus_headerinfo *hdr_info, struct visor_vbus_deviceinfo *info) { - int off = sizeof(struct channel_header) + hdr_info->bus_info_offset; + int off; if (hdr_info->bus_info_offset == 0) return; - + off = sizeof(struct channel_header) + hdr_info->bus_info_offset; visorchannel_write(chan, off, info, sizeof(*info)); } @@ -795,13 +796,12 @@ static void write_vbus_dev_info(struct visorchannel *chan, struct visor_vbus_deviceinfo *info, unsigned int devix) { - int off = - (sizeof(struct channel_header) + hdr_info->dev_info_offset) + - (hdr_info->device_info_struct_bytes * devix); + int off; if (hdr_info->dev_info_offset == 0) return; - + off = (sizeof(struct channel_header) + hdr_info->dev_info_offset) + + (hdr_info->device_info_struct_bytes * devix); visorchannel_write(chan, off, info, sizeof(*info)); } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/45] staging: unisys: visorbus: use guid_is_equal instead of memcmp
The function publish_vbus_dev_info was doing a memcmp of guids. It should be using the kernel provided guid_equal function instead. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index f8236da..b187581 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -855,9 +855,8 @@ static void publish_vbus_dev_info(struct visor_device *visordev) * type name */ for (i = 0; visordrv->channel_types[i].name; i++) { - if (memcmp(&visordrv->channel_types[i].guid, - &visordev->channel_type_guid, - sizeof(visordrv->channel_types[i].guid)) == 0) { + if (guid_equal(&visordrv->channel_types[i].guid, + &visordev->channel_type_guid)) { chan_type_name = visordrv->channel_types[i].name; break; } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 22/45] staging: unisys: visorbus: visorbus_main.c: remove blank lines
Removes several extraneous blank lines in visorbus_main.c. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 44 ++--- 1 file changed, 3 insertions(+), 41 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 56d1c16..740a36a 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -122,7 +122,6 @@ static int visorbus_uevent(struct device *xdev, struct kobj_uevent_env *env) dev = to_visor_device(xdev); guid = visorchannel_get_guid(dev->visorchannel); - return add_uevent_var(env, "MODALIAS=visorbus:%pUl", guid); } @@ -147,11 +146,9 @@ static int visorbus_match(struct device *xdev, struct device_driver *xdrv) drv = to_visor_driver(xdrv); if (!drv->channel_types) return 0; - for (i = 0; !guid_is_null(&drv->channel_types[i].guid); i++) if (guid_equal(&drv->channel_types[i].guid, channel_type)) return i + 1; - return 0; } @@ -288,7 +285,6 @@ static ssize_t typename_show(struct device *dev, struct device_attribute *attr, * define & implement display of bus attributes under * /sys/bus/visorbus/devices/visorbus. */ - static ssize_t partition_handle_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -346,7 +342,6 @@ static ssize_t channel_id_show(struct device *dev, visorchannel_id(vdev->visorchannel, buf); len = strlen(buf); buf[len++] = '\n'; - return len; } static DEVICE_ATTR_RO(channel_id); @@ -386,13 +381,11 @@ static void vbuschannel_print_devinfo(struct visor_vbus_deviceinfo *devinfo, /* uninitialized vbus device entry */ if (!isprint(devinfo->devtype[0])) return; - if (devix >= 0) seq_printf(seq, "[%d]", devix); else /* vbus device entry is for bus or chipset */ seq_puts(seq, " "); - /* * Note: because the s-Par back-end is free to scribble in this area, * we never assume '\0'-termination. @@ -420,7 +413,6 @@ static int bus_info_debugfs_show(struct seq_file *seq, void *v) "Client device/driver info for %s partition (vbus #%u):\n", ((vdev->name) ? (char *)(vdev->name) : ""), vdev->chipset_bus_no); - if (visorchannel_read(channel, offsetof(struct visor_vbus_channel, chp_info), &dev_info, sizeof(dev_info)) >= 0) @@ -438,7 +430,6 @@ static int bus_info_debugfs_show(struct seq_file *seq, void *v) off += sizeof(dev_info); i++; } - return 0; } @@ -468,6 +459,7 @@ static int dev_start_periodic_work(struct visor_device *dev) { if (dev->being_removed || dev->timer_active) return -EINVAL; + /* now up by at least 2 */ get_device(&dev->device); dev->timer.expires = jiffies + POLLJIFFIES_NORMALCHANNEL; @@ -480,6 +472,7 @@ static void dev_stop_periodic_work(struct visor_device *dev) { if (!dev->timer_active) return; + del_timer_sync(&dev->timer); dev->timer_active = false; put_device(&dev->device); @@ -507,10 +500,8 @@ static int visordriver_remove_device(struct device *xdev) dev->being_removed = true; drv->remove(dev); mutex_unlock(&dev->visordriver_callback_lock); - dev_stop_periodic_work(dev); put_device(&dev->device); - return 0; } @@ -633,7 +624,6 @@ int create_visor_device(struct visor_device *dev) /* keep a reference just for us (now 2) */ get_device(&dev->device); setup_timer(&dev->timer, dev_periodic_work, (unsigned long)dev); - /* * bus_id must be a unique name with respect to this bus TYPE (NOT bus * instance). That's why we need to include the bus number within the @@ -643,7 +633,6 @@ int create_visor_device(struct visor_device *dev) chipset_bus_no, chipset_dev_no); if (err) goto err_put; - /* * device_add does this: *bus_add_device(dev) @@ -664,7 +653,6 @@ int create_visor_device(struct visor_device *dev) err = device_add(&dev->device); if (err < 0) goto err_put; - list_add_tail(&dev->list_all, &list_all_device_instances); dev->state.created = 1; visorbus_response(dev, err, CONTROLVM_DEVICE_CREATE); @@ -705,14 +693,
[PATCH 23/45] staging: unisys: visorbus: to_visor_device/to_visor_driver move up
The macros to_visor_device and to_visor_driver are fairly small; move them up to the declaration block to save some space. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 740a36a..46e6a4c 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -490,11 +490,8 @@ static void dev_stop_periodic_work(struct visor_device *dev) */ static int visordriver_remove_device(struct device *xdev) { - struct visor_device *dev; - struct visor_driver *drv; - - dev = to_visor_device(xdev); - drv = to_visor_driver(xdev->driver); + struct visor_device *dev = to_visor_device(xdev); + struct visor_driver *drv = to_visor_driver(xdev->driver); mutex_lock(&dev->visordriver_callback_lock); dev->being_removed = true; @@ -863,11 +860,8 @@ static void publish_vbus_dev_info(struct visor_device *visordev) static int visordriver_probe_device(struct device *xdev) { int err; - struct visor_driver *drv; - struct visor_device *dev; - - dev = to_visor_device(xdev); - drv = to_visor_driver(xdev->driver); + struct visor_driver *drv = to_visor_driver(xdev->driver); + struct visor_device *dev = to_visor_device(xdev); mutex_lock(&dev->visordriver_callback_lock); dev->being_removed = false; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 20/45] staging: unisys: visorbus: fix newlines for visorchannel
Remove extraneous blank lines and add some lines that are needed. General philosophy -- declaration, space, pre-conditions (if needed), space, then rest of function. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchannel.c | 28 +- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c index 7665858..44eab70 100644 --- a/drivers/staging/unisys/visorbus/visorchannel.c +++ b/drivers/staging/unisys/visorbus/visorchannel.c @@ -57,6 +57,7 @@ void visorchannel_destroy(struct visorchannel *channel) { if (!channel) return; + if (channel->mapped) { memunmap(channel->mapped); if (channel->requested) @@ -122,7 +123,6 @@ int visorchannel_read(struct visorchannel *channel, ulong offset, void *dest, return -EIO; memcpy(dest, channel->mapped + offset, nbytes); - return 0; } @@ -140,9 +140,7 @@ int visorchannel_write(struct visorchannel *channel, ulong offset, void *dest, memcpy(((char *)(&channel->chan_hdr)) + offset, dest, copy_size); } - memcpy(channel->mapped + offset, dest, nbytes); - return 0; } @@ -226,32 +224,25 @@ static int signalremove_inner(struct visorchannel *channel, u32 queue, error = sig_read_header(channel, queue, &sig_hdr); if (error) return error; - /* No signals to remove; have caller try again. */ if (sig_hdr.head == sig_hdr.tail) return -EAGAIN; - sig_hdr.tail = (sig_hdr.tail + 1) % sig_hdr.max_slots; - error = sig_read_data(channel, queue, &sig_hdr, sig_hdr.tail, msg); if (error) return error; - sig_hdr.num_received++; - /* * For each data field in SIGNAL_QUEUE_HEADER that was modified, update * host memory. Required for channel sync. */ mb(); - error = SIG_WRITE_FIELD(channel, queue, &sig_hdr, tail); if (error) return error; error = SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_received); if (error) return error; - return 0; } @@ -288,7 +279,6 @@ static bool queue_empty(struct visorchannel *channel, u32 queue) if (sig_read_header(channel, queue, &sig_hdr)) return true; - return (sig_hdr.head == sig_hdr.tail); } @@ -308,11 +298,9 @@ bool visorchannel_signalempty(struct visorchannel *channel, u32 queue) if (!channel->needs_lock) return queue_empty(channel, queue); - spin_lock_irqsave(&channel->remove_lock, flags); rc = queue_empty(channel, queue); spin_unlock_irqrestore(&channel->remove_lock, flags); - return rc; } EXPORT_SYMBOL_GPL(visorchannel_signalempty); @@ -326,7 +314,6 @@ static int signalinsert_inner(struct visorchannel *channel, u32 queue, err = sig_read_header(channel, queue, &sig_hdr); if (err) return err; - sig_hdr.head = (sig_hdr.head + 1) % sig_hdr.max_slots; if (sig_hdr.head == sig_hdr.tail) { sig_hdr.num_overflows++; @@ -335,26 +322,21 @@ static int signalinsert_inner(struct visorchannel *channel, u32 queue, return err; return -EIO; } - err = sig_write_data(channel, queue, &sig_hdr, sig_hdr.head, msg); if (err) return err; - sig_hdr.num_sent++; - /* * For each data field in SIGNAL_QUEUE_HEADER that was modified, update * host memory. Required for channel sync. */ mb(); - err = SIG_WRITE_FIELD(channel, queue, &sig_hdr, head); if (err) return err; err = SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_sent); if (err) return err; - return 0; } @@ -386,11 +368,9 @@ static struct visorchannel *visorchannel_create_guts(u64 physaddr, gfp_t gfp, channel = kzalloc(sizeof(*channel), gfp); if (!channel) return NULL; - channel->needs_lock = needs_lock; spin_lock_init(&channel->insert_lock); spin_lock_init(&channel->remove_lock); - /* * Video driver constains the efi framebuffer so it will get a conflict * resource when requesting its full mem region. Since we are only @@ -401,21 +381,17 @@ static struct visorchannel *visorchannel_create_guts(u64 physaddr, gfp_t gfp, if (!channel->requested && !guid_equal(guid, &visor_video_guid)) /* we only care about errors if this is not the video channel */ goto err_destr
[PATCH 11/45] staging: unisys: visorbus: NULL pending_msg_hdr not an error
A NULL pending_msg_hdr is not an error, it just means that the firmware does not want an error response for that message. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 3 ++- drivers/staging/unisys/visorbus/visorchipset.c | 13 ++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 7bfccc8..b35b8a6 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -690,8 +690,9 @@ void remove_visor_device(struct visor_device *dev) { list_del(&dev->list_all); put_device(&dev->device); + if (dev->pending_msg_hdr) + visorbus_response(dev, 0, CONTROLVM_DEVICE_DESTROY); device_unregister(&dev->device); - visorbus_response(dev, 0, CONTROLVM_DEVICE_DESTROY); } static int get_vbus_header_info(struct visorchannel *chan, diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 14bc219..df7429d 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -481,9 +481,6 @@ static int controlvm_responder(enum controlvm_id cmd_id, struct controlvm_message_header *pending_msg_hdr, int response) { - if (!pending_msg_hdr) - return -EIO; - if (pending_msg_hdr->id != (u32)cmd_id) return -EINVAL; @@ -497,8 +494,6 @@ static int device_changestate_responder( { struct controlvm_message outmsg; - if (!p->pending_msg_hdr) - return -EIO; if (p->pending_msg_hdr->id != cmd_id) return -EINVAL; @@ -1391,8 +1386,10 @@ static void setup_crash_devices_work_queue(struct work_struct *work) void visorbus_response(struct visor_device *bus_info, int response, int controlvm_id) { - controlvm_responder(controlvm_id, bus_info->pending_msg_hdr, response); + if (!bus_info->pending_msg_hdr) + return; + controlvm_responder(controlvm_id, bus_info->pending_msg_hdr, response); kfree(bus_info->pending_msg_hdr); bus_info->pending_msg_hdr = NULL; } @@ -1401,9 +1398,11 @@ void visorbus_device_changestate_response(struct visor_device *dev_info, int response, struct visor_segment_state state) { + if (!dev_info->pending_msg_hdr) + return; + device_changestate_responder(CONTROLVM_DEVICE_CHANGESTATE, dev_info, response, state); - kfree(dev_info->pending_msg_hdr); dev_info->pending_msg_hdr = NULL; } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/45] staging: unisys: visorbus: clean up parser_string_get function
The function parser_string_get was writing its own strnlen function, use the kernel version instead. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 24 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index b7865b1..ff275d0 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -641,36 +641,20 @@ static const guid_t *parser_id_get(struct parser_context *ctx) return &ctx->data.id; } -static void *parser_string_get(struct parser_context *ctx) +static void *parser_string_get(u8 *pscan, int nscan) { - u8 *pscan; - unsigned long nscan; int value_length; void *value; - int i; - pscan = ctx->curr; - if (!pscan) - return NULL; - nscan = ctx->bytes_remaining; if (nscan == 0) return NULL; - for (i = 0, value_length = -1; i < nscan; i++) - if (pscan[i] == '\0') { - value_length = i; - break; - } - /* '\0' was not included in the length */ - if (value_length < 0) - value_length = nscan; - - value = kmalloc(value_length + 1, GFP_KERNEL); + value_length = strnlen(pscan, nscan); + value = kzalloc(value_length + 1, GFP_KERNEL); if (!value) return NULL; if (value_length > 0) memcpy(value, pscan, value_length); - ((u8 *)(value))[value_length] = '\0'; return value; } @@ -685,7 +669,7 @@ static void *parser_name_get(struct parser_context *ctx) ctx->curr = (char *)&phdr + phdr->name_offset; ctx->bytes_remaining = phdr->name_length; - return parser_string_get(ctx); + return parser_string_get(ctx->curr, phdr->name_length); } static int visorbus_configure(struct controlvm_message *inmsg, -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/45] staging: unisys: visorbus: visorbus_private.h remove extra blank lines
Remvoe several unneeded blank lines. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_private.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h index e878d65..91f788a 100644 --- a/drivers/staging/unisys/visorbus/visorbus_private.h +++ b/drivers/staging/unisys/visorbus/visorbus_private.h @@ -29,11 +29,9 @@ void remove_visor_device(struct visor_device *dev_info); int visorchipset_device_pause(struct visor_device *dev_info); int visorchipset_device_resume(struct visor_device *dev_info); - void visorbus_response(struct visor_device *p, int response, int controlvm_id); void visorbus_device_changestate_response(struct visor_device *p, int response, struct visor_segment_state state); - int visorbus_init(void); void visorbus_exit(void); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 00/45] staging: unisys: more updates to clean up the code.
Here are some more updates to clean up the code. David Binder (3): staging: unisys: include: Rename channel.h to visorchannel.h staging: unisys: include: Remove unnecessary macro to generate signature staging: unisys: include: Remove unused enum David Kershner (37): staging: unisys: visorbus: simplify commenting in controlvm_init staging: unisys: visorbus: don't need local variable cmd staging: unisys: visorbus: clean up parser_string_get function staging: unisys: visorbus: visorchannel: use 80 characters for comments staging: unisys; visorbus: visorchipset.c: remove extraneous newline staging: unisys: visorbus: fix alignment of paranethesis staging: unisys: visorbus: visorbus_private.h remove extra blank lines staging: unisys: visorbus: visorbus_main.c: cleanup and consolidate comments staging: unisys: visorbus: use guid_is_equal instead of memcmp staging: unisys: visorbus: don't put code in declaration. staging: unisys: visorbus: NULL pending_msg_hdr not an error staging: unisys: fix up device_destroy staging: unisys; visorbus: visorbus_main.c: remove extraneous newline staging: unisys: visorbus: clean up initializations staging: unisys: visorbus: keep the success path on the left staging: unisys: shrink the name of a variable staging: unisys: visorbus: clean up formatting of function definitions staging: unisys: visorbus: simplify debugfs print statment staging: unisys: visorbus: Remove unneeded initialization staging: unisys: visorbus: fix newlines for visorchannel staging: unisys: visorbus: visorchipset: clean up blank lines in visorchipset staging: unisys: visorbus: visorbus_main.c: remove blank lines staging: unisys: visorbus: to_visor_device/to_visor_driver move up staging: unisys: only include a file where it is used. staging: unisys: include: remove io.h from channel.h staging: unisys: visorbus: vbuschannel doesn't use ctypes staging: unisys: include: reorder to avoid forward declaration staging: unisys: include: remove signature_32 staging: unisys: include: consolidate a comment staging: unisys: visorbus: keep the success path on the left side staging: unisys: remove visorbus_type extern staging: unisys: visorbus: visorchipset.c: Remove useless initializations staging: unisys: visorbus: shrink name of POLLJIFFIES_CONTROLVMCHANNEL_XXX staging: unisys: visorbus: clean up parameter formatting staging: unisys: visorbus: Fix extraneous parenthesis staging: unisys: visorhba: clean up parenthesis staging: unisys: visornic: clean up parenthesis Sameer Wadgaonkar (5): staging: unisys: check the whole channel instead of just guid for match staging: unisys: visorbus: simplify visorchannel_create_guts staging: unisys: visorbus: fix line over 80 characters checkpatch warning staging: unisys: include: fix comments and spacing issues in visorbus.h staging: unisys: visorbus: fix comments in vbuschannel.h drivers/staging/unisys/include/iochannel.h | 9 +- drivers/staging/unisys/include/visorbus.h | 159 +-- .../unisys/include/{channel.h => visorchannel.h} | 12 +- drivers/staging/unisys/visorbus/controlvmchannel.h | 3 +- drivers/staging/unisys/visorbus/vbuschannel.h | 12 +- drivers/staging/unisys/visorbus/visorbus_main.c| 269 +-- drivers/staging/unisys/visorbus/visorbus_private.h | 8 +- drivers/staging/unisys/visorbus/visorchannel.c | 81 ++ drivers/staging/unisys/visorbus/visorchipset.c | 298 + drivers/staging/unisys/visorhba/visorhba_main.c| 12 +- drivers/staging/unisys/visorinput/visorinput.c | 6 +- drivers/staging/unisys/visornic/visornic_main.c| 10 +- 12 files changed, 318 insertions(+), 561 deletions(-) rename drivers/staging/unisys/include/{channel.h => visorchannel.h} (95%) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/45] staging: unisys: visorbus: fix alignment of paranethesis
Correct indenting of parameters when calling the functions in the file visorchipset.c. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 7e494e1..14bc219 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -691,9 +691,8 @@ static int visorbus_configure(struct controlvm_message *inmsg, goto err_respond; } - err = visorchannel_set_clientpartition - (bus_info->visorchannel, -cmd->configure_bus.guest_handle); + err = visorchannel_set_clientpartition(bus_info->visorchannel, + cmd->configure_bus.guest_handle); if (err) goto err_respond; @@ -1252,7 +1251,7 @@ static int chipset_selftest_uevent(struct controlvm_message_header *msg_hdr) static int chipset_notready_uevent(struct controlvm_message_header *msg_hdr) { int res = kobject_uevent(&chipset_dev->acpi_device->dev.kobj, -KOBJ_OFFLINE); +KOBJ_OFFLINE); if (msg_hdr->flags.response_expected) controlvm_respond(msg_hdr, res, NULL); @@ -1275,7 +1274,7 @@ static int unisys_vmcall(unsigned long tuple, unsigned long param) return -EPERM; __asm__ __volatile__(".byte 0x00f, 0x001, 0x0c1" : "=a"(result) : - "a"(tuple), "b"(reg_ebx), "c"(reg_ecx)); +"a"(tuple), "b"(reg_ebx), "c"(reg_ecx)); if (result) goto error; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/45] staging: unisys: visorbus: don't put code in declaration.
Simplify the code by not putting the assignment in the declaration. Define it and then assign it, so the function doesn't get bunched up on the right. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index b187581..7bfccc8 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -1083,9 +1083,9 @@ static void remove_all_visor_devices(void) struct list_head *listentry, *listtmp; list_for_each_safe(listentry, listtmp, &list_all_device_instances) { - struct visor_device *dev = list_entry(listentry, - struct visor_device, - list_all); + struct visor_device *dev; + + dev = list_entry(listentry, struct visor_device, list_all); remove_visor_device(dev); } } @@ -1170,7 +1170,6 @@ static int visorchipset_initiate_device_pause_resume(struct visor_device *dev, dev->resuming = true; err = drv->resume(dev, resume_state_change_complete); } - return err; } @@ -1191,7 +1190,6 @@ int visorchipset_device_pause(struct visor_device *dev_info) dev_info->pausing = false; return err; } - return 0; } @@ -1243,9 +1241,9 @@ void visorbus_exit(void) remove_all_visor_devices(); list_for_each_safe(listentry, listtmp, &list_all_bus_instances) { - struct visor_device *dev = list_entry(listentry, - struct visor_device, - list_all); + struct visor_device *dev; + + dev = list_entry(listentry, struct visor_device, list_all); visorbus_remove_instance(dev); } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/45] staging: unisys: fix up device_destroy
Visorbus_remove_instance calls device_unregister which in turn will call visorbus_release_busdevice. The function visorbus_release_busdevice was freeing the visor_device. The code in visorbus_remove_instance was then trying to reference the visor_device. This patch cleans up the code so the visor_device is not referenced after the unregister. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index b35b8a6..aa82508 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -181,6 +181,7 @@ static void visorbus_release_busdevice(struct device *xdev) debugfs_remove(dev->debugfs_client_bus_info); debugfs_remove_recursive(dev->debugfs_dir); + visorchannel_destroy(dev->visorchannel); kfree(dev); } @@ -1069,11 +1070,11 @@ void visorbus_remove_instance(struct visor_device *dev) * successfully been able to trace thru the code to see where/how * release() gets called. But I know it does. */ - visorchannel_destroy(dev->visorchannel); kfree(dev->vbus_hdr_info); list_del(&dev->list_all); + if (dev->pending_msg_hdr) + visorbus_response(dev, 0, CONTROLVM_BUS_DESTROY); device_unregister(&dev->device); - visorbus_response(dev, 0, CONTROLVM_BUS_DESTROY); } /* -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 17/45] staging: unisys: visorbus: clean up formatting of function definitions
Consolidate function parameters onto the same line if they can fit. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 27 + 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 4a128dc..a085713 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -69,12 +69,9 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, * Note that is only needed for callers in the EFI environment, and * is used to pass the EFI_DIAG_CAPTURE_PROTOCOL needed to log messages. */ -int visor_check_channel(struct channel_header *ch, - struct device *dev, - const guid_t *expected_guid, - char *chname, - u64 expected_min_bytes, - u32 expected_version, +int visor_check_channel(struct channel_header *ch, struct device *dev, + const guid_t *expected_guid, char *chname, + u64 expected_min_bytes, u32 expected_version, u64 expected_signature) { if (!guid_is_null(expected_guid)) { @@ -293,8 +290,7 @@ static ssize_t typename_show(struct device *dev, struct device_attribute *attr, */ static ssize_t partition_handle_show(struct device *dev, -struct device_attribute *attr, -char *buf) +struct device_attribute *attr, char *buf) { struct visor_device *vdev = to_visor_device(dev); u64 handle = visorchannel_get_clientpartition(vdev->visorchannel); @@ -304,8 +300,7 @@ static ssize_t partition_handle_show(struct device *dev, static DEVICE_ATTR_RO(partition_handle); static ssize_t partition_guid_show(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, char *buf) { struct visor_device *vdev = to_visor_device(dev); @@ -314,8 +309,7 @@ static ssize_t partition_guid_show(struct device *dev, static DEVICE_ATTR_RO(partition_guid); static ssize_t partition_name_show(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, char *buf) { struct visor_device *vdev = to_visor_device(dev); @@ -324,8 +318,7 @@ static ssize_t partition_name_show(struct device *dev, static DEVICE_ATTR_RO(partition_name); static ssize_t channel_addr_show(struct device *dev, -struct device_attribute *attr, -char *buf) +struct device_attribute *attr, char *buf) { struct visor_device *vdev = to_visor_device(dev); u64 addr = visorchannel_get_physaddr(vdev->visorchannel); @@ -335,8 +328,7 @@ static ssize_t channel_addr_show(struct device *dev, static DEVICE_ATTR_RO(channel_addr); static ssize_t channel_bytes_show(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, char *buf) { struct visor_device *vdev = to_visor_device(dev); u64 nbytes = visorchannel_get_nbytes(vdev->visorchannel); @@ -346,8 +338,7 @@ static ssize_t channel_bytes_show(struct device *dev, static DEVICE_ATTR_RO(channel_bytes); static ssize_t channel_id_show(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, char *buf) { struct visor_device *vdev = to_visor_device(dev); int len = 0; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/45] staging: unisys; visorbus: visorchipset.c: remove extraneous newline
Use all 80 characters when calling functions. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 31 ++ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index ff275d0..7e494e1 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -392,8 +392,7 @@ static int chipset_init(struct controlvm_message *inmsg) } static int controlvm_respond(struct controlvm_message_header *msg_hdr, -int response, -struct visor_segment_state *state) +int response, struct visor_segment_state *state) { struct controlvm_message outmsg; @@ -452,8 +451,7 @@ static int save_crash_message(struct controlvm_message *msg, case CRASH_DEV: local_crash_msg_offset += sizeof(struct controlvm_message); err = visorchannel_write(chipset_dev->controlvm_channel, -local_crash_msg_offset, -msg, +local_crash_msg_offset, msg, sizeof(struct controlvm_message)); if (err) { dev_err(&chipset_dev->acpi_device->dev, @@ -463,8 +461,7 @@ static int save_crash_message(struct controlvm_message *msg, break; case CRASH_BUS: err = visorchannel_write(chipset_dev->controlvm_channel, -local_crash_msg_offset, -msg, +local_crash_msg_offset, msg, sizeof(struct controlvm_message)); if (err) { dev_err(&chipset_dev->acpi_device->dev, @@ -549,8 +546,7 @@ static int visorbus_create(struct controlvm_message *inmsg) } if (inmsg->hdr.flags.response_expected == 1) { - pmsg_hdr = kzalloc(sizeof(*pmsg_hdr), - GFP_KERNEL); + pmsg_hdr = kzalloc(sizeof(*pmsg_hdr), GFP_KERNEL); if (!pmsg_hdr) { err = -ENOMEM; goto err_free_bus_info; @@ -1010,13 +1006,13 @@ static int parahotplug_request_complete(int id, u16 active) { struct list_head *pos; struct list_head *tmp; + struct parahotplug_request *req; spin_lock(¶hotplug_request_list_lock); /* Look for a request matching "id". */ list_for_each_safe(pos, tmp, ¶hotplug_request_list) { - struct parahotplug_request *req = - list_entry(pos, struct parahotplug_request, list); + req = list_entry(pos, struct parahotplug_request, list); if (req->id == id) { /* * Found a match. Remove it from the list and @@ -1216,9 +1212,7 @@ static int chipset_ready_uevent(struct controlvm_message_header *msg_hdr) { int res; - res = kobject_uevent(&chipset_dev->acpi_device->dev.kobj, -KOBJ_ONLINE); - + res = kobject_uevent(&chipset_dev->acpi_device->dev.kobj, KOBJ_ONLINE); if (msg_hdr->flags.response_expected) controlvm_respond(msg_hdr, res, NULL); @@ -1343,8 +1337,7 @@ static void setup_crash_devices_work_queue(struct work_struct *work) } if (local_crash_msg_count != CONTROLVM_CRASHMSG_MAX) { - dev_err(&chipset_dev->acpi_device->dev, - "invalid count\n"); + dev_err(&chipset_dev->acpi_device->dev, "invalid count\n"); return; } @@ -1409,8 +1402,8 @@ void visorbus_device_changestate_response(struct visor_device *dev_info, int response, struct visor_segment_state state) { - device_changestate_responder(CONTROLVM_DEVICE_CHANGESTATE, -dev_info, response, state); + device_changestate_responder(CONTROLVM_DEVICE_CHANGESTATE, dev_info, +response, state); kfree(dev_info->pending_msg_hdr); dev_info->pending_msg_hdr = NULL; @@ -1434,8 +1427,8 @@ static struct parser_context *parser_init_stream(u64 addr, u32 bytes, /* alloc an extra byte to ensure payload is \0 terminated */ allocbytes = bytes + 1 + (sizeof(struct parser_context) - sizeof(struct visor_controlvm_parameters_header)); - if ((chipset_dev->controlvm_payload_bytes_buffered + byte
[PATCH 01/45] staging: unisys: visorbus: simplify commenting in controlvm_init
During the process of udpating the features bits, put a block comment for all updates instead of a separate comment for each one. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 74cce4f..315000f 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -377,15 +377,11 @@ static int chipset_init(struct controlvm_message *inmsg) /* * Set features to indicate we support parahotplug (if Command also -* supports it). +* supports it). Set the "reply" bit so Command knows this is a +* features-aware driver. */ features = inmsg->cmd.init_chipset.features & VISOR_CHIPSET_FEATURE_PARA_HOTPLUG; - - /* -* Set the "reply" bit so Command knows this is a features-aware -* driver. -*/ features |= VISOR_CHIPSET_FEATURE_REPLY; out_respond: -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 15/45] staging: unisys: visorbus: keep the success path on the left
The code was indenting for the successful path and then combining the error and success path for the rest of the function. Correct it so the success path is not indented. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index ea12499..308372e 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -888,7 +888,7 @@ static void publish_vbus_dev_info(struct visor_device *visordev) */ static int visordriver_probe_device(struct device *xdev) { - int res; + int err; struct visor_driver *drv; struct visor_device *dev; @@ -898,15 +898,17 @@ static int visordriver_probe_device(struct device *xdev) mutex_lock(&dev->visordriver_callback_lock); dev->being_removed = false; - res = drv->probe(dev); - if (res >= 0) { - /* success: reference kept via unmatched get_device() */ - get_device(&dev->device); - publish_vbus_dev_info(dev); + err = drv->probe(dev); + if (err) { + mutex_unlock(&dev->visordriver_callback_lock); + return err; } + /* success: reference kept via unmatched get_device() */ + get_device(&dev->device); + publish_vbus_dev_info(dev); mutex_unlock(&dev->visordriver_callback_lock); - return res; + return 0; } /* -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 13/45] staging: unisys; visorbus: visorbus_main.c: remove extraneous newline
Use all 80 characters when calling functions. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index aa82508..589dff3 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -1023,9 +1023,8 @@ int visorbus_create_instance(struct visor_device *dev) dev->debugfs_dir = debugfs_create_dir(dev_name(&dev->device), visorbus_debugfs_dir); dev->debugfs_client_bus_info = - debugfs_create_file("client_bus_info", 0440, - dev->debugfs_dir, dev, - &client_bus_info_debugfs_fops); + debugfs_create_file("client_bus_info", 0440, dev->debugfs_dir, + dev, &client_bus_info_debugfs_fops); dev_set_drvdata(&dev->device, dev); err = get_vbus_header_info(dev->visorchannel, &dev->device, hdr_info); @@ -1040,10 +1039,8 @@ int visorbus_create_instance(struct visor_device *dev) dev->state.created = 1; dev->vbus_hdr_info = (void *)hdr_info; - write_vbus_chp_info(dev->visorchannel, hdr_info, - &chipset_driverinfo); - write_vbus_bus_info(dev->visorchannel, hdr_info, - &clientbus_driverinfo); + write_vbus_chp_info(dev->visorchannel, hdr_info, &chipset_driverinfo); + write_vbus_bus_info(dev->visorchannel, hdr_info, &clientbus_driverinfo); visorbus_response(dev, err, CONTROLVM_BUS_CREATE); @@ -1126,7 +1123,6 @@ static void resume_state_change_complete(struct visor_device *dev, int status) return; dev->resuming = false; - /* * Notify the chipset driver that the resume is complete, * which will presumably want to send some sort of response to -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/45] staging: unisys: visorbus: visorchannel: use 80 characters for comments
In the file visorhcannel.c use all 80 characters for comments instead of shortening them. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchannel.c | 35 +- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c index 2a000fe..7665858 100644 --- a/drivers/staging/unisys/visorbus/visorchannel.c +++ b/drivers/staging/unisys/visorbus/visorchannel.c @@ -41,8 +41,8 @@ struct visorchannel { struct channel_header chan_hdr; guid_t guid; /* -* channel creator knows if more than one -* thread will be inserting or removing +* channel creator knows if more than one thread will be inserting or +* removing */ bool needs_lock; /* protect head writes in chan_hdr */ @@ -173,8 +173,8 @@ static int sig_data_offset(struct channel_header *chan_hdr, int q, } /* - * Write the contents of a specific field within a SIGNAL_QUEUE_HEADER back - * into host memory + * Write the contents of a specific field within a SIGNAL_QUEUE_HEADER back into + * host memory */ #define SIG_WRITE_FIELD(channel, queue, sig_hdr, FIELD) \ visorchannel_write(channel, \ @@ -240,8 +240,8 @@ static int signalremove_inner(struct visorchannel *channel, u32 queue, sig_hdr.num_received++; /* -* For each data field in SIGNAL_QUEUE_HEADER that was modified, -* update host memory. Required for channel sync. +* For each data field in SIGNAL_QUEUE_HEADER that was modified, update +* host memory. Required for channel sync. */ mb(); @@ -293,8 +293,8 @@ static bool queue_empty(struct visorchannel *channel, u32 queue) } /** - * visorchannel_signalempty() - checks if the designated channel/queue - * contains any messages + * visorchannel_signalempty() - checks if the designated channel/queue contains + * any messages * @channel: the channel to query * @queue: the queue in the channel to query * @@ -343,8 +343,8 @@ static int signalinsert_inner(struct visorchannel *channel, u32 queue, sig_hdr.num_sent++; /* -* For each data field in SIGNAL_QUEUE_HEADER that was modified, -* update host memory. Required for channel sync. +* For each data field in SIGNAL_QUEUE_HEADER that was modified, update +* host memory. Required for channel sync. */ mb(); @@ -359,9 +359,9 @@ static int signalinsert_inner(struct visorchannel *channel, u32 queue, } /* - * visorchannel_create_guts() - creates the struct visorchannel abstraction - * for a data area in memory, but does NOT modify - * this data area + * visorchannel_create_guts() - creates the struct visorchannel abstraction for + * a data area in memory, but does NOT modify this + * data area * @physaddr: physical address of start of channel * @gfp: gfp_t to use when allocating memory for the data struct * @guid: GUID that identifies channel type; @@ -392,11 +392,10 @@ static struct visorchannel *visorchannel_create_guts(u64 physaddr, gfp_t gfp, spin_lock_init(&channel->remove_lock); /* -* Video driver constains the efi framebuffer so it will get a -* conflict resource when requesting its full mem region. Since -* we are only using the efi framebuffer for video we can ignore -* this. Remember that we haven't requested it so we don't try to -* release later on. +* Video driver constains the efi framebuffer so it will get a conflict +* resource when requesting its full mem region. Since we are only +* using the efi framebuffer for video we can ignore this. Remember that +* we haven't requested it so we don't try to release later on. */ channel->requested = request_mem_region(physaddr, size, VISOR_DRV_NAME); if (!channel->requested && !guid_equal(guid, &visor_video_guid)) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 19/45] staging: unisys: visorbus: Remove unneeded initialization
No need to set drv to NULL. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index d10af23..56d1c16 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -1138,7 +1138,7 @@ static int visorchipset_initiate_device_pause_resume(struct visor_device *dev, bool is_pause) { int err; - struct visor_driver *drv = NULL; + struct visor_driver *drv; /* If no driver associated with the device nothing to pause/resume */ if (!dev->device.driver) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/45] staging: unisys: visorbus: don't need local variable cmd
The local variable cmd was just being used to dereference a field inside of it. Get rid of the variable and just derefernce the parameter being passed in. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 315000f..b7865b1 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -595,9 +595,8 @@ static int visorbus_create(struct controlvm_message *inmsg) static int visorbus_destroy(struct controlvm_message *inmsg) { - struct controlvm_message_packet *cmd = &inmsg->cmd; struct controlvm_message_header *pmsg_hdr = NULL; - u32 bus_no = cmd->destroy_bus.bus_no; + u32 bus_no = inmsg->cmd.destroy_bus.bus_no; struct visor_device *bus_info; int err; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/45] staging: unisys: visorbus: visorbus_main.c: cleanup and consolidate comments
Use all 80 characters of the line for comments to help reduce the number of extra lines in the code. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 44 +++-- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 2bc7ff7..f8236da 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -198,7 +198,7 @@ static void visorbus_release_device(struct device *xdev) } /* - * begin implementation of specific channel attributes to appear under + * BUS specific channel attributes to appear under * /sys/bus/visorbus/dev/channel */ @@ -284,8 +284,6 @@ static ssize_t typename_show(struct device *dev, struct device_attribute *attr, ATTRIBUTE_GROUPS(channel); -/* end implementation of specific channel attributes */ - /* * BUS instance attributes * @@ -546,8 +544,7 @@ void visorbus_unregister_visor_driver(struct visor_driver *drv) * @dest: the destination buffer that is written into from the channel * @nbytes: the number of bytes to read from the channel * - * If receiving a message, use the visorchannel_signalremove() - * function instead. + * If receiving a message, use the visorchannel_signalremove() function instead. * * Return: integer indicating success (zero) or failure (non-zero) */ @@ -566,8 +563,7 @@ int visorbus_read_channel(struct visor_device *dev, unsigned long offset, * @src:the source buffer that is written into the channel * @nbytes: the number of bytes to write into the channel * - * If sending a message, use the visorchannel_signalinsert() - * function instead. + * If sending a message, use the visorchannel_signalinsert() function instead. * * Return: integer indicating success (zero) or failure (non-zero) */ @@ -618,17 +614,16 @@ void visorbus_disable_channel_interrupts(struct visor_device *dev) * * This is how everything starts from the device end. * This function is called when a channel first appears via a ControlVM - * message. In response, this function allocates a visor_device to - * correspond to the new channel, and attempts to connect it the appropriate - * driver. If the appropriate driver is found, the visor_driver.probe() - * function for that driver will be called, and will be passed the new - * visor_device that we just created. + * message. In response, this function allocates a visor_device to correspond + * to the new channel, and attempts to connect it the appropriate * driver. If + * the appropriate driver is found, the visor_driver.probe() function for that + * driver will be called, and will be passed the new * visor_device that we + * just created. * * It's ok if the appropriate driver is not yet loaded, because in that case * the new device struct will just stick around in the bus' list of devices. * When the appropriate driver calls visorbus_register_visor_driver(), the - * visor_driver.probe() for the new driver will be called with the new - * device. + * visor_driver.probe() for the new driver will be called with the new device. * * Return: 0 if successful, otherwise the negative value returned by * device_add() indicating the reason for failure @@ -649,9 +644,9 @@ int create_visor_device(struct visor_device *dev) setup_timer(&dev->timer, dev_periodic_work, (unsigned long)dev); /* -* bus_id must be a unique name with respect to this bus TYPE -* (NOT bus instance). That's why we need to include the bus -* number within the name. +* bus_id must be a unique name with respect to this bus TYPE (NOT bus +* instance). That's why we need to include the bus number within the +* name. */ err = dev_set_name(&dev->device, "vbus%u:dev%u", chipset_bus_no, chipset_dev_no); @@ -671,9 +666,9 @@ int create_visor_device(struct visor_device *dev) * if (!drv.probe(dev)) [visordriver_probe_device] *dev.drv = NULL * -* Note that device_add does NOT fail if no driver failed to -* claim the device. The device will be linked onto -* bus_type.klist_devices regardless (use bus_for_each_dev). +* Note that device_add does NOT fail if no driver failed to claim the +* device. The device will be linked onto bus_type.klist_devices +* regardless (use bus_for_each_dev). */ err = device_add(&dev->device); if (err < 0) @@ -914,14 +909,13 @@ static int visordriver_probe_device(struct device *xdev) } /* - * visorbus_register_visor_driver() - registers the provided visor driver - *for handling one or more visor device + * visorbus_register_vi
[PATCH 25/28] staging: unisys: visorbus: just check for GUID
Every channel_type must have a valid GUID, checking for the name was just redundant. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 0957eaa..a95901c 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -151,9 +151,7 @@ static int visorbus_match(struct device *xdev, struct device_driver *xdrv) if (!drv->channel_types) return 0; - for (i = 0; -!guid_is_null(&drv->channel_types[i].guid) || drv->channel_types[i].name; -i++) + for (i = 0; !guid_is_null(&drv->channel_types[i].guid); i++) if (guid_equal(&drv->channel_types[i].guid, channel_type)) return i + 1; -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 24/28] staging: unisys: Use size of channel defined in the channel.
The size of the channel should be pulled from the channel header, not from the message. All channels must be at least the size of the channel_header. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_private.h | 10 +-- drivers/staging/unisys/visorbus/visorchannel.c | 56 --- drivers/staging/unisys/visorbus/visorchipset.c | 6 +-- 3 files changed, 22 insertions(+), 50 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h index 8651c87..e878d65 100644 --- a/drivers/staging/unisys/visorbus/visorbus_private.h +++ b/drivers/staging/unisys/visorbus/visorbus_private.h @@ -38,12 +38,10 @@ int visorbus_init(void); void visorbus_exit(void); /* visorchannel access functions */ -struct visorchannel *visorchannel_create(u64 physaddr, -unsigned long channel_bytes, -gfp_t gfp, const guid_t *guid); -struct visorchannel *visorchannel_create_with_lock(u64 physaddr, - unsigned long channel_bytes, - gfp_t gfp, const guid_t *guid); +struct visorchannel *visorchannel_create(u64 physaddr, gfp_t gfp, +const guid_t *guid); +struct visorchannel *visorchannel_create_with_lock(u64 physaddr, gfp_t gfp, + const guid_t *guid); void visorchannel_destroy(struct visorchannel *channel); int visorchannel_read(struct visorchannel *channel, ulong offset, void *dest, ulong nbytes); diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c index 81e428a..49d1f5f 100644 --- a/drivers/staging/unisys/visorbus/visorchannel.c +++ b/drivers/staging/unisys/visorbus/visorchannel.c @@ -363,17 +363,8 @@ static int signalinsert_inner(struct visorchannel *channel, u32 queue, * for a data area in memory, but does NOT modify * this data area * @physaddr: physical address of start of channel - * @channel_bytes: size of the channel in bytes; this may 0 if the channel has - * already been initialized in memory (which is true for all - * channels provided to guest environments by the s-Par - * back-end), in which case the actual channel size will be - * read from the channel header in memory * @gfp: gfp_t to use when allocating memory for the data struct - * @guid: GUID that identifies channel type; this may 0 if the channel - * has already been initialized in memory (which is true for all - * channels provided to guest environments by the s-Par - * back-end), in which case the actual channel guid will be - * read from the channel header in memory + * @guid: GUID that identifies channel type; * @needs_lock:must specify true if you have multiple threads of execution * that will be calling visorchannel methods of this * visorchannel at the same time @@ -381,11 +372,9 @@ static int signalinsert_inner(struct visorchannel *channel, u32 queue, * Return: pointer to visorchannel that was created if successful, * otherwise NULL */ -static struct visorchannel *visorchannel_create_guts( - u64 physaddr, - unsigned long channel_bytes, - gfp_t gfp, const guid_t *guid, - bool needs_lock) +static struct visorchannel *visorchannel_create_guts(u64 physaddr, gfp_t gfp, +const guid_t *guid, +bool needs_lock) { struct visorchannel *channel; int err; @@ -423,35 +412,28 @@ static struct visorchannel *visorchannel_create_guts( channel->physaddr = physaddr; channel->nbytes = size; - err = visorchannel_read(channel, 0, &channel->chan_hdr, - sizeof(struct channel_header)); + err = visorchannel_read(channel, 0, &channel->chan_hdr, size); if (err) goto err_destroy_channel; - - /* we had better be a CLIENT of this channel */ - if (channel_bytes == 0) - channel_bytes = (ulong)channel->chan_hdr.size; - if (guid_is_null(guid)) - guid = &channel->chan_hdr.chtype; + size = (ulong)channel->chan_hdr.size; memunmap(channel->mapped); if (channel->requested) release_mem_region(channel->physaddr, channel->nbytes);
[PATCH 21/28] staging: unisys: visorchipset: Shorten parser_init_byte_stream.
Shorten the name of the function parser_init_byte_stream to just parser_init_stream. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index b30e3a1..1f7c6bf 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -1449,8 +1449,8 @@ static void parser_done(struct parser_context *ctx) kfree(ctx); } -static struct parser_context *parser_init_byte_stream(u64 addr, u32 bytes, - bool *retry) +static struct parser_context *parser_init_stream(u64 addr, u32 bytes, +bool *retry) { int allocbytes; struct parser_context *ctx; @@ -1523,8 +1523,7 @@ static int handle_command(struct controlvm_message inmsg, u64 channel_addr) if (parm_bytes) { bool retry = false; - parser_ctx = - parser_init_byte_stream(parm_addr, parm_bytes, &retry); + parser_ctx = parser_init_stream(parm_addr, parm_bytes, &retry); if (!parser_ctx && retry) return -EAGAIN; } -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 28/28] staging: unisys: change pr_err to dev_err in visor_check_channel
From: Sameer Wadgaonkar Changing pr_err to dev_err in visor_check_channel. Added device as an argument to visor_check_channel to pass into dev_err. Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/include/visorbus.h | 7 ++-- drivers/staging/unisys/visorbus/visorbus_main.c | 33 +- drivers/staging/unisys/visorbus/visorchipset.c | 1 +- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h index d7fa27b..e4ee38c 100644 --- a/drivers/staging/unisys/include/visorbus.h +++ b/drivers/staging/unisys/include/visorbus.h @@ -166,9 +166,10 @@ struct visor_device { #define to_visor_device(x) container_of(x, struct visor_device, device) -int visor_check_channel(struct channel_header *ch, const guid_t *expected_guid, - char *chname, u64 expected_min_bytes, - u32 expected_version, u64 expected_signature); +int visor_check_channel(struct channel_header *ch, struct device *dev, + const guid_t *expected_uuid, char *chname, + u64 expected_min_bytes, u32 expected_version, + u64 expected_signature); int visorbus_register_visor_driver(struct visor_driver *drv); void visorbus_unregister_visor_driver(struct visor_driver *drv); diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index ab47bbc..2bc7ff7 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -70,6 +70,7 @@ static LIST_HEAD(list_all_device_instances); * is used to pass the EFI_DIAG_CAPTURE_PROTOCOL needed to log messages. */ int visor_check_channel(struct channel_header *ch, + struct device *dev, const guid_t *expected_guid, char *chname, u64 expected_min_bytes, @@ -79,38 +80,38 @@ int visor_check_channel(struct channel_header *ch, if (!guid_is_null(expected_guid)) { /* caller wants us to verify type GUID */ if (!guid_equal(&ch->chtype, expected_guid)) { - pr_err("Channel mismatch on channel=%s(%pUL) field=type expected=%pUL actual=%pUL\n", - chname, expected_guid, - expected_guid, &ch->chtype); + dev_err(dev, "Channel mismatch on channel=%s(%pUL) field=type expected=%pUL actual=%pUL\n", + chname, expected_guid, expected_guid, + &ch->chtype); return 0; } } /* verify channel size */ if (expected_min_bytes > 0) { if (ch->size < expected_min_bytes) { - pr_err("Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8Lx actual=0x%-8.8Lx\n", - chname, expected_guid, - (unsigned long long)expected_min_bytes, - ch->size); + dev_err(dev, "Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8Lx actual=0x%-8.8Lx\n", + chname, expected_guid, + (unsigned long long)expected_min_bytes, + ch->size); return 0; } } /* verify channel version */ if (expected_version > 0) { if (ch->version_id != expected_version) { - pr_err("Channel mismatch on channel=%s(%pUL) field=version expected=0x%-8.8lx actual=0x%-8.8x\n", - chname, expected_guid, - (unsigned long)expected_version, - ch->version_id); + dev_err(dev, "Channel mismatch on channel=%s(%pUL) field=version expected=0x%-8.8lx actual=0x%-8.8x\n", + chname, expected_guid, + (unsigned long)expected_version, + ch->version_id); return 0; } } /* verify channel signature */ if (expected_signature > 0) { if (ch->signature != expected_signature) { - pr_err("Channel mismatch on channel=%s(%pUL) field=signature expected=0x%-8.8Lx actual=0x%-8.8Lx\n", - chname, expected_guid, - expected_signature, ch->signature); + dev_err(dev, "Channel mismatch on channel=%s(%pUL) field=signature expected=0x%-8.8Lx
[PATCH 14/28] staging: unisys: visorbus: Remove useless initialization.
The variable ctx was allocated with kzalloc, so all the data inside is zero, no need to reset it to 0. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 88cefa5..98c991b 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -1477,9 +1477,6 @@ static struct parser_context *parser_init_byte_stream(u64 addr, u32 bytes, ctx->allocbytes = allocbytes; ctx->param_bytes = bytes; - ctx->curr = NULL; - ctx->bytes_remaining = 0; - ctx->byte_stream = false; mapping = memremap(addr, bytes, MEMREMAP_WB); if (!mapping) goto err_finish_ctx; -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 23/28] staging: unisys: visornic: Remove unnecessary return values
From: David Binder Removes unnecessary return value in send_rcv_posts_if_needed(), since NAPI polling functions do not return errors. Signed-off-by: David Binder Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visornic/visornic_main.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 0ca8666..dc390ea 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -1585,10 +1585,8 @@ static const struct file_operations debugfs_info_fops = { /* send_rcv_posts_if_needed - send receive buffers to the IO Partition. * @devdata: Visornic device. - * - * Return: 0. */ -static int send_rcv_posts_if_needed(struct visornic_devdata *devdata) +static void send_rcv_posts_if_needed(struct visornic_devdata *devdata) { int i; struct net_device *netdev; @@ -1598,7 +1596,7 @@ static int send_rcv_posts_if_needed(struct visornic_devdata *devdata) /* don't do this until vnic is marked ready */ if (!(devdata->enabled && devdata->enab_dis_acked)) - return 0; + return; netdev = devdata->netdev; rcv_bufs_allocated = 0; @@ -1627,7 +1625,6 @@ static int send_rcv_posts_if_needed(struct visornic_devdata *devdata) } } devdata->num_rcv_bufs_could_not_alloc -= rcv_bufs_allocated; - return 0; } /* drain_resp_queue - drains and ignores all messages from the resp queue @@ -1750,12 +1747,8 @@ static int visornic_poll(struct napi_struct *napi, int budget) struct visornic_devdata, napi); int rx_count = 0; - int err; - - err = send_rcv_posts_if_needed(devdata); - if (err) - return err; + send_rcv_posts_if_needed(devdata); service_resp_queue(devdata->cmdrsp, devdata, &rx_count, budget); /* If there aren't any more packets to receive stop the poll */ -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 13/28] staging: unisys: visorbus: Remove useless comment.
Currently setting it in the right location, so no longer not sure. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index dca936b..88cefa5 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -792,8 +792,6 @@ static int visorbus_device_create(struct controlvm_message *inmsg) dev_info->chipset_bus_no = bus_no; dev_info->chipset_dev_no = dev_no; guid_copy(&dev_info->inst, &cmd->create_device.dev_inst_guid); - - /* not sure where the best place to set the 'parent' */ dev_info->device.parent = &bus_info->device; visorchannel = -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 20/28] staging: unisys: visorbus: Move parser functions location in file.
The parser functions were defined at the top of the file even though they were not referenced until later in the file. This patch moves them closer to where they are defined so they can be easily referenced. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 116 +- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 090818f..b30e3a1 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -297,64 +297,6 @@ static ssize_t remaining_steps_store(struct device *dev, } static DEVICE_ATTR_RW(remaining_steps); -static const guid_t *parser_id_get(struct parser_context *ctx) -{ - return &ctx->data.id; -} - -static void parser_done(struct parser_context *ctx) -{ - chipset_dev->controlvm_payload_bytes_buffered -= ctx->param_bytes; - kfree(ctx); -} - -static void *parser_string_get(struct parser_context *ctx) -{ - u8 *pscan; - unsigned long nscan; - int value_length; - void *value; - int i; - - pscan = ctx->curr; - if (!pscan) - return NULL; - nscan = ctx->bytes_remaining; - if (nscan == 0) - return NULL; - - for (i = 0, value_length = -1; i < nscan; i++) - if (pscan[i] == '\0') { - value_length = i; - break; - } - /* '\0' was not included in the length */ - if (value_length < 0) - value_length = nscan; - - value = kmalloc(value_length + 1, GFP_KERNEL); - if (!value) - return NULL; - if (value_length > 0) - memcpy(value, pscan, value_length); - ((u8 *)(value))[value_length] = '\0'; - return value; -} - -static void *parser_name_get(struct parser_context *ctx) -{ - struct visor_controlvm_parameters_header *phdr = NULL; - - phdr = &ctx->data; - - if (phdr->name_offset + phdr->name_length > ctx->param_bytes) - return NULL; - - ctx->curr = (char *)&phdr + phdr->name_offset; - ctx->bytes_remaining = phdr->name_length; - return parser_string_get(ctx); -} - struct visor_busdev { u32 bus_no; u32 dev_no; @@ -701,6 +643,58 @@ static int visorbus_destroy(struct controlvm_message *inmsg) return err; } +static const guid_t *parser_id_get(struct parser_context *ctx) +{ + return &ctx->data.id; +} + +static void *parser_string_get(struct parser_context *ctx) +{ + u8 *pscan; + unsigned long nscan; + int value_length; + void *value; + int i; + + pscan = ctx->curr; + if (!pscan) + return NULL; + nscan = ctx->bytes_remaining; + if (nscan == 0) + return NULL; + + for (i = 0, value_length = -1; i < nscan; i++) + if (pscan[i] == '\0') { + value_length = i; + break; + } + /* '\0' was not included in the length */ + if (value_length < 0) + value_length = nscan; + + value = kmalloc(value_length + 1, GFP_KERNEL); + if (!value) + return NULL; + if (value_length > 0) + memcpy(value, pscan, value_length); + ((u8 *)(value))[value_length] = '\0'; + return value; +} + +static void *parser_name_get(struct parser_context *ctx) +{ + struct visor_controlvm_parameters_header *phdr = NULL; + + phdr = &ctx->data; + + if (phdr->name_offset + phdr->name_length > ctx->param_bytes) + return NULL; + + ctx->curr = (char *)&phdr + phdr->name_offset; + ctx->bytes_remaining = phdr->name_length; + return parser_string_get(ctx); +} + static int visorbus_configure(struct controlvm_message *inmsg, struct parser_context *parser_ctx) { @@ -1449,6 +1443,12 @@ void visorbus_device_changestate_response(struct visor_device *dev_info, dev_info->pending_msg_hdr = NULL; } +static void parser_done(struct parser_context *ctx) +{ + chipset_dev->controlvm_payload_bytes_buffered -= ctx->param_bytes; + kfree(ctx); +} + static struct parser_context *parser_init_byte_stream(u64 addr, u32 bytes, bool *retry) { -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 27/28] staging: unisys: visorbus: remove EXPORT_SYMBOL_GPL for visor_check_channel
From: Sameer Wadgaonkar Removing EXPORT_SYMBOL_GPU from visor_check_channel since it is used only in visorbus. Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index a95901c..ab47bbc 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -116,7 +116,6 @@ int visor_check_channel(struct channel_header *ch, } return 1; } -EXPORT_SYMBOL_GPL(visor_check_channel); static int visorbus_uevent(struct device *xdev, struct kobj_uevent_env *env) { -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 26/28] staging: unisys: visorbus: Fix up GUID definition
Fix up the GUID definition to remove some checkpatch warnings as well as using the whole width of the screen. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 5bafadc..82b3bf7 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -20,9 +20,8 @@ #include "visorbus_private.h" /* {72120008-4AAB-11DC-8530-444553544200} */ -#define VISOR_SIOVM_GUID \ -GUID_INIT(0x72120008, 0x4AAB, 0x11DC, \ - 0x85, 0x30, 0x44, 0x45, 0x53, 0x54, 0x42, 0x00) +#define VISOR_SIOVM_GUID GUID_INIT(0x72120008, 0x4AAB, 0x11DC, 0x85, 0x30, \ + 0x44, 0x45, 0x53, 0x54, 0x42, 0x00) static const guid_t visor_vhba_channel_guid = VISOR_VHBA_CHANNEL_GUID; static const guid_t visor_siovm_guid = VISOR_SIOVM_GUID; -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/28] staging: unisys: visorbus: Fix parameter alignment.
Fixed the following checkpatch warning: visorchannel.c:443: CHECK: Alignment should match open parenthesis Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchannel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c index 6afc745..3969217 100644 --- a/drivers/staging/unisys/visorbus/visorchannel.c +++ b/drivers/staging/unisys/visorbus/visorchannel.c @@ -440,7 +440,7 @@ static struct visorchannel *visorchannel_create_guts( goto err_destroy_channel; channel->mapped = memremap(channel->physaddr, channel_bytes, - MEMREMAP_WB); + MEMREMAP_WB); if (!channel->mapped) { release_mem_region(channel->physaddr, channel_bytes); goto err_destroy_channel; -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/28] staging: unisys: Don't check for null before getting driver device.
The macro to convert to the driver object was giving a checkpatch warning when it ateempted to check for a null driver. It would return NULL if it found it, but only one location was checking to see if it was NULL. Remove the check in the MACRO and do it prior to calling the macro if required. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/include/visorbus.h | 3 +-- drivers/staging/unisys/visorbus/visorbus_main.c | 8 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h index e97bb5f..0af5477 100644 --- a/drivers/staging/unisys/include/visorbus.h +++ b/drivers/staging/unisys/include/visorbus.h @@ -104,8 +104,7 @@ struct visor_driver { struct device_driver driver; }; -#define to_visor_driver(x) ((x) ? \ - (container_of(x, struct visor_driver, driver)) : (NULL)) +#define to_visor_driver(x) (container_of(x, struct visor_driver, driver)) /** * struct visor_device - A device type for things "plugged" into the visorbus diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 05b632e..0957eaa 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -1158,13 +1158,13 @@ static int visorchipset_initiate_device_pause_resume(struct visor_device *dev, int err; struct visor_driver *drv = NULL; - drv = to_visor_driver(dev->device.driver); - if (!drv) - return -ENODEV; - + /* If no driver associated with the device nothing to pause/resume */ + if (!dev->device.driver) + return 0; if (dev->pausing || dev->resuming) return -EBUSY; + drv = to_visor_driver(dev->device.driver); if (is_pause) { dev->pausing = true; err = drv->pause(dev, pause_state_change_complete); -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/28] staging: unisys: visornic: Fix miscellaneous block comment format issues.
From: David Binder Fixes miscellaneous formatting issues with several block comments throughout visornic_main.c. Signed-off-by: David Binder Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visornic/visornic_main.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index ca7971b..0ca8666 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -52,8 +52,7 @@ static struct visor_channeltype_descriptor visornic_channel_types[] = { {} }; MODULE_DEVICE_TABLE(visorbus, visornic_channel_types); -/* - * FIXME XXX: This next line of code must be fixed and removed before +/* FIXME XXX: This next line of code must be fixed and removed before * acceptance into the 'normal' part of the kernel. It is only here as a place * holder to get module autoloading functionality working for visorbus. Code * must be added to scripts/mode/file2alias.c, etc., to get this working @@ -76,7 +75,6 @@ struct chanstat { }; /* struct visornic_devdata - * * @enabled:0 disabled 1 enabled to receive. * @enab_dis_acked: NET_RCV_ENABLE/DISABLE acked by IOPART. * @struct *dev: @@ -1387,8 +1385,7 @@ static int visornic_rx(struct uiscmdrsp *cmdrsp) */ skb = NULL; - /* -* whether the packet got dropped or handled, the skb is freed by + /* whether the packet got dropped or handled, the skb is freed by * kernel code, so we shouldn't free it. but we should repost a * new rcv buffer. */ @@ -1863,9 +1860,10 @@ static int visornic_probe(struct visor_device *dev) goto cleanup_netdev; } - /* set the net_xmit outstanding threshold */ - /* always leave two slots open but you should have 3 at a minimum */ - /* note that max_outstanding_net_xmits must be > 0 */ + /* set the net_xmit outstanding threshold +* always leave two slots open but you should have 3 at a minimum +* note that max_outstanding_net_xmits must be > 0 +*/ devdata->max_outstanding_net_xmits = max_t(unsigned long, 3, ((devdata->num_rcv_bufs / 3) - 2)); devdata->upper_threshold_net_xmits = -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 22/28] staging: unisys: visorbus: use all 80 characters for multi-line messages
The file visorchipset had a bunch of comments that were not using the full screen before they wrapped, update the comments to wrap at 80 characters instead. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 35 --- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 1f7c6bf..0ea20bb 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -41,9 +41,9 @@ static const guid_t visor_controlvm_channel_guid = VISOR_CONTROLVM_CHANNEL_GUID; #define UNISYS_VISOR_ID_EDX 0x34367261 /* - * When the controlvm channel is idle for at least MIN_IDLE_SECONDS, - * we switch to slow polling mode. As soon as we get a controlvm - * message, we switch back to fast polling mode. + * When the controlvm channel is idle for at least MIN_IDLE_SECONDS, we switch + * to slow polling mode. As soon as we get a controlvm message, we switch back + * to fast polling mode. */ #define MIN_IDLE_SECONDS 10 @@ -377,15 +377,15 @@ static int chipset_init(struct controlvm_message *inmsg) chipset_inited = 1; /* -* Set features to indicate we support parahotplug (if Command -* also supports it). +* Set features to indicate we support parahotplug (if Command also +* supports it). */ features = inmsg->cmd.init_chipset.features & VISOR_CHIPSET_FEATURE_PARA_HOTPLUG; /* -* Set the "reply" bit so Command knows this is a -* features-aware driver. +* Set the "reply" bit so Command knows this is a features-aware +* driver. */ features |= VISOR_CHIPSET_FEATURE_REPLY; @@ -1210,10 +1210,9 @@ static int parahotplug_process_message(struct controlvm_message *inmsg) } /* -* For disable messages, add the request to the -* request list before kicking off the udev script. It -* won't get responded to until the script has -* indicated it's done. +* For disable messages, add the request to the request list before +* kicking off the udev script. It won't get responded to until the +* script has indicated it's done. */ spin_lock(¶hotplug_request_list_lock); list_add_tail(&req->list, ¶hotplug_request_list); @@ -1554,8 +1553,8 @@ static int handle_command(struct controlvm_message inmsg, u64 channel_addr) err = parahotplug_process_message(&inmsg); } else { /* -* save the hdr and cmd structures for later use -* when sending back the response to Command +* save the hdr and cmd structures for later use when +* sending back the response to Command */ err = visorbus_device_changestate(&inmsg); break; @@ -1664,9 +1663,8 @@ static void controlvm_periodic_work(struct work_struct *work) if (chipset_dev->controlvm_pending_msg_valid) { /* -* we throttled processing of a prior -* msg, so try to process it again -* rather than reading a new one +* we throttled processing of a prior msg, so try to process +* it again rather than reading a new one */ inmsg = chipset_dev->controlvm_pending_msg; chipset_dev->controlvm_pending_msg_valid = false; @@ -1701,9 +1699,8 @@ static void controlvm_periodic_work(struct work_struct *work) if (time_after(jiffies, chipset_dev->most_recent_message_jiffies + (HZ * MIN_IDLE_SECONDS))) { /* -* it's been longer than MIN_IDLE_SECONDS since we -* processed our last controlvm message; slow down the -* polling +* it's been longer than MIN_IDLE_SECONDS since we processed +* our last controlvm message; slow down the polling */ if (chipset_dev->poll_jiffies != POLLJIFFIES_CONTROLVMCHANNEL_SLOW) -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 19/28] staging: unisys: visorbus: remove uneeded initializations
Several variables were initialized when not needed. Remove the extraneous initializations. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index a602ba6..090818f 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -312,8 +312,8 @@ static void *parser_string_get(struct parser_context *ctx) { u8 *pscan; unsigned long nscan; - int value_length = -1; - void *value = NULL; + int value_length; + void *value; int i; pscan = ctx->curr; -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/28] staging: unisys: visorbus: Use __func__ instead of name.
The dev_err was using the hardcoded function name, as reported by checkpatch, it should be using __func__. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 7423c9e..c7b4599 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -744,7 +744,7 @@ static int visorbus_configure(struct controlvm_message *inmsg, err_respond: dev_err(&chipset_dev->acpi_device->dev, - "visorbus_configure exited with err: %d\n", err); + "%s exited with err: %d\n", __func__, err); if (inmsg->hdr.flags.response_expected == 1) controlvm_responder(inmsg->hdr.id, &inmsg->hdr, err); return err; -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/28] staging: unisys: include: Add comment next to mutex.
Checkpatch reports an error that no comment was next to the mutex lock. Add an appropriate message for the lock. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/include/visorbus.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h index 0af5477..d7fa27b 100644 --- a/drivers/staging/unisys/include/visorbus.h +++ b/drivers/staging/unisys/include/visorbus.h @@ -119,8 +119,8 @@ struct visor_driver { * activity. * @being_removed: Indicates that the device is being removed from * the bus. Private bus driver use only. - * @visordriver_callback_lock: Used by the bus driver to lock when handling - * channel events. + * @visordriver_callback_lock: Used by the bus driver to lock when adding and + * removing devices. * @pausing: Indicates that a change towards a paused state. * is in progress. Only modified by the bus driver. * @resuming: Indicates that a change towards a running state @@ -149,7 +149,7 @@ struct visor_device { struct timer_list timer; bool timer_active; bool being_removed; - struct mutex visordriver_callback_lock; + struct mutex visordriver_callback_lock; /* synchronize probe/remove */ bool pausing; bool resuming; u32 chipset_bus_no; -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/28] staging: unisys: visorbus: Consolidate controlvm channel creation.
The functions to create the controlvm channel were disjointed and ignoring information that was available. This patch consolidates it so it clearer what is happening. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 47 ++- 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index c7b4599..dca936b 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -1332,34 +1332,27 @@ static int unisys_vmcall(unsigned long tuple, unsigned long param) } } -static unsigned int issue_vmcall_io_controlvm_addr(u64 *control_addr, - u32 *control_bytes) +static int controlvm_channel_create(struct visorchipset_device *dev) { - u64 physaddr; + struct visorchannel *chan; + u64 addr; + u32 size; int err; - physaddr = virt_to_phys(&chipset_dev->controlvm_params); - err = unisys_vmcall(VMCALL_CONTROLVM_ADDR, physaddr); + err = unisys_vmcall(VMCALL_CONTROLVM_ADDR, + virt_to_phys(&dev->controlvm_params)); if (err) return err; - - *control_addr = chipset_dev->controlvm_params.address; - *control_bytes = chipset_dev->controlvm_params.channel_bytes; - + addr = dev->controlvm_params.address; + size = dev->controlvm_params.channel_bytes; + chan = visorchannel_create_with_lock(addr, size, GFP_KERNEL, +&visor_controlvm_channel_guid); + if (!chan) + return -ENOMEM; + dev->controlvm_channel = chan; return 0; } -static u64 controlvm_get_channel_address(void) -{ - u64 addr = 0; - u32 size = 0; - - if (issue_vmcall_io_controlvm_addr(&addr, &size)) - return 0; - - return addr; -} - static void setup_crash_devices_work_queue(struct work_struct *work) { struct controlvm_message local_crash_bus_msg; @@ -1739,32 +1732,26 @@ static void controlvm_periodic_work(struct work_struct *work) static int visorchipset_init(struct acpi_device *acpi_device) { int err = -ENODEV; - u64 addr; struct visorchannel *controlvm_channel; chipset_dev = kzalloc(sizeof(*chipset_dev), GFP_KERNEL); if (!chipset_dev) goto error; - addr = controlvm_get_channel_address(); - if (!addr) - goto error; + err = controlvm_channel_create(chipset_dev); + if (err) + goto error_free_chipset_dev; acpi_device->driver_data = chipset_dev; chipset_dev->acpi_device = acpi_device; chipset_dev->poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST; - controlvm_channel = visorchannel_create_with_lock(addr, 0, GFP_KERNEL, - &visor_controlvm_channel_guid); - if (!controlvm_channel) - goto error_free_chipset_dev; - - chipset_dev->controlvm_channel = controlvm_channel; err = sysfs_create_groups(&chipset_dev->acpi_device->dev.kobj, visorchipset_dev_groups); if (err < 0) goto error_destroy_channel; + controlvm_channel = chipset_dev->controlvm_channel; if (!visor_check_channel(visorchannel_get_header(controlvm_channel), &visor_controlvm_channel_guid, "controlvm", -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 18/28] staging: unisys: visorbus: Remove useless else clause in visorutil_spar_detect.
The function visorutil_spar_detect had an if clause that returns from the function, no need to do the rest of the code in an else clause. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index d27e0e8..a602ba6 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -1830,9 +1830,8 @@ static __init int visorutil_spar_detect(void) return (ebx == UNISYS_VISOR_ID_EBX) && (ecx == UNISYS_VISOR_ID_ECX) && (edx == UNISYS_VISOR_ID_EDX); - } else { - return 0; } + return 0; } static int init_unisys(void) -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 17/28] staging: unisys: Change data to point to visor_controlvm_parameters_header.
The data field was being defined as a character array and then casted into a visor_controlvm_parameters_header structure. This patch converts it to just point to the visor_controlvm_parameters_header structure. The data following the header is still behind the header_info. Reported-by: Greg Kroah-Hartman Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 23 +++ 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 3a8357e..d27e0e8 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -53,7 +53,7 @@ struct parser_context { u8 *curr; unsigned long bytes_remaining; bool byte_stream; - char data[0]; + struct visor_controlvm_parameters_header data; }; /* VMCALL_CONTROLVM_ADDR: Used by all guests, not just IO. */ @@ -299,10 +299,7 @@ static DEVICE_ATTR_RW(remaining_steps); static const guid_t *parser_id_get(struct parser_context *ctx) { - struct visor_controlvm_parameters_header *phdr = NULL; - - phdr = (struct visor_controlvm_parameters_header *)(ctx->data); - return &phdr->id; + return &ctx->data.id; } static void parser_done(struct parser_context *ctx) @@ -348,12 +345,12 @@ static void *parser_name_get(struct parser_context *ctx) { struct visor_controlvm_parameters_header *phdr = NULL; - phdr = (struct visor_controlvm_parameters_header *)(ctx->data); + phdr = &ctx->data; if (phdr->name_offset + phdr->name_length > ctx->param_bytes) return NULL; - ctx->curr = ctx->data + phdr->name_offset; + ctx->curr = (char *)&phdr + phdr->name_offset; ctx->bytes_remaining = phdr->name_length; return parser_string_get(ctx); } @@ -1455,17 +1452,15 @@ void visorbus_device_changestate_response(struct visor_device *dev_info, static struct parser_context *parser_init_byte_stream(u64 addr, u32 bytes, bool *retry) { - int allocbytes = sizeof(struct parser_context) + bytes; + int allocbytes; struct parser_context *ctx; void *mapping; *retry = false; - /* -* alloc an 0 extra byte to ensure payload is -* '\0'-terminated -*/ - allocbytes++; + /* alloc an extra byte to ensure payload is \0 terminated */ + allocbytes = bytes + 1 + (sizeof(struct parser_context) - +sizeof(struct visor_controlvm_parameters_header)); if ((chipset_dev->controlvm_payload_bytes_buffered + bytes) > MAX_CONTROLVM_PAYLOAD_BYTES) { *retry = true; @@ -1482,7 +1477,7 @@ static struct parser_context *parser_init_byte_stream(u64 addr, u32 bytes, mapping = memremap(addr, bytes, MEMREMAP_WB); if (!mapping) goto err_finish_ctx; - memcpy(ctx->data, mapping, bytes); + memcpy(&ctx->data, mapping, bytes); memunmap(mapping); ctx->byte_stream = true; chipset_dev->controlvm_payload_bytes_buffered += ctx->param_bytes; -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 16/28] staging: unisys: visorbus: Split else if blocks into multiple if.
Visorbus_configure had a block of "else if" clauses at the beginning of the function. Simplify this to just being "if" clauses since each code block ended with a goto. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index e5d051f..3a8357e 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -717,10 +717,12 @@ static int visorbus_configure(struct controlvm_message *inmsg, if (!bus_info) { err = -EINVAL; goto err_respond; - } else if (bus_info->state.created == 0) { + } + if (bus_info->state.created == 0) { err = -EINVAL; goto err_respond; - } else if (bus_info->pending_msg_hdr) { + } + if (bus_info->pending_msg_hdr) { err = -EIO; goto err_respond; } -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 15/28] staging: unisys: visorbus: Remove check for valid parm_addr.
The variable parm_addr will never be null, so no need to check for it. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 98c991b..e5d051f 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -1523,7 +1523,7 @@ static int handle_command(struct controlvm_message inmsg, u64 channel_addr) * within our OS-controlled memory. We need to know that, because it * makes a difference in how we compute the virtual address. */ - if (parm_addr && parm_bytes) { + if (parm_bytes) { bool retry = false; parser_ctx = -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/28] staging: unisys: visornic: Fix up existing function comments.
From: David Binder Refactors existing static function comments to increase code readability. Signed-off-by: David Binder Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visornic/visornic_main.c | 417 +++-- 1 file changed, 190 insertions(+), 227 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 0c29d53..ca7971b 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -233,17 +233,15 @@ static u16 add_physinfo_entries(u64 inp_pfn, u16 inp_off, u16 inp_len, return index + i; } -/* - * visor_copy_fragsinfo_from_skb( - * @skb_in: skbuff that we are pulling the frags from - * @firstfraglen: length of first fragment in skb - * @frags_max: max len of frags array - * @frags: frags array filled in on output +/* visor_copy_fragsinfo_from_skb - copy fragment list in the SKB to a phys_info + *array that the IOPART understands + * @skb: Skbuff that we are pulling the frags from. + * @firstfraglen: Length of first fragment in skb. + * @frags_max: Max len of frags array. + * @frags: Frags array filled in on output. * - * Copy the fragment list in the SKB to a phys_info - * array that the IOPART understands. - * Return value indicates number of entries filled in frags - * Negative values indicate an error. + * Return: Positive integer indicating number of entries filled in frags on + * success, negative integer on error. */ static int visor_copy_fragsinfo_from_skb(struct sk_buff *skb, unsigned int firstfraglen, @@ -341,14 +339,11 @@ static const struct file_operations debugfs_enable_ints_fops = { .write = enable_ints_write, }; -/* - * visornic_serverdown_complete - IOPART went down, pause device - * @work: Work queue it was scheduled on +/* visornic_serverdown_complete - pause device following IOPART going down + * @devdata: Device managed by IOPART. * - * The IO partition has gone down and we need to do some cleanup - * for when it comes back. Treat the IO partition as the link - * being down. - * Returns void. + * The IO partition has gone down, and we need to do some cleanup for when it + * comes back. Treat the IO partition as the link being down. */ static void visornic_serverdown_complete(struct visornic_devdata *devdata) { @@ -373,13 +368,14 @@ static void visornic_serverdown_complete(struct visornic_devdata *devdata) devdata->server_down_complete_func = NULL; } -/* - * visornic_serverdown - Command has notified us that IOPART is down - * @devdata: device that is being managed by IOPART +/* visornic_serverdown - Command has notified us that IOPART is down + * @devdata: Device managed by IOPART. + * @complete_func: Function to call when finished. + * + * Schedule the work needed to handle the server down request. Make sure we + * haven't already handled the server change state event. * - * Schedule the work needed to handle the server down request. Make - * sure we haven't already handled the server change state event. - * Returns 0 if we scheduled the work, -EINVAL on error. + * Return: 0 if we scheduled the work, negative integer on error. */ static int visornic_serverdown(struct visornic_devdata *devdata, visorbus_state_complete_func complete_func) @@ -419,13 +415,13 @@ static int visornic_serverdown(struct visornic_devdata *devdata, return err; } -/* - * alloc_rcv_buf - alloc rcv buffer to be given to the IO Partition. - * @netdev: network adapter the rcv bufs are attached too. +/* alloc_rcv_buf - alloc rcv buffer to be given to the IO Partition + * @netdev: Network adapter the rcv bufs are attached too. + * + * Create an sk_buff (rcv_buf) that will be passed to the IO Partition + * so that it can write rcv data into our memory space. * - * Create an sk_buff (rcv_buf) that will be passed to the IO Partition - * so that it can write rcv data into our memory space. - * Return pointer to sk_buff + * Return: Pointer to sk_buff. */ static struct sk_buff *alloc_rcv_buf(struct net_device *netdev) { @@ -449,14 +445,12 @@ static struct sk_buff *alloc_rcv_buf(struct net_device *netdev) return skb; } -/* - * post_skb- post a skb to the IO Partition. - * @cmdrsp: cmdrsp packet to be send to the IO Partition - * @devdata: visornic_devdata to post the skb too - * @skb: skb to give to the IO partition +/* post_skb - post a skb to the IO Partition + * @cmdrsp: Cmdrsp packet to be send to the IO Partition. + * @devdata: visornic_devdata to post the skb to. + * @skb: Skb to give to the IO partition. * - * Send the skb to the IO Partition. - * Returns 0 or error + * Return:
[PATCH 08/28] staging: unisys: visorbus: Convert macros to functions.
Several macros in visorchannel.c were doing complex arithmetic, converted them to functions so that valid type checking could be done. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchannel.c | 25 +++ 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c index 3969217..81e428a 100644 --- a/drivers/staging/unisys/visorbus/visorchannel.c +++ b/drivers/staging/unisys/visorbus/visorchannel.c @@ -155,17 +155,22 @@ void *visorchannel_get_header(struct visorchannel *channel) * Return offset of a specific SIGNAL_QUEUE_HEADER from the beginning of a * channel header */ -#define SIG_QUEUE_OFFSET(chan_hdr, q) \ - ((chan_hdr)->ch_space_offset + \ -((q) * sizeof(struct signal_queue_header))) +int sig_queue_offset(struct channel_header *chan_hdr, int q) +{ + return ((chan_hdr)->ch_space_offset + + ((q) * sizeof(struct signal_queue_header))); +} /* * Return offset of a specific queue entry (data) from the beginning of a * channel header */ -#define SIG_DATA_OFFSET(chan_hdr, q, sig_hdr, slot) \ - (SIG_QUEUE_OFFSET(chan_hdr, q) + (sig_hdr)->sig_base_offset + \ -((slot) * (sig_hdr)->signal_size)) +int sig_data_offset(struct channel_header *chan_hdr, int q, + struct signal_queue_header *sig_hdr, int slot) +{ + return (sig_queue_offset(chan_hdr, q) + sig_hdr->sig_base_offset + + (slot * sig_hdr->signal_size)); +} /* * Write the contents of a specific field within a SIGNAL_QUEUE_HEADER back @@ -173,7 +178,7 @@ void *visorchannel_get_header(struct visorchannel *channel) */ #define SIG_WRITE_FIELD(channel, queue, sig_hdr, FIELD) \ visorchannel_write(channel, \ - SIG_QUEUE_OFFSET(&channel->chan_hdr, queue) + \ + sig_queue_offset(&channel->chan_hdr, queue) + \ offsetof(struct signal_queue_header, FIELD), \ &((sig_hdr)->FIELD), \ sizeof((sig_hdr)->FIELD)) @@ -186,7 +191,7 @@ static int sig_read_header(struct visorchannel *channel, u32 queue, /* Read the appropriate SIGNAL_QUEUE_HEADER into local memory. */ return visorchannel_read(channel, -SIG_QUEUE_OFFSET(&channel->chan_hdr, queue), +sig_queue_offset(&channel->chan_hdr, queue), sig_hdr, sizeof(struct signal_queue_header)); } @@ -194,7 +199,7 @@ static int sig_read_data(struct visorchannel *channel, u32 queue, struct signal_queue_header *sig_hdr, u32 slot, void *data) { - int signal_data_offset = SIG_DATA_OFFSET(&channel->chan_hdr, queue, + int signal_data_offset = sig_data_offset(&channel->chan_hdr, queue, sig_hdr, slot); return visorchannel_read(channel, signal_data_offset, @@ -205,7 +210,7 @@ static int sig_write_data(struct visorchannel *channel, u32 queue, struct signal_queue_header *sig_hdr, u32 slot, void *data) { - int signal_data_offset = SIG_DATA_OFFSET(&channel->chan_hdr, queue, + int signal_data_offset = sig_data_offset(&channel->chan_hdr, queue, sig_hdr, slot); return visorchannel_write(channel, signal_data_offset, -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 00/28] staging: unisys: More updates to make the code more readable.
Checkpatch cleanups and other misc cleanups. David Binder (3): staging: unisys: visornic: Fix up existing function comments. staging: unisys: visornic: Fix miscellaneous block comment format issues. staging: unisys: visornic: Remove unnecessary return values David Kershner (21): staging: unisys: use the kernel min define staging: unisys: visorbus: Clean up vmcall address function. staging: unisys: visorbus: Fix parameter alignment. staging: unisys: visorbus: Convert macros to functions. staging: unisys: visorbus: Use __func__ instead of name. staging: unisys: Don't check for null before getting driver device. staging: unisys: include: Add comment next to mutex. staging: unisys: visorbus: Consolidate controlvm channel creation. staging: unisys: visorbus: Remove useless comment. staging: unisys: visorbus: Remove useless initialization. staging: unisys: visorbus: Remove check for valid parm_addr. staging: unisys: visorbus: Split else if blocks into multiple if. staging: unisys: Change data to point to visor_controlvm_parameters_header. staging: unisys: visorbus: Remove useless else clause in visorutil_spar_detect. staging: unisys: visorbus: remove uneeded initializations staging: unisys: visorbus: Move parser functions location in file. staging: unisys: visorchipset: Shorten parser_init_byte_stream. staging: unisys: visorbus: use all 80 characters for multi-line messages staging: unisys: Use size of channel defined in the channel. staging: unisys: visorbus: just check for GUID staging: unisys: visorbus: Fix up GUID definition Sameer Wadgaonkar (4): staging: unisys: visorbus: visorchipset.c: Fix bug in parser_init_byte_stream. staging: unisys: visorbus: visorbus_main.c: Fix return values for checks in visorbus_register_visor_driver. staging: unisys: visorbus: remove EXPORT_SYMBOL_GPL for visor_check_channel staging: unisys: change pr_err to dev_err in visor_check_channel drivers/staging/unisys/include/iochannel.h | 3 +- drivers/staging/unisys/include/visorbus.h | 16 +- drivers/staging/unisys/visorbus/visorbus_main.c| 54 +- drivers/staging/unisys/visorbus/visorbus_private.h | 10 +- drivers/staging/unisys/visorbus/visorchannel.c | 81 +-- drivers/staging/unisys/visorbus/visorchipset.c | 261 +++- drivers/staging/unisys/visornic/visornic_main.c| 451 ++ 7 files changed, 386 insertions(+), 490 deletions(-) base-commit: 423a8a6eac2432a50e7ca4e4342a41ad3cf951e7 -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/28] staging: unisys: visorbus: Clean up vmcall address function.
The function vmcall address needed to be cleaned up. The structure vmcall_controlvm_addr was not needed so it was removed and was replaced with vmcall_io_controlvm_addr_params since it needs to be allocated on the heap for DMA access. With the structure removed and the fields as local variables, it helped clean up the formatting of the function. Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 27 +++ 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index e296df7..7423c9e 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -86,12 +86,6 @@ struct vmcall_io_controlvm_addr_params { u8 unused[4]; } __packed; -struct vmcall_controlvm_addr { - struct vmcall_io_controlvm_addr_params params; - int err; - u64 physaddr; -}; - struct visorchipset_device { struct acpi_device *acpi_device; unsigned long poll_jiffies; @@ -109,7 +103,7 @@ struct visorchipset_device { */ struct controlvm_message controlvm_pending_msg; bool controlvm_pending_msg_valid; - struct vmcall_controlvm_addr controlvm_addr; + struct vmcall_io_controlvm_addr_params controlvm_params; }; static struct visorchipset_device *chipset_dev; @@ -1341,15 +1335,16 @@ static int unisys_vmcall(unsigned long tuple, unsigned long param) static unsigned int issue_vmcall_io_controlvm_addr(u64 *control_addr, u32 *control_bytes) { - chipset_dev->controlvm_addr.physaddr = virt_to_phys( - &chipset_dev->controlvm_addr.params); - chipset_dev->controlvm_addr.err = unisys_vmcall(VMCALL_CONTROLVM_ADDR, - chipset_dev->controlvm_addr.physaddr); - if (chipset_dev->controlvm_addr.err) - return chipset_dev->controlvm_addr.err; - - *control_addr = chipset_dev->controlvm_addr.params.address; - *control_bytes = chipset_dev->controlvm_addr.params.channel_bytes; + u64 physaddr; + int err; + + physaddr = virt_to_phys(&chipset_dev->controlvm_params); + err = unisys_vmcall(VMCALL_CONTROLVM_ADDR, physaddr); + if (err) + return err; + + *control_addr = chipset_dev->controlvm_params.address; + *control_bytes = chipset_dev->controlvm_params.channel_bytes; return 0; } -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/28] staging: unisys: visorbus: visorbus_main.c: Fix return values for checks in visorbus_register_visor_driver.
From: Sameer Wadgaonkar The error return values for the drv->probe, drv->remove, drv->pause and drv->resume checks should be -EINVAL instead of -ENODEV. Reported-by: Greg Kroah-Hartman Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index d9b0a8b..05b632e 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -969,16 +969,16 @@ int visorbus_register_visor_driver(struct visor_driver *drv) return -ENODEV; if (!drv->probe) - return -ENODEV; + return -EINVAL; if (!drv->remove) - return -ENODEV; + return -EINVAL; if (!drv->pause) - return -ENODEV; + return -EINVAL; if (!drv->resume) - return -ENODEV; + return -EINVAL; drv->driver.name = drv->name; drv->driver.bus = &visorbus_type; -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/28] staging: unisys: visorbus: visorchipset.c: Fix bug in parser_init_byte_stream.
From: Sameer Wadgaonkar This patch fixes a bug in the function parser_init_byte_stream() by removing the call to parser_done from goto err_finish_ctx. The function parser_done() decrements chipset_dev->controlvm_payload_bytes_buffered which is not incremented before this gets called. Signed-off-by: Sameer Wadgaonkar Reported-by: Dan Carpenter Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 25a30a4..e296df7 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -1505,7 +1505,7 @@ static struct parser_context *parser_init_byte_stream(u64 addr, u32 bytes, return ctx; err_finish_ctx: - parser_done(ctx); + kfree(ctx); return NULL; } -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/28] staging: unisys: use the kernel min define
The kernel already provides a min function, we should be using that instead of creating our own MINNUM. Reviewed-by: Sameer Wadgaonkar Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/include/iochannel.h | 3 --- drivers/staging/unisys/visornic/visornic_main.c | 9 - 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h index 9562947..a70760f 100644 --- a/drivers/staging/unisys/include/iochannel.h +++ b/drivers/staging/unisys/include/iochannel.h @@ -61,9 +61,6 @@ * IO Partition is defined below. */ -/* Defines and enums. */ -#define MINNUM(a, b) (((a) < (b)) ? (a) : (b)) - /* * Define the two queues per data channel between iopart and ioguestparts. * IOCHAN_TO_IOPART -- used by guest to 'insert' signals to iopart. diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 3db4148..0c29d53 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -198,12 +198,11 @@ struct visornic_devdata { }; /* Returns next non-zero index on success or 0 on failure (i.e. out of room). */ -static u16 add_physinfo_entries(u64 inp_pfn, u16 inp_off, u32 inp_len, +static u16 add_physinfo_entries(u64 inp_pfn, u16 inp_off, u16 inp_len, u16 index, u16 max_pi_arr_entries, struct phys_info pi_arr[]) { - u32 len; - u16 i, firstlen; + u16 i, len, firstlen; firstlen = PI_PAGE_SIZE - inp_off; if (inp_len <= firstlen) { @@ -227,8 +226,8 @@ static u16 add_physinfo_entries(u64 inp_pfn, u16 inp_off, u32 inp_len, pi_arr[index].pi_len = firstlen; } else { pi_arr[index + i].pi_off = 0; - pi_arr[index + i].pi_len = - (u16)MINNUM(len, (u32)PI_PAGE_SIZE); + pi_arr[index + i].pi_len = min_t(u16, len, +PI_PAGE_SIZE); } } return index + i; -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 33/46] staging: unisys: reference bus_no and dev_no directly
Don't store it in a local variable but reference it from the visor_device. Reviewed-by: Sameer Wadgaonkar Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorchipset.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 98ce796..83fcf6f 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -571,8 +571,6 @@ static int device_changestate_responder( struct visor_segment_state response_state) { struct controlvm_message outmsg; - u32 bus_no = p->chipset_bus_no; - u32 dev_no = p->chipset_dev_no; if (!p->pending_msg_hdr) return -EIO; @@ -581,8 +579,8 @@ static int device_changestate_responder( controlvm_init_response(&outmsg, p->pending_msg_hdr, response); - outmsg.cmd.device_change_state.bus_no = bus_no; - outmsg.cmd.device_change_state.dev_no = dev_no; + outmsg.cmd.device_change_state.bus_no = p->chipset_bus_no; + outmsg.cmd.device_change_state.dev_no = p->chipset_dev_no; outmsg.cmd.device_change_state.state = response_state; return visorchannel_signalinsert(chipset_dev->controlvm_channel, -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 44/46] staging: unisys: visorbus: Get rid of passthrough function visorchipset_device_create
From: Sameer Wadgaonkar The function visorchipset_device_create just called create_visor_device, we can just combine it with create_visor_device. Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c| 18 ++- drivers/staging/unisys/visorbus/visorbus_private.h | 2 +- drivers/staging/unisys/visorbus/visorchipset.c | 4 +-- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index a3fde23..1c037a3 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -658,7 +658,7 @@ EXPORT_SYMBOL_GPL(visorbus_disable_channel_interrupts); * Return: 0 if successful, otherwise the negative value returned by * device_add() indicating the reason for failure */ -static int create_visor_device(struct visor_device *dev) +int create_visor_device(struct visor_device *dev) { int err; u32 chipset_bus_no = dev->chipset_bus_no; @@ -705,6 +705,8 @@ static int create_visor_device(struct visor_device *dev) goto err_put; list_add_tail(&dev->list_all, &list_all_device_instances); + dev->state.created = 1; + visorbus_response(dev, err, CONTROLVM_DEVICE_CREATE); /* success: reference kept via unmatched get_device() */ return 0; @@ -1117,20 +1119,6 @@ static void remove_all_visor_devices(void) } } -int visorchipset_device_create(struct visor_device *dev_info) -{ - int err; - - err = create_visor_device(dev_info); - if (err < 0) - return err; - - visorbus_response(dev_info, err, CONTROLVM_DEVICE_CREATE); - dev_info->state.created = 1; - - return 0; -} - void visorchipset_device_destroy(struct visor_device *dev_info) { remove_visor_device(dev_info); diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h index 929e09b..56c38d5 100644 --- a/drivers/staging/unisys/visorbus/visorbus_private.h +++ b/drivers/staging/unisys/visorbus/visorbus_private.h @@ -25,7 +25,7 @@ int visorbus_create_instance(struct visor_device *dev); void visorbus_remove_instance(struct visor_device *bus_info); -int visorchipset_device_create(struct visor_device *dev_info); +int create_visor_device(struct visor_device *dev_info); void visorchipset_device_destroy(struct visor_device *dev_info); int visorchipset_device_pause(struct visor_device *dev_info); int visorchipset_device_resume(struct visor_device *dev_info); diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index a478533..153c7e5 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -833,8 +833,8 @@ static int visorbus_device_create(struct controlvm_message *inmsg) sizeof(struct controlvm_message_header)); dev_info->pending_msg_hdr = pmsg_hdr; } - /* visorchipset_device_create will send response */ - err = visorchipset_device_create(dev_info); + /* create_visor_device will send response */ + err = create_visor_device(dev_info); if (err) goto err_destroy_visorchannel; -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 43/46] staging: unisys: visorbus: Get rid of passthrough function visorchipset_bus_destroy
From: Sameer Wadgaonkar The function visorchipset_bus_destroy just called viosrbus_remove_instance, we can just combine it with visorbus_remove_instance. Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c| 9 ++--- drivers/staging/unisys/visorbus/visorbus_private.h | 2 +- drivers/staging/unisys/visorbus/visorchipset.c | 4 ++-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 6dad259..a3fde23 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -1085,7 +1085,7 @@ int visorbus_create_instance(struct visor_device *dev) * visorbus_remove_instance() - remove a device instance for the visorbus itself * @dev: struct visor_device indentifying the bus to remove */ -static void visorbus_remove_instance(struct visor_device *dev) +void visorbus_remove_instance(struct visor_device *dev) { /* * Note that this will result in the release method for @@ -1099,6 +1099,7 @@ static void visorbus_remove_instance(struct visor_device *dev) kfree(dev->vbus_hdr_info); list_del(&dev->list_all); device_unregister(&dev->device); + visorbus_response(dev, 0, CONTROLVM_BUS_DESTROY); } /* @@ -1116,12 +1117,6 @@ static void remove_all_visor_devices(void) } } -void visorchipset_bus_destroy(struct visor_device *dev) -{ - visorbus_remove_instance(dev); - visorbus_response(dev, 0, CONTROLVM_BUS_DESTROY); -} - int visorchipset_device_create(struct visor_device *dev_info) { int err; diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h index 55ce5c7..929e09b 100644 --- a/drivers/staging/unisys/visorbus/visorbus_private.h +++ b/drivers/staging/unisys/visorbus/visorbus_private.h @@ -24,7 +24,7 @@ #include "visorbus.h" int visorbus_create_instance(struct visor_device *dev); -void visorchipset_bus_destroy(struct visor_device *bus_info); +void visorbus_remove_instance(struct visor_device *bus_info); int visorchipset_device_create(struct visor_device *dev_info); void visorchipset_device_destroy(struct visor_device *dev_info); int visorchipset_device_pause(struct visor_device *dev_info); diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 1cedb3b..a478533 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -700,8 +700,8 @@ static int visorbus_destroy(struct controlvm_message *inmsg) bus_info->pending_msg_hdr = pmsg_hdr; } - /* Response will be handled by visorchipset_bus_destroy */ - visorchipset_bus_destroy(bus_info); + /* Response will be handled by visorbus_remove_instance */ + visorbus_remove_instance(bus_info); return 0; err_respond: -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 42/46] staging: unisys: include: iochannel.h: Add proper copyright statement
From: David Binder Adds the proper Unisys copyright statement to the top of iochannel.h. Signed-off-by: David Binder Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/include/iochannel.h | 18 -- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h index 045e45c..a70760f 100644 --- a/drivers/staging/unisys/include/iochannel.h +++ b/drivers/staging/unisys/include/iochannel.h @@ -1,5 +1,19 @@ -/* Copyright (C) 2010 - 2016 UNISYS CORPORATION */ -/* All rights reserved. */ +/* + * Copyright (C) 2010 - 2016 UNISYS CORPORATION + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or + * NON INFRINGEMENT. See the GNU General Public License for more + * details. + */ + #ifndef __IOCHANNEL_H__ #define __IOCHANNEL_H__ -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 46/46] staging: unisys: use ATTRIBUTE_GROUPS instead of creating our own
Greg noticed that we were creating our own attribute groups, instead of using the ATTRIBUTE_GROUPS macro, this patch fixes our mistake. Reported-by: Greg Kroah-Hartman Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c | 33 ++ 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 38f07b0..d9b0a8b 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -51,15 +51,7 @@ static struct attribute *visorbus_dev_attrs[] = { NULL, }; -/* sysfs example for bridge-only sysfs files using device_type's */ -static const struct attribute_group visorbus_dev_group = { - .attrs = visorbus_dev_attrs, -}; - -static const struct attribute_group *visorbus_dev_groups[] = { - &visorbus_dev_group, - NULL, -}; +ATTRIBUTE_GROUPS(visorbus_dev); /* filled in with info about parent chipset driver when we register with it */ static struct visor_vbus_deviceinfo chipset_driverinfo; @@ -292,15 +284,7 @@ static struct attribute *channel_attrs[] = { NULL }; -static const struct attribute_group channel_attr_grp = { - .name = "channel", - .attrs = channel_attrs, -}; - -static const struct attribute_group *visorbus_channel_groups[] = { - &channel_attr_grp, - NULL -}; +ATTRIBUTE_GROUPS(channel); /* end implementation of specific channel attributes */ @@ -379,7 +363,7 @@ static ssize_t channel_id_show(struct device *dev, } static DEVICE_ATTR_RO(channel_id); -static struct attribute *dev_attrs[] = { +static struct attribute *visorbus_attrs[] = { &dev_attr_partition_handle.attr, &dev_attr_partition_guid.attr, &dev_attr_partition_name.attr, @@ -389,14 +373,7 @@ static struct attribute *dev_attrs[] = { NULL }; -static const struct attribute_group dev_attr_grp = { - .attrs = dev_attrs, -}; - -static const struct attribute_group *visorbus_groups[] = { - &dev_attr_grp, - NULL -}; +ATTRIBUTE_GROUPS(visorbus); /* * BUS debugfs entries @@ -666,7 +643,7 @@ int create_visor_device(struct visor_device *dev) mutex_init(&dev->visordriver_callback_lock); dev->device.bus = &visorbus_type; - dev->device.groups = visorbus_channel_groups; + dev->device.groups = channel_groups; device_initialize(&dev->device); dev->device.release = visorbus_release_device; /* keep a reference just for us (now 2) */ -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 41/46] staging: unisys: visorinput: ultrainputreport.h: Adjust comment formatting
From: David Binder The first line of the top file comment should begin on the line following the block comment opening, thereby following the convention used elsewhere in the driver set. Signed-off-by: David Binder Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorinput/ultrainputreport.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorinput/ultrainputreport.h b/drivers/staging/unisys/visorinput/ultrainputreport.h index 3ffad83..53975a0 100644 --- a/drivers/staging/unisys/visorinput/ultrainputreport.h +++ b/drivers/staging/unisys/visorinput/ultrainputreport.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2010 - 2015 UNISYS CORPORATION +/* + * Copyright (C) 2010 - 2015 UNISYS CORPORATION * All rights reserved. * * This program is free software; you can redistribute it and/or modify it -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 45/46] staging: unisys: visorbus: Get rid of passthrough function visorchipset_device_destroy
From: Sameer Wadgaonkar The function visorchipset_device_destroy just called remove_visor_device, we can just combine it with remove_visor_device. Signed-off-by: Sameer Wadgaonkar Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorbus/visorbus_main.c| 9 ++--- drivers/staging/unisys/visorbus/visorbus_private.h | 2 +- drivers/staging/unisys/visorbus/visorchipset.c | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 1c037a3..38f07b0 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -716,11 +716,12 @@ int create_visor_device(struct visor_device *dev) return err; } -static void remove_visor_device(struct visor_device *dev) +void remove_visor_device(struct visor_device *dev) { list_del(&dev->list_all); put_device(&dev->device); device_unregister(&dev->device); + visorbus_response(dev, 0, CONTROLVM_DEVICE_DESTROY); } static int get_vbus_header_info(struct visorchannel *chan, @@ -1119,12 +1120,6 @@ static void remove_all_visor_devices(void) } } -void visorchipset_device_destroy(struct visor_device *dev_info) -{ - remove_visor_device(dev_info); - visorbus_response(dev_info, 0, CONTROLVM_DEVICE_DESTROY); -} - /* * pause_state_change_complete() - the callback function to be called by a * visorbus function driver when a diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h index 56c38d5..8651c87 100644 --- a/drivers/staging/unisys/visorbus/visorbus_private.h +++ b/drivers/staging/unisys/visorbus/visorbus_private.h @@ -26,7 +26,7 @@ int visorbus_create_instance(struct visor_device *dev); void visorbus_remove_instance(struct visor_device *bus_info); int create_visor_device(struct visor_device *dev_info); -void visorchipset_device_destroy(struct visor_device *dev_info); +void remove_visor_device(struct visor_device *dev_info); int visorchipset_device_pause(struct visor_device *dev_info); int visorchipset_device_resume(struct visor_device *dev_info); diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 153c7e5..25a30a4 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -948,7 +948,7 @@ static int visorbus_device_destroy(struct controlvm_message *inmsg) } kfree(dev_info->name); - visorchipset_device_destroy(dev_info); + remove_visor_device(dev_info); return 0; err_respond: -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 39/46] staging: unisys: include: visorbus.h: Remove filename in top comment
From: David Binder Removes unnecessary filename in the top file comment. Signed-off-by: David Binder Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/include/visorbus.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h index 4af2f99..e97bb5f 100644 --- a/drivers/staging/unisys/include/visorbus.h +++ b/drivers/staging/unisys/include/visorbus.h @@ -1,6 +1,4 @@ /* - * visorbus.h - * * Copyright (C) 2010 - 2013 UNISYS CORPORATION * All rights reserved. * -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 40/46] staging: unisys: visorhba: Adjust top comment formatting
From: David Binder The first line of the top file comment should begin on the line following the block comment opening, thereby following the convention used elsewhere in the driver set. Signed-off-by: David Binder Signed-off-by: David Kershner Reviewed-by: Tim Sell --- drivers/staging/unisys/visorhba/visorhba_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c index 2f89cb0..8567e44 100644 --- a/drivers/staging/unisys/visorhba/visorhba_main.c +++ b/drivers/staging/unisys/visorhba/visorhba_main.c @@ -1,4 +1,5 @@ -/* Copyright (c) 2012 - 2015 UNISYS CORPORATION +/* + * Copyright (c) 2012 - 2015 UNISYS CORPORATION * All rights reserved. * * This program is free software; you can redistribute it and/or modify -- git-series 0.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel