From patchwork Fri Jun 26 06:28:04 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: 6678451 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 1F068C05AC for ; Fri, 26 Jun 2015 06:29:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 21DF4206E8 for ; Fri, 26 Jun 2015 06:29:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0666B205DE for ; Fri, 26 Jun 2015 06:29:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751800AbbFZG3S (ORCPT ); Fri, 26 Jun 2015 02:29:18 -0400 Received: from g4t3426.houston.hp.com ([15.201.208.54]:34805 "EHLO g4t3426.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750729AbbFZG3R convert rfc822-to-8bit (ORCPT ); Fri, 26 Jun 2015 02:29:17 -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 g4t3426.houston.hp.com (Postfix) with ESMTPS id A2270248; Fri, 26 Jun 2015 06:29:16 +0000 (UTC) Received: from G4W6302.americas.hpqcorp.net (16.210.26.227) by G9W0364.americas.hpqcorp.net (16.216.193.45) with Microsoft SMTP Server (TLS) id 14.3.169.1; Fri, 26 Jun 2015 06:28:05 +0000 Received: from G4W3219.americas.hpqcorp.net ([169.254.8.188]) by G4W6302.americas.hpqcorp.net ([16.210.26.227]) with mapi id 14.03.0169.001; Fri, 26 Jun 2015 06:28:05 +0000 From: "Seymour, Shane M" To: "linux-scsi@vger.kernel.org" , "James Bottomley (JBottomley@Odin.com)" Subject: scsi_dh: convert __ATTR macro to DEVICE_ATTR_RW and snprintf show method cleanup Thread-Topic: scsi_dh: convert __ATTR macro to DEVICE_ATTR_RW and snprintf show method cleanup Thread-Index: AdCv0yaf1jDo1+M0Qw2Eh5Syd7Jd+Q== Date: Fri, 26 Jun 2015 06:28:04 +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.34] 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 Converted dh_state to use DEVICE_ATTR_RW macro instead of __ATTR. That forced a change to the associated show/store function names and the name of the attribute. Changed usage of snprintf in show function to scnprintf per Documentation/filesystems/sysfs.txt. Signed-off-by: Shane Seymour --- -- 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/device_handler/scsi_dh.c 2015-06-25 15:52:15.616031320 -0500 +++ b/drivers/scsi/device_handler/scsi_dh.c 2015-06-25 18:10:54.246839220 -0500 @@ -174,7 +174,7 @@ static void scsi_dh_handler_detach(struc * Functions for sysfs attribute 'dh_state' */ static ssize_t -store_dh_state(struct device *dev, struct device_attribute *attr, +dh_state_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct scsi_device *sdev = to_scsi_device(dev); @@ -215,19 +215,17 @@ store_dh_state(struct device *dev, struc } static ssize_t -show_dh_state(struct device *dev, struct device_attribute *attr, char *buf) +dh_state_show(struct device *dev, struct device_attribute *attr, char *buf) { struct scsi_device *sdev = to_scsi_device(dev); if (!sdev->scsi_dh_data) - return snprintf(buf, 20, "detached\n"); + return scnprintf(buf, 20, "detached\n"); - return snprintf(buf, 20, "%s\n", sdev->scsi_dh_data->scsi_dh->name); + return scnprintf(buf, 20, "%s\n", sdev->scsi_dh_data->scsi_dh->name); } -static struct device_attribute scsi_dh_state_attr = - __ATTR(dh_state, S_IRUGO | S_IWUSR, show_dh_state, - store_dh_state); +static DEVICE_ATTR_RW(dh_state); /* * scsi_dh_sysfs_attr_add - Callback for scsi_init_dh @@ -243,7 +241,7 @@ static int scsi_dh_sysfs_attr_add(struct sdev = to_scsi_device(dev); err = device_create_file(&sdev->sdev_gendev, - &scsi_dh_state_attr); + &dev_attr_dh_state); return 0; } @@ -261,7 +259,7 @@ static int scsi_dh_sysfs_attr_remove(str sdev = to_scsi_device(dev); device_remove_file(&sdev->sdev_gendev, - &scsi_dh_state_attr); + &dev_attr_dh_state); return 0; } @@ -283,13 +281,13 @@ static int scsi_dh_notifier(struct notif sdev = to_scsi_device(dev); if (action == BUS_NOTIFY_ADD_DEVICE) { - err = device_create_file(dev, &scsi_dh_state_attr); + err = device_create_file(dev, &dev_attr_dh_state); /* don't care about err */ devinfo = device_handler_match(NULL, sdev); if (devinfo) err = scsi_dh_handler_attach(sdev, devinfo); } else if (action == BUS_NOTIFY_DEL_DEVICE) { - device_remove_file(dev, &scsi_dh_state_attr); + device_remove_file(dev, &dev_attr_dh_state); scsi_dh_handler_detach(sdev, NULL); } return err;