From patchwork Wed Jun 24 06:10:27 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: 6665811 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 132FEC05AC for ; Wed, 24 Jun 2015 06:11:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 330FE205B7 for ; Wed, 24 Jun 2015 06:11:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 23DA6205B9 for ; Wed, 24 Jun 2015 06:11:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751171AbbFXGLf (ORCPT ); Wed, 24 Jun 2015 02:11:35 -0400 Received: from g4t3425.houston.hp.com ([15.201.208.53]:52979 "EHLO g4t3425.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750876AbbFXGLe convert rfc822-to-8bit (ORCPT ); Wed, 24 Jun 2015 02:11:34 -0400 Received: from G4W6310.americas.hpqcorp.net (g4w6310.houston.hp.com [16.210.26.217]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by g4t3425.houston.hp.com (Postfix) with ESMTPS id 75F1DBE; Wed, 24 Jun 2015 06:11:33 +0000 (UTC) Received: from G9W3614.americas.hpqcorp.net (16.216.186.49) by G4W6310.americas.hpqcorp.net (16.210.26.217) with Microsoft SMTP Server (TLS) id 14.3.169.1; Wed, 24 Jun 2015 06:10:28 +0000 Received: from G4W3219.americas.hpqcorp.net ([169.254.8.188]) by G9W3614.americas.hpqcorp.net ([16.216.186.49]) with mapi id 14.03.0169.001; Wed, 24 Jun 2015 06:10:27 +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] st: convert DRIVER_ATTR macros to DRIVER_ATTR_RO Thread-Topic: [PATCH] st: convert DRIVER_ATTR macros to DRIVER_ATTR_RO Thread-Index: AdCuRGNoW1UT9PhfRjGI016N1XxHWg== Date: Wed, 24 Jun 2015 06:10:27 +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. Resending with [PATCH] at the front since I forgot to add it. -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- 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,