Re: [PATCH] st: convert DRIVER_ATTR macros to DRIVER_ATTR_RO
On Wed, Jun 24, 2015 at 03:25:57PM +0900, Sergey Senozhatsky wrote: On (06/24/15 06:10), Seymour, Shane M wrote: [..] /* The sysfs driver interface. Read-only at the moment */ -static ssize_t st_try_direct_io_show(struct device_driver *ddp, char *buf) +static ssize_t try_direct_io_show(struct device_driver *ddp, char *buf) { - return snprintf(buf, PAGE_SIZE, %d\n, try_direct_io); + return sprintf(buf, %d\n, try_direct_io); } a nitpick, per Documentation/filesystems/sysfs.txt : : - show() should always use scnprintf(). : Don't believe everything you read, this change is just fine. But, you are doing something here that you did not say you were doing in the changelog, so for that reason, the patch should be redone. thanks, greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] st: convert DRIVER_ATTR macros to DRIVER_ATTR_RO
On Wed, Jun 24, 2015 at 03:25:57PM +0900, Sergey Senozhatsky wrote: On (06/24/15 06:10), Seymour, Shane M wrote: [..] /* The sysfs driver interface. Read-only at the moment */ -static ssize_t st_try_direct_io_show(struct device_driver *ddp, char *buf) +static ssize_t try_direct_io_show(struct device_driver *ddp, char *buf) { - return snprintf(buf, PAGE_SIZE, %d\n, try_direct_io); + return sprintf(buf, %d\n, try_direct_io); } a nitpick, per Documentation/filesystems/sysfs.txt : : - show() should always use scnprintf(). : That should be rewritten to say, don't use snprintf(), but scnprintf(), if you want to. Otherwise sprintf() should be fine as you obviously are only returning a single value to userspace Or something like that. thanks, greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] st: convert DRIVER_ATTR macros to DRIVER_ATTR_RO
On Wed, Jun 24, 2015 at 06:54:35AM +, Seymour, Shane M wrote: Convert DRIVER_ATTR macros to DRIVER_ATTR_RO requested by Greg KH. Also switched to using scnprintf instead of snprintf per Documentation/filesystems/sysfs.txt. Suggested-by: Greg Kroah-Hartman gre...@linuxfoundation.org Signed-off-by: Shane Seymour shane.seym...@hp.com --- This patch was implemented on top of the previous patch to convert to using driver attr groups. Changes from v1: - switched to scnprintf from sprintf after feedback from Sergey Senozhatsky. Acked-by: Greg Kroah-Hartman gre...@linuxfoundation.org -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html