On Sat, Jul 19, 2014 at 10:26:54AM -0400, Benjamin Romer wrote:
> Move the proc entry for controlling the toolaction field to sysfs. The field
> appears in /sys/devices/platform/visorchipset/install/toolaction.
>
> This field is used to tell s-Par which type of recovery tool action to perform
> on the next guest boot-up. The meaning of the value is dependent on the type
> of installation software used to commission the guest.
>
> Signed-off-by: Benjamin Romer <[email protected]>
> ---
> .../unisys/visorchipset/visorchipset_main.c | 151
> ++++++++-------------
> 1 file changed, 60 insertions(+), 91 deletions(-)
>
> diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c
> b/drivers/staging/unisys/visorchipset/visorchipset_main.c
> index a16d67e..f45e352 100644
> --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c
> +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c
> @@ -149,11 +149,6 @@ static ssize_t proc_read_installer(struct file *file,
> char __user *buf,
> static ssize_t proc_write_installer(struct file *file,
> const char __user *buffer,
> size_t count, loff_t *ppos);
> -static ssize_t proc_read_toolaction(struct file *file, char __user *buf,
> - size_t len, loff_t *offset);
> -static ssize_t proc_write_toolaction(struct file *file,
> - const char __user *buffer,
> - size_t count, loff_t *ppos);
> static ssize_t proc_read_bootToTool(struct file *file, char __user *buf,
> size_t len, loff_t *offset);
> static ssize_t proc_write_bootToTool(struct file *file,
> @@ -164,11 +159,6 @@ static const struct file_operations proc_installer_fops
> = {
> .write = proc_write_installer,
> };
>
> -static const struct file_operations proc_toolaction_fops = {
> - .read = proc_read_toolaction,
> - .write = proc_write_toolaction,
> -};
> -
> static const struct file_operations proc_bootToTool_fops = {
> .read = proc_read_bootToTool,
> .write = proc_write_bootToTool,
> @@ -321,10 +311,36 @@ static VISORCHIPSET_BUSDEV_RESPONDERS BusDev_Responders
> = {
> /* info for /dev/visorchipset */
> static dev_t MajorDev = -1; /**< indicates major num for device */
>
> +/* prototypes for attributes */
> +static ssize_t show_toolaction(struct device *dev,
> + struct device_attribute *attr, char *buf);
> +
> +static ssize_t store_toolaction(struct device *dev,
> + struct device_attribute *attr, const char *buf, size_t count);
> +
> +static DEVICE_ATTR(toolaction, S_IRUSR | S_IWUSR, show_toolaction,
> + store_toolaction);
DEVICE_ATTR_RW() please. Never use the "raw" DEVICE_ATTR() if at all
possible because it's harder to audit that you really got the
permissions properly.
> +
> +static struct attribute *visorchipset_install_attrs[] = {
> + &dev_attr_toolaction.attr,
> + NULL
> +};
> +
> +static struct attribute_group visorchipset_install_group = {
> + .name = "install",
> + .attrs = visorchipset_install_attrs
> +};
> +
> +static const struct attribute_group *visorchipset_dev_groups[] = {
> + &visorchipset_install_group,
> + NULL
> +};
> +
> /* /sys/devices/platform/visorchipset */
> static struct platform_device Visorchipset_platform_device = {
> .name = "visorchipset",
> .id = -1,
> + .dev.groups = visorchipset_dev_groups,
Only create this device when ControlVm_channel is present in the system,
that should take out your check for it in the show/store function.
Same goes for the rest of these patches.
thanks,
greg k-h
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel