From patchwork Wed Jun 24 06:54:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Seymour, Shane M" X-Patchwork-Id: 6666031 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DBCB6C05AC for ; Wed, 24 Jun 2015 06:56:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0012E2053C for ; Wed, 24 Jun 2015 06:56:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA3662053B for ; Wed, 24 Jun 2015 06:55:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750822AbbFXGz6 (ORCPT ); Wed, 24 Jun 2015 02:55:58 -0400 Received: from g9t5009.houston.hp.com ([15.240.92.67]:39893 "EHLO g9t5009.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750786AbbFXGz5 convert rfc822-to-8bit (ORCPT ); Wed, 24 Jun 2015 02:55:57 -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 25663220; Wed, 24 Jun 2015 06:55:57 +0000 (UTC) Received: from G9W3613.americas.hpqcorp.net (16.216.186.48) by G9W0364.americas.hpqcorp.net (16.216.193.45) with Microsoft SMTP Server (TLS) id 14.3.169.1; Wed, 24 Jun 2015 06:54:35 +0000 Received: from G4W3219.americas.hpqcorp.net ([169.254.8.188]) by G9W3613.americas.hpqcorp.net ([16.216.186.48]) with mapi id 14.03.0169.001; Wed, 24 Jun 2015 06:54:35 +0000 From: "Seymour, Shane M" To: "linux-scsi@vger.kernel.org" , "Greg KH (gregkh@linuxfoundation.org)" CC: "linux-api@vger.kernel.org" , "Kai.Makisara@kolumbus.fi" Subject: [PATCH v2] st: convert DRIVER_ATTR macros to DRIVER_ATTR_RO Thread-Topic: [PATCH v2] st: convert DRIVER_ATTR macros to DRIVER_ATTR_RO Thread-Index: AdCuSVRFDY3QqQOyQAClMR9WmmgcQw== Date: Wed, 24 Jun 2015 06:54:35 +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 requested by Greg KH. Also switched to using scnprintf instead of snprintf per Documentation/filesystems/sysfs.txt. Suggested-by: Greg Kroah-Hartman Signed-off-by: Shane Seymour Reviewed-by: Hannes Reinecke Acked-by: Greg Kroah-Hartman Acked-by: Kai Mäkisara --- 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. -- 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 19:59:21.302775649 -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 scnprintf(buf, PAGE_SIZE, "%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 scnprintf(buf, PAGE_SIZE, "%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 scnprintf(buf, PAGE_SIZE, "%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 scnprintf(buf, PAGE_SIZE, "[%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,