Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1769267pxp; Mon, 21 Mar 2022 04:52:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBr85NjLdTJoIxgKUuCe1OS90vvfn6aMhmj53xYUJpexDHKs4fb0xelK4zDBwv2eRUGtoz X-Received: by 2002:a05:6a00:15c6:b0:4fa:aaec:ef42 with SMTP id o6-20020a056a0015c600b004faaaecef42mr1797034pfu.74.1647863547703; Mon, 21 Mar 2022 04:52:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647863547; cv=none; d=google.com; s=arc-20160816; b=zpQMc8Vvoxglt58yP8oK0J2gdYopfD2emIfcW0ENjJ6JD8WF76ak6Y73+y5w3ZI7oa a7d0fuqPSW2tmLGOAuoESrPb+YyNZ67o5P/76OM9JsTJwVfjIWGps0ZlIQLZHqhrkaN+ w/k0PUIJgZOTVsWWUPft7bfY7dCwCglmuMztJgM3ESpm4xiwmTu2Ph3lPDqfJNSL3Hup qoHyvgLsRSpRNiQt9pMDUa4hjO00+ZNpbmtqjRRTSsG6DjBo1pOcEp9lTqjFOlBKuMTr 4HTcmz61VPOW7dhxG6GhBufUrLnQ0aYt/f2769nKbaKSYxWQohMya7m1ehXwJ48uzbiL PyBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=4ZAouKjLpC5h4H2T+rBDcUdFqGSww9lvE0PZHfaLkkM=; b=gwUnxfPD0QPqCBTnUwCVsf2GhA+2cXOmwXp3s9U37nqb7OR0NyFcUEbNCAKr1kMKzd D0ZLlHgsb0qWynmjI5H9v646T5P/bkw+MROYWiWImZXlI5mzjUGKnd5q7vKrY8oyrMPg oBaxzYw50nNE/z6b1kSp9CTrflrNfaNFPBSh+yLpJFIqwP8zvltZFnYBH2tVfNRspJvX Iyt+vdgWx+p+bYzWAWF715uOV8B+65jK75Kvi6DSk5ngzbImpLW1uiPHkWggc3gwb5S3 F3HDMPmQMq8Ij+/159r9dQ5+SNLui6cx+Y1KJqegXFXem6ZyhNj9ahWNse18mPFziGFp P0VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=RTpvI40Y; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m21-20020a62a215000000b004fa3a8e005dsi6954285pff.276.2022.03.21.04.52.01; Mon, 21 Mar 2022 04:52:27 -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=@messagingengine.com header.s=fm3 header.b=RTpvI40Y; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345473AbiCUIwF (ORCPT + 99 others); Mon, 21 Mar 2022 04:52:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345476AbiCUIwE (ORCPT ); Mon, 21 Mar 2022 04:52:04 -0400 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26FE236B74 for ; Mon, 21 Mar 2022 01:50:38 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 840B25C00AF; Mon, 21 Mar 2022 04:50:37 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 21 Mar 2022 04:50:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=4ZAouKjLpC5h4H2T+ rBDcUdFqGSww9lvE0PZHfaLkkM=; b=RTpvI40YBMxSvUWqEZ2Tmz5LBJYP6qAMv 15J+4VNBkCmDjo1YAB/FKtzc0o+NLzUWYBr8DdAtOQEOwvE148n6metJ0ljqB9l6 bjuvqkiOITKuE75iqh/h6/i8Y0IN5Fim7kihZfven84N80hs/x4wBdrmSDCc2Cdt 0T5TMD/XpTeDY7f0LvTmskhNr1XURPKqRS+Ouvk+OuhKwZDV07Cl1C65XmBi/pbE 8hrXMkfl97f7w5NhCnE9YASU/ZuHsTwFKcQsHSvZM1YpaINothtAjc5cnFFl9fxe 5BSjw4mbIoYosvVdkRGJujMXq91wWbcnQOC/JVd5/shCl9HmxUwJg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudegvddguddvhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvufgjkfhfgggtsehmtderredttdejnecuhfhrohhmpefhihhnnhcu vfhhrghinhcuoehfthhhrghinheslhhinhhugidqmheikehkrdhorhhgqeenucggtffrrg htthgvrhhnpeefffejiefgheevheefvefhteeggfeijeeiveeihfffffdugfefkeelfffh gfehvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hfthhhrghinheslhhinhhugidqmheikehkrdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 21 Mar 2022 04:50:34 -0400 (EDT) Date: Mon, 21 Mar 2022 19:50:41 +1100 (AEDT) From: Finn Thain To: Christophe Leroy cc: Benjamin Herrenschmidt , Randy Dunlap , "linuxppc-dev@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] macintosh/via-pmu: Fix compiler warnings when CONFIG_PROC_FS is disabled In-Reply-To: <39f63c1b-5a1b-8c8e-5991-813d3d3c2576@linux-m68k.org> Message-ID: <7b16264-dfef-414-8195-87c14a89fb40@linux-m68k.org> References: <650f5577599a701fdd632cdd469a9cea9788cdf3.1647674431.git.fthain@linux-m68k.org> <39f63c1b-5a1b-8c8e-5991-813d3d3c2576@linux-m68k.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="-1463811774-1170941894-1647852641=:12278" X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE,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 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---1463811774-1170941894-1647852641=:12278 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Hi Christophe, On Mon, 21 Mar 2022, Finn Thain wrote: > On Mon, 21 Mar 2022, Christophe Leroy wrote: >=20 > > Le 19/03/2022 =C3=A0 08:20, Finn Thain a =C3=A9crit=C2=A0: > > > drivers/macintosh/via-pmu.c:897:12: warning: 'pmu_battery_proc_show' = defined but not used [-Wunused-function] > > > static int pmu_battery_proc_show(struct seq_file *m, void *v) > > > ^~~~~~~~~~~~~~~~~~~~~ > > > drivers/macintosh/via-pmu.c:871:12: warning: 'pmu_irqstats_proc_show'= defined but not used [-Wunused-function] > > > static int pmu_irqstats_proc_show(struct seq_file *m, void *v) > > > ^~~~~~~~~~~~~~~~~~~~~~ > > > drivers/macintosh/via-pmu.c:860:12: warning: 'pmu_info_proc_show' def= ined but not used [-Wunused-function] > > > static int pmu_info_proc_show(struct seq_file *m, void *v) > > > ^~~~~~~~~~~~~~~~~~ > > >=20 > > > Rearrange some code and add some #ifdefs to avoid unused code warning= s > > > when CONFIG_PROC_FS is disabled. > >=20 > > Why not just put those three functions inside an #ifdef CONFIG_PROC_FS = ? > >=20 >=20 > You'd get a warning about the prototypes ("declared static but never=20 > defined"). Rather than add an ifdef around the prototypes as well, I=20 > just reordered things a little. Oops, I was forgetting that I also added an ifdef around the new=20 prototype. The simplest solution is probably the patch below, as it better exploits=20 the stubbed-out proc_* API in include/linux/proc_fs.h. Was this what you had in mind? diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index 2109129ea1bb..495fd35b11de 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c @@ -204,9 +204,11 @@ static int init_pmu(void); static void pmu_start(void); static irqreturn_t via_pmu_interrupt(int irq, void *arg); static irqreturn_t gpio1_interrupt(int irq, void *arg); +#ifdef CONFIG_PROC_FS static int pmu_info_proc_show(struct seq_file *m, void *v); static int pmu_irqstats_proc_show(struct seq_file *m, void *v); static int pmu_battery_proc_show(struct seq_file *m, void *v); +#endif static void pmu_pass_intr(unsigned char *data, int len); static const struct proc_ops pmu_options_proc_ops; =20 @@ -857,6 +859,7 @@ query_battery_state(void) =09=09=092, PMU_SMART_BATTERY_STATE, pmu_cur_battery+1); } =20 +#ifdef CONFIG_PROC_FS static int pmu_info_proc_show(struct seq_file *m, void *v) { =09seq_printf(m, "PMU driver version : %d\n", PMU_DRIVER_VERSION); @@ -977,6 +980,7 @@ static const struct proc_ops pmu_options_proc_ops =3D { =09.proc_release=09=3D single_release, =09.proc_write=09=3D pmu_options_proc_write, }; +#endif =20 #ifdef CONFIG_ADB /* Send an ADB command */ ---1463811774-1170941894-1647852641=:12278--