Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2298557pxp; Mon, 21 Mar 2022 16:14:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwacZtJZJrsomkDSqwaCzWRjpJITGHxse3NMhfliyWi1aDJpan6ACtHoeTdoMyRno25xfHE X-Received: by 2002:a17:90a:f011:b0:1c7:1800:a86d with SMTP id bt17-20020a17090af01100b001c71800a86dmr1560732pjb.175.1647904478206; Mon, 21 Mar 2022 16:14:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647904478; cv=none; d=google.com; s=arc-20160816; b=XrirSj9aB89qmhoL1OV28GW/rDldUr13dF2i4/yaAy91on4m38Tsk3czLlJWQAURyp SPyaLH6fXamHaR//Lx3ber9SJjPp1XLFZHWZ3KW7+ZOPHQnqGKIqwcFWoqKI4zzuMAFv fK8hfKx9R2frylcEfZH2CMlAj5GWMnWy436cFD+Qm0s8uCGcObj/YvgZGO+NV0GS5oFF IqpIxZ+fpIc44VUz7zfo50A/xx4B2mglK/Y7Y3ZI0RKa2KNqhktKtsXAUmxAoshXW2UE ky+j4Nc/l2KIMnOed7uPJGSlNAPVD1e990vBIaUk2yszfSs4iKfm7HgxPTleF+ij1Wlx OCrw== 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=1KWw8iPmqC/RJ7lj8bikVFsFdvOQq5BykeGEYNahjAI=; b=hYVOCdWkh4JQi9RzWmD/8wITnPsuF7NZLXuy/Gl7jXTnzkSPaE32dtpVTRqiTf5PT1 A5rvixN/jVhWhKuRotqnIHSafYLFdpKdYKHKqRv6L1PBsVCBKTdDu755pUm94Fl7z8XM of0MuW0abCosxFSTllhkQMqXvF5ZEIXligZcN9AQfz4GaGTMbeuANvB19qJ4jYRjJx3l yNCIA3HT/Pk0nHvuf1mtHvqmD08Zgg+pbPSbCy4UH4USX8uLiS9OUjF6HjmBQzHSJsNL VNWr6EzyfG3L7Xf5qnZWjoD/qbxZUz6hFhtzjZaz3loaB6IZy8s44xq2WQdS+edo4caJ qDVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=G9YOGXFF; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d21-20020a056a0024d500b004fa87f5a5dcsi8183276pfv.34.2022.03.21.16.14.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 16:14:38 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=G9YOGXFF; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5DA76360187; Mon, 21 Mar 2022 15:12:42 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244437AbiCTAUm (ORCPT + 99 others); Sat, 19 Mar 2022 20:20:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242988AbiCTAUl (ORCPT ); Sat, 19 Mar 2022 20:20:41 -0400 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14ABACF for ; Sat, 19 Mar 2022 17:19:18 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id A08AD5C0132; Sat, 19 Mar 2022 20:19:16 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sat, 19 Mar 2022 20:19:16 -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=1KWw8iPmqC/RJ7lj8 bikVFsFdvOQq5BykeGEYNahjAI=; b=G9YOGXFFD8rH6m7jJU0rxRQo0xm5DaVIA T6efpmRDOU5869ufb8ywrQFme0UEpieNsl3QPn8SX5u44bdlSxYRy/k1KEURKDTJ 3h3TJpkw2OQYsUJnQsy27kj3mpIBTHlDb6LUCcLbUzZEO4MItyuI+2azCXbcu7kk PaGwejMms6f600QpBvod5yOXcsAvuSbaPGRV6qdmyw7MKT80XOD3uZ4UO/khQEb1 5bbW0qMmQLsiiOACI56fnzxkJII9DZobUSqWaEYtcstRdcPI5I7yNC3+/OYFYNm4 CN/yT/LitBc/4bMWKqTJpR0FkNkT0In54cXP8pvEfC9y3vMOGNWLA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudefledgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffujgfkfhggtgesthdtredttddtvdenucfhrhhomhephfhinhhnucfv hhgrihhnuceofhhthhgrihhnsehlihhnuhigqdhmieekkhdrohhrgheqnecuggftrfgrth htvghrnhepffduhfegfedvieetudfgleeugeehkeekfeevfffhieevteelvdfhtdevffet uedunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepfh hthhgrihhnsehlihhnuhigqdhmieekkhdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 19 Mar 2022 20:19:12 -0400 (EDT) Date: Sun, 20 Mar 2022 11:19:18 +1100 (AEDT) From: Finn Thain To: Geert Uytterhoeven cc: Benjamin Herrenschmidt , Michael Ellerman , Randy Dunlap , linuxppc-dev , Linux Kernel Mailing List Subject: Re: [PATCH] macintosh/via-pmu: Fix build failure when CONFIG_INPUT is disabled In-Reply-To: Message-ID: <64b6d65-5d5d-23d2-dc8a-c31fc5853349@linux-m68k.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Sat, 19 Mar 2022, Geert Uytterhoeven wrote: > On Sat, Mar 19, 2022 at 5:23 AM Finn Thain wrote: > > drivers/macintosh/via-pmu-event.o: In function `via_pmu_event': > > via-pmu-event.c:(.text+0x44): undefined reference to `input_event' > > via-pmu-event.c:(.text+0x68): undefined reference to `input_event' > > via-pmu-event.c:(.text+0x94): undefined reference to `input_event' > > via-pmu-event.c:(.text+0xb8): undefined reference to `input_event' > > drivers/macintosh/via-pmu-event.o: In function `via_pmu_event_init': > > via-pmu-event.c:(.init.text+0x20): undefined reference to `input_allocate_device' > > via-pmu-event.c:(.init.text+0xc4): undefined reference to `input_register_device' > > via-pmu-event.c:(.init.text+0xd4): undefined reference to `input_free_device' > > make[1]: *** [Makefile:1155: vmlinux] Error 1 > > make: *** [Makefile:350: __build_one_by_one] Error 2 > > > > Don't call into the input subsystem unless CONFIG_INPUT is built-in. > > > > Reported-by: kernel test robot > > Cc: Michael Ellerman > > Cc: Geert Uytterhoeven > > Signed-off-by: Finn Thain > > Thanks for your patch! > Thanks for your review. > > --- a/drivers/macintosh/Makefile > > +++ b/drivers/macintosh/Makefile > > @@ -12,7 +12,10 @@ obj-$(CONFIG_MAC_EMUMOUSEBTN) += mac_hid.o > > obj-$(CONFIG_INPUT_ADBHID) += adbhid.o > > obj-$(CONFIG_ANSLCD) += ans-lcd.o > > > > -obj-$(CONFIG_ADB_PMU) += via-pmu.o via-pmu-event.o > > +obj-$(CONFIG_ADB_PMU) += via-pmu.o > > +ifeq ($(CONFIG_INPUT), y) > > +obj-$(CONFIG_ADB_PMU) += via-pmu-event.o > > +endif > > Alternatively, you can introduce an invisible Kconfig symbol that > is y if ADB_PMU && INPUT, to control the build of via-pmu.o. > There is some precent for that (DVB_AV7110_IR, PINCTRL_FALCON, DVB_AV7110_IR) in recent code but it's a bit of a stretch. Adding the new Kconfig symbol would add complexity and it would only get used in two places. I appreciate the general preference for declarative style over imperative. But is there a stronger argument against conditionals in Makefiles? > > obj-$(CONFIG_ADB_PMU_LED) += via-pmu-led.o > > obj-$(CONFIG_PMAC_BACKLIGHT) += via-pmu-backlight.o > > obj-$(CONFIG_ADB_CUDA) += via-cuda.o > > diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c > > index 4b98bc26a94b..55afa6dfa263 100644 > > --- a/drivers/macintosh/via-pmu.c > > +++ b/drivers/macintosh/via-pmu.c > > @@ -1457,12 +1457,14 @@ pmu_handle_data(unsigned char *data, int len) > > if (pmu_battery_count) > > query_battery_state(); > > pmu_pass_intr(data, len); > > +#ifdef CONFIG_INPUT > > /* len == 6 is probably a bad check. But how do I > > * know what PMU versions send what events here? */ > > if (len == 6) { > > via_pmu_event(PMU_EVT_POWER, !!(data[1]&8)); > > via_pmu_event(PMU_EVT_LID, data[1]&1); > > } > > +#endif > > Additionally, if that new symbol is not enabled, a dummy via_pmu_event() > can be provided, so you don't need to add an #ifdef to the driver anymore. > Adding a dummy function to be used in only one place seems questionable to me. I'm not expecting new call sites to appear outside of that ifdef. Some of the arguments against ifdefs (reduced test and checker coverage, readability harm) don't really apply in this case.