From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932483AbbJPPBh (ORCPT ); Fri, 16 Oct 2015 11:01:37 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:45161 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932123AbbJPPBg (ORCPT ); Fri, 16 Oct 2015 11:01:36 -0400 Subject: Re: [PATCH 3/3] power: bq27xxx_battery: fix defined but not used warnings To: =?UTF-8?Q?Pali_Roh=c3=a1r?= , Sebastian Reichel References: <1445003052-31373-1-git-send-email-sre@kernel.org> <1445003052-31373-4-git-send-email-sre@kernel.org> <20151016144705.GG28216@pali> CC: , From: "Andrew F. Davis" Message-ID: <5621114D.7010002@ti.com> Date: Fri, 16 Oct 2015 10:01:33 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151016144705.GG28216@pali> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/16/2015 09:47 AM, Pali Rohár wrote: > On Friday 16 October 2015 15:44:12 Sebastian Reichel wrote: >> If BQ27XXX is enabled, but neither I2C based initialization, nor >> platform based initialization are activated, bq27xxx_powersupply_init >> and bq27xxx_powersupply_unregister are defined but not used. >> >> This configuration doesn't make sense, but there is no easy way >> to make it unavailable in the build system, so just mark the >> functions as __maybe_unused instead. >> > > What about? > > #if defined(CONFIG_1) || defined(CONFIG_2) > #define NEED_POWER_SUPPLY > #endif > > And then wrap power supply code into #ifdef NEED_POWER_SUPPLY? > We would need to wrap everything in that then, so without I2C or platform enabled we end up compiling an empty file. I think the better fix would be to modify the Kconfig, something like: config BATTERY_BQ27XXX tristate depends on (BATTERY_BQ27XXX_I2C || BATTERY_BQ27XXX_PLATFORM) default y config BATTERY_BQ27XXX_I2C bool "BQ27200/BQ27500 support" depends on I2C help Say Y here to enable support for batteries with BQ27x00 (I2C) chips. config BATTERY_BQ27XXX_PLATFORM bool "BQ27000 support" help Say Y here to enable support for batteries with BQ27000 (HDQ) chips. This would be more in line with how other multi-bus devices handle this issue when nether bus is selected. -- Andrew F. Davis