Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2115114rwe; Fri, 2 Sep 2022 08:43:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR7RNdkpbnOwV6pRyw7USd8E76IRHusUUs08C+4fVklWvpffYAdSO9eCo+Voo4MQQT1etoAz X-Received: by 2002:a17:902:d54c:b0:174:a3df:c1a0 with SMTP id z12-20020a170902d54c00b00174a3dfc1a0mr26832724plf.44.1662133401239; Fri, 02 Sep 2022 08:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662133401; cv=none; d=google.com; s=arc-20160816; b=lMUbclTMpnp4JLwdSifzbNNQ2iU3erM6pFTHVB6mWFqOea7QfhI6WS4SnAKNv9ejKM BNAAZABQJKaUGSXnuI+uF4aofful1ib9oaLIn08TFLc96JjY22O8AGOsj/hIcziPysBm mMGTBIyZGq4n7KDszEm25mk15F60eDIBq+Kr0r1UZi2KueT11mr4afdFIUUgdrGg+2rj r7JsgSwkFt8Xfc2v61uRjd5r4Rce2TRxLktbTqt3jZXKByTZfAGpxsxkxL5va3JFx1Fi udIC4znC994qBTCEAAcXXGUSLu0jwsJEf/wo3iirXZ71cXXbcXw7GdcFUcS4DQ/JzfAa aAow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mj0ekTWJBeYKHV1WM7Gv5BcBe8YbFcOkR+8veNMJDuU=; b=jObIj27JUurUDMcdsel/KMJT18tn/3N8TaAdYrlwJkqEmTo6Ot49OUIMEPFJX8WpuN 3FK+Nj0miAk2ltsMrZL4nzqoVbfxTkMsTmDmqkntyM8TELNyX7xqjeohl1EZWAStEuBx Zf+3l9fFyW8UzwMJQBklVykfGv79orcYCd81F9+Q0R1alMd3njSjDpiF9qAjOxWC93XL DAm6JorrCCifykbX8mehv996qj7CY65xbV1DB9S0kaU+hII7jMVL7AMScqYjRsdfaaOr xSBfWaZZQ7hPwgZSesGLaYzKXCpro/h+wbOrU+0mSos1RTsnIKbPkhLxhaDQGQIke8zo pIPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DddFvVo+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id il4-20020a17090b164400b001faf81eafdbsi2705485pjb.174.2022.09.02.08.43.09; Fri, 02 Sep 2022 08:43:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DddFvVo+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235589AbiIBP2q (ORCPT + 99 others); Fri, 2 Sep 2022 11:28:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236548AbiIBP2T (ORCPT ); Fri, 2 Sep 2022 11:28:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B44D11170 for ; Fri, 2 Sep 2022 08:02:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9262861EA0 for ; Fri, 2 Sep 2022 15:02:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81D80C433C1; Fri, 2 Sep 2022 15:02:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662130943; bh=fjq5s3JQ2Tmnv1qbYlny3IuIn2WM1CPEyrlgYcbbBxg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DddFvVo+kuaiJE65wFuxkgBXSlmKxa8DWfUzx7m4FW98w0JsWTwP8aRM0c4m5AWj2 qDJwpSrozEtkHMIDYpw1tnBTxjwfawwaQ1SDnLrR7NtApMSH/kXxN6HB3d5M5WiGLQ B2woUAnz07aV+1TbgqHGjiytZomkYxydSMYyYgzyyjuasRPPq5KRev5b74NOMM+5Ft gzMK7ujhaauTC7RLXrGb3lS3MxvHJ14xpHa87LU/nwfqM1dnbaQNCK4D3B8BR3kSOm /4wDllByVD4gpKS/0m2BjeX8AZPslrumRy+4wvq+NYj+Z9a5hh+GpCihTFa+dUuEr5 AhN0P76+LY/tg== Date: Fri, 2 Sep 2022 08:02:20 -0700 From: Nathan Chancellor To: James Clark Cc: Mathieu Poirier , Suzuki K Poulose , Mike Leach , Leo Yan , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] coresight: cti-sysfs: Mark coresight_cti_reg_store() as __maybe_unused Message-ID: References: <20220901195055.1932340-1-nathan@kernel.org> <54e034aa-4012-e6f1-c0f3-325d8fe0f4c1@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54e034aa-4012-e6f1-c0f3-325d8fe0f4c1@arm.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 02, 2022 at 02:03:07PM +0100, James Clark wrote: > > > On 01/09/2022 20:50, Nathan Chancellor wrote: > > When building without CONFIG_CORESIGHT_CTI_INTEGRATION_REGS, there is a > > warning about coresight_cti_reg_store() being unused in the file: > > > > drivers/hwtracing/coresight/coresight-cti-sysfs.c:184:16: warning: 'coresight_cti_reg_store' defined but not used [-Wunused-function] > > 184 | static ssize_t coresight_cti_reg_store(struct device *dev, > > | ^~~~~~~~~~~~~~~~~~~~~~~ > > > > This is expected as coresight_cti_reg_store() is only used in the > > coresight_cti_reg_rw macro, which is only used in a block guarded by > > CONFIG_CORESIGHT_CTI_INTEGRATION_REGS. Mark coresight_cti_reg_store() as > > __maybe_unused to clearly indicate that the function may be unused > > depending on the configuration. > > It would also be possible to fix this by wrapping the definitions in > #ifdef CONFIG_CORESIGHT_CTI_INTEGRATION_REGS. That way the maybe_unused > isn't needed and it's a bit cleaner. Right, I do not have a preference either. I only did this way first because most maintainers do not like ifdef's in .c files. I am happy to change the solution if you all prefer! > Either way, thanks for the fix. > > Reviewed-by: James Clark Thanks for the review! Cheers, Nathan > > Fixes: fbca79e55429 ("coresight: cti-sysfs: Re-use same functions for similar sysfs register accessors") > > Signed-off-by: Nathan Chancellor > > --- > > drivers/hwtracing/coresight/coresight-cti-sysfs.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c > > index 478b8d38b744..6d59c815ecf5 100644 > > --- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c > > +++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c > > @@ -181,9 +181,9 @@ static ssize_t coresight_cti_reg_show(struct device *dev, > > } > > > > /* Write registers with power check only (no enable check). */ > > -static ssize_t coresight_cti_reg_store(struct device *dev, > > - struct device_attribute *attr, > > - const char *buf, size_t size) > > +static __maybe_unused ssize_t coresight_cti_reg_store(struct device *dev, > > + struct device_attribute *attr, > > + const char *buf, size_t size) > > { > > struct cti_drvdata *drvdata = dev_get_drvdata(dev->parent); > > struct cs_off_attribute *cti_attr = container_of(attr, struct cs_off_attribute, attr); > > > > base-commit: 0a98181f805058773961c5ab3172ecf1bf1ed0e1