From patchwork Fri Jun 26 06:38:36 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: 6678471 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 0F4FC9F399 for ; Fri, 26 Jun 2015 06:39:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2F5902070C for ; Fri, 26 Jun 2015 06:39:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2E4A5206EC for ; Fri, 26 Jun 2015 06:39:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751675AbbFZGjs (ORCPT ); Fri, 26 Jun 2015 02:39:48 -0400 Received: from g9t5008.houston.hp.com ([15.240.92.66]:50565 "EHLO g9t5008.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751878AbbFZGjs convert rfc822-to-8bit (ORCPT ); Fri, 26 Jun 2015 02:39:48 -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 g9t5008.houston.hp.com (Postfix) with ESMTPS id A980BD1; Fri, 26 Jun 2015 06:39:47 +0000 (UTC) Received: from G9W3616.americas.hpqcorp.net (16.216.186.51) by G9W0364.americas.hpqcorp.net (16.216.193.45) with Microsoft SMTP Server (TLS) id 14.3.169.1; Fri, 26 Jun 2015 06:38:37 +0000 Received: from G4W3219.americas.hpqcorp.net ([169.254.8.188]) by G9W3616.americas.hpqcorp.net ([16.216.186.51]) with mapi id 14.03.0169.001; Fri, 26 Jun 2015 06:38:37 +0000 From: "Seymour, Shane M" To: "linux-scsi@vger.kernel.org" , "James Bottomley (JBottomley@Odin.com)" Subject: [PATCH] scsi_dh: convert __ATTR macro to DEVICE_ATTR_RW and snprintf show method cleanup Thread-Topic: [PATCH] scsi_dh: convert __ATTR macro to DEVICE_ATTR_RW and snprintf show method cleanup Thread-Index: AdCv2loo7RlCIYeOSJWLlbiSsvkkuQ== Date: Fri, 26 Jun 2015 06:38:36 +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 Reviewed-by: Hannes Reinecke --- -- 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;