lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 16 Oct 2015 10:01:33 -0500
From:	"Andrew F. Davis" <afd@...com>
To:	Pali Rohár <pali.rohar@...il.com>,
	Sebastian Reichel <sre@...nel.org>
CC:	<linux-pm@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/3] power: bq27xxx_battery: fix defined but not used
 warnings

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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ