Received: by 10.223.176.5 with SMTP id f5csp2990055wra; Thu, 1 Feb 2018 09:04:22 -0800 (PST) X-Google-Smtp-Source: AH8x227fFKs+Qn9IrY7ZyvzOlKNLeHJxyLcc5rmSqJw+vLbcrr+/pCwDscAAxV9s5DAlktJVMeOh X-Received: by 2002:a17:902:9003:: with SMTP id a3-v6mr32562458plp.338.1517504662791; Thu, 01 Feb 2018 09:04:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517504662; cv=none; d=google.com; s=arc-20160816; b=oGu2KT7i+0xf6ZXyzuyuoWenF9g2n3GtqZRTcNJUANQw+6071X1KWf/TyWIUEQftOy uhitIrwYCrJJkarCHmPW8PVRkHLZ9DJLtNrqxSPb1fpnilLnoo74RF6i4Yd743aAuO3b ucWE61jG8TvnqE+4hn+7KQzFPkiBIHLrMTCSKK6sfIw6XqY5AJ7Ig0WXEanAkWS1MNYY 1t2NqcJgyiAQv9lOS7JYeifvlO4bGsN3CYOt9jpuOf1DJ/5n+IaoaKgq5Ep5oYW2CZFl bdeqkWDQvxLKaa4GO0pgerSW/7BZLBe7vh/7SAUQ8YLNvuVBxCsyJipnhbpsDTRXBsLK 12rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=EIZIGI2QCMbrm7yWPRvzYv2oUl8Doap80a5N/B9iaa4=; b=kPWVGrDYa93Fvdc7Lcf4UX0/i3wWCWW1xkZ8o+xT+YRNaXCJPOMPpcmfv52KE9Fy09 hr0shBfas0l+9zEhALUFv/UPOO3p5V/2eaG0N3Pu2oKpGy0uQEkEdXiBbvWdpXzhAQWc ddURTgSUFSO2ANT6WnGgYc0m5oTkc8O7ICjUhf9YyXWcarP6QGICuV3ly9oOf4SxXD+i nKaJhGlfTUTzkTA8SGHpbG8+lC2FKKiwjNzikumT5Zi0AGCLy4/s4c7j9OZ6965dpoo/ ofnDCJHGxfcTOYmRjPFprol319zuwzlspMTtM94uNV6LQCN+u3y2jMy/V48eRN8hgkwl QLVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x124si19078pgb.437.2018.02.01.09.04.07; Thu, 01 Feb 2018 09:04:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752841AbeBARDU (ORCPT + 99 others); Thu, 1 Feb 2018 12:03:20 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:47798 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751708AbeBARDR (ORCPT ); Thu, 1 Feb 2018 12:03:17 -0500 Received: from localhost (unknown [37.169.172.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 38887DC3; Thu, 1 Feb 2018 17:03:16 +0000 (UTC) Date: Thu, 1 Feb 2018 18:03:12 +0100 From: Greg KH To: Stanislav Nijnikov Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, jaegeuk@kernel.org, alex.lemberg@wdc.com Subject: Re: [PATCH v4 10/10] ufs: sysfs: attributes Message-ID: <20180201170312.GD12838@kroah.com> References: <1517501746-19075-1-git-send-email-stanislav.nijnikov@wdc.com> <1517501746-19075-11-git-send-email-stanislav.nijnikov@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1517501746-19075-11-git-send-email-stanislav.nijnikov@wdc.com> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 01, 2018 at 06:15:46PM +0200, Stanislav Nijnikov wrote: > +#define UFS_LUN_ATTRIBUTE(_name, _uname) \ > +static ssize_t _name##_attribute_show(struct device *dev, \ > + struct device_attribute *attr, char *buf) \ > +{ \ > + u32 value; \ > + struct scsi_device *sdev = to_scsi_device(dev); \ > + struct ufs_hba *hba = shost_priv(sdev->host); \ > + u8 lun = ufshcd_scsi_to_upiu_lun(sdev->lun); \ > + if (ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR, \ > + QUERY_ATTR_IDN##_uname, lun, 0, &value)) \ > + return -EINVAL; \ > + return sprintf(buf, "0x%08X\n", value); \ > +} \ > +static DEVICE_ATTR_RO(_name##_attribute) > + > +UFS_LUN_ATTRIBUTE(dyn_cap_needed, _DYN_CAP_NEEDED); Why create a macro when you only have one instance of its use? thanks, greg k-h