From patchwork Wed Jun 24 06:02:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Seymour, Shane M" X-Patchwork-Id: 6665801 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E42E19F39B for ; Wed, 24 Jun 2015 06:04:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1B17D205BA for ; Wed, 24 Jun 2015 06:04:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F048C205B7 for ; Wed, 24 Jun 2015 06:04:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750767AbbFXGD7 (ORCPT ); Wed, 24 Jun 2015 02:03:59 -0400 Received: from g9t5009.houston.hp.com ([15.240.92.67]:46084 "EHLO g9t5009.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750731AbbFXGD6 convert rfc822-to-8bit (ORCPT ); Wed, 24 Jun 2015 02:03:58 -0400 Received: from G9W0364.americas.hpqcorp.net (g9w0364.houston.hp.com [16.216.193.45]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by g9t5009.houston.hp.com (Postfix) with ESMTPS id 59AB51EE; Wed, 24 Jun 2015 06:03:57 +0000 (UTC) Received: from G9W3611.americas.hpqcorp.net (16.216.186.46) by G9W0364.americas.hpqcorp.net (16.216.193.45) with Microsoft SMTP Server (TLS) id 14.3.169.1; Wed, 24 Jun 2015 06:02:12 +0000 Received: from G4W3219.americas.hpqcorp.net ([169.254.8.188]) by G9W3611.americas.hpqcorp.net ([16.216.186.46]) with mapi id 14.03.0169.001; Wed, 24 Jun 2015 06:02:12 +0000 From: "Seymour, Shane M" To: "linux-scsi@vger.kernel.org" , "Greg KH (gregkh@linuxfoundation.org)" CC: "Kai.Makisara@kolumbus.fi" , "linux-api@vger.kernel.org" Subject: st: convert DRIVER_ATTR macros to DRIVER_ATTR_RO Thread-Topic: st: convert DRIVER_ATTR macros to DRIVER_ATTR_RO Thread-Index: AdCuQq0QF1drpAoATaCqAQDc2BhCjw== Date: Wed, 24 Jun 2015 06:02:12 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [16.210.48.16] MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Convert DRIVER_ATTR macros to DRIVER_ATTR_RO as requested by Greg KH. Also switched to using sprintf as nothing printed should exceed PAGE_SIZE - based on feedback from Greg when implementing show functions for tape stats. Suggested-by: Greg Kroah-Hartman Signed-off-by: Shane Seymour --- This patch was implemented on top of the previous patch to convert to using driver attr groups. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/scsi/st.c 2015-06-22 20:38:16.061386739 -0500 +++ b/drivers/scsi/st.c 2015-06-23 17:29:03.547867682 -0500 @@ -4427,29 +4427,29 @@ module_exit(exit_st); /* 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); } -static DRIVER_ATTR(try_direct_io, S_IRUGO, st_try_direct_io_show, NULL); +static DRIVER_ATTR_RO(try_direct_io); -static ssize_t st_fixed_buffer_size_show(struct device_driver *ddp, char *buf) +static ssize_t fixed_buffer_size_show(struct device_driver *ddp, char *buf) { - return snprintf(buf, PAGE_SIZE, "%d\n", st_fixed_buffer_size); + return sprintf(buf, "%d\n", st_fixed_buffer_size); } -static DRIVER_ATTR(fixed_buffer_size, S_IRUGO, st_fixed_buffer_size_show, NULL); +static DRIVER_ATTR_RO(fixed_buffer_size); -static ssize_t st_max_sg_segs_show(struct device_driver *ddp, char *buf) +static ssize_t max_sg_segs_show(struct device_driver *ddp, char *buf) { - return snprintf(buf, PAGE_SIZE, "%d\n", st_max_sg_segs); + return sprintf(buf, "%d\n", st_max_sg_segs); } -static DRIVER_ATTR(max_sg_segs, S_IRUGO, st_max_sg_segs_show, NULL); +static DRIVER_ATTR_RO(max_sg_segs); -static ssize_t st_version_show(struct device_driver *ddd, char *buf) +static ssize_t version_show(struct device_driver *ddd, char *buf) { - return snprintf(buf, PAGE_SIZE, "[%s]\n", verstr); + return sprintf(buf, "[%s]\n", verstr); } -static DRIVER_ATTR(version, S_IRUGO, st_version_show, NULL); +static DRIVER_ATTR_RO(version); static struct attribute *st_drv_attrs[] = { &driver_attr_try_direct_io.attr,