Re: [PATCH 4/4] staging: unisys: added virthba enable_ints entry

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 21, 2014 at 02:47:45PM -0400, Erik Arfvidson wrote:
> This patch adds enable_ints entry to virthba directory
> 
> Signed-off-by: Erik Arfvidson <erik.arfvidson@xxxxxxxxxx>
> Signed-off-by: Benjamin Romer <benjamin.romer@xxxxxxxxxx>
> ---
>  drivers/staging/unisys/virthba/virthba.c | 63 ++++++++++++++++++++++++++++++++
>  1 file changed, 63 insertions(+)
> 
> diff --git a/drivers/staging/unisys/virthba/virthba.c b/drivers/staging/unisys/virthba/virthba.c
> index 857de11..65a75c8 100644
> --- a/drivers/staging/unisys/virthba/virthba.c
> +++ b/drivers/staging/unisys/virthba/virthba.c
> @@ -112,6 +112,8 @@ static void doDiskAddRemove(struct work_struct *work);
>  static void virthba_serverdown_complete(struct work_struct *work);
>  static ssize_t info_debugfs_read(struct file *file, char __user *buf,
>  			size_t len, loff_t *offset);
> +static ssize_t enable_ints_write(struct file *file,
> +			const char __user *buffer, size_t count, loff_t *ppos);
>  
>  /*****************************************************/
>  /* Globals                                           */
> @@ -233,6 +235,10 @@ static const struct file_operations debugfs_info_fops = {
>  	.read = info_debugfs_read,
>  };
>  
> +static const struct file_operations debugfs_enable_ints_fops = {
> +	.write = enable_ints_write,
> +};
> +
>  /*****************************************************/
>  /* Structs                                           */
>  /*****************************************************/
> @@ -1415,6 +1421,60 @@ static ssize_t info_debugfs_read(struct file *file,
>  	return bytes_read;
>  }
>  
> +static ssize_t enable_ints_write(struct file *file,
> +			const char __user *buffer, size_t count, loff_t *ppos)
> +{
> +	char buf[4];
> +	int i, new_value;
> +	struct virthba_info *virthbainfo;
> +
> +	U64 __iomem *Features_addr;
> +	U64 mask;
> +
> +	if (count >= ARRAY_SIZE(buf))
> +		return -EINVAL;
> +
> +	buf[count] = '\0';
> +	if (copy_from_user(buf, buffer, count)) {
> +		LOGERR("copy_from_user failed. buf<<%.*s>> count<<%lu>>\n",
> +		       (int) count, buf, count);
> +		return -EFAULT;
> +	}
> +
> +	i = kstrtoint(buf, 10 , &new_value);
> +
> +	if (i != 0) {
> +		LOGERR("Failed to scan value for enable_ints, buf<<%.*s>>",
> +		       (int) count, buf);
> +		return -EFAULT;

Careful with allowing userspace to flood the log :(

> +	}
> +
> +	/*set all counts to new_value usually 0*/

We don't have a lack of ' ' characters available to us, please use
them...


thanks,

greg k-h
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux