Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1248778 > unrolled thread

[PATCH 0/3] power: bq27xxx: Fix multiple defined but not used warnings

Started bySebastian Reichel <sre@kernel.org>
First post2015-10-16 16:00 +0200
Last post2015-10-16 17:10 +0200
Articles 7 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/3] power: bq27xxx: Fix multiple defined but not used warnings Sebastian Reichel <sre@kernel.org> - 2015-10-16 16:00 +0200
    [PATCH 1/3] power: bq27xxx_battery: fix platform probe Sebastian Reichel <sre@kernel.org> - 2015-10-16 16:00 +0200
      Re: [PATCH 1/3] power: bq27xxx_battery: fix platform probe Pali Rohár <pali.rohar@gmail.com> - 2015-10-16 16:50 +0200
      Re: [PATCH 1/3] power: bq27xxx_battery: fix platform probe "Andrew F. Davis" <afd@ti.com> - 2015-10-16 17:00 +0200
    [PATCH 3/3] power: bq27xxx_battery: fix defined but not used warnings Sebastian Reichel <sre@kernel.org> - 2015-10-16 16:00 +0200
      Re: [PATCH 3/3] power: bq27xxx_battery: fix defined but not used  warnings Pali Rohár <pali.rohar@gmail.com> - 2015-10-16 16:50 +0200
        Re: [PATCH 3/3] power: bq27xxx_battery: fix defined but not used  warnings "Andrew F. Davis" <afd@ti.com> - 2015-10-16 17:10 +0200

#1248778 — [PATCH 0/3] power: bq27xxx: Fix multiple defined but not used warnings

FromSebastian Reichel <sre@kernel.org>
Date2015-10-16 16:00 +0200
Subject[PATCH 0/3] power: bq27xxx: Fix multiple defined but not used warnings
Message-ID<qkdI6-89o-15@gated-at.bofh.it>
Hi,

These patches fix multiple "defined but not used" warnings
in the bq27xxx driver.

-- Sebastian

Sebastian Reichel (3):
  power: bq27xxx_battery: fix platform probe
  power: bq27xxx_battery: move irq handler to i2c section
  power: bq27xxx_battery: fix defined but not used warnings

 drivers/power/bq27xxx_battery.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

-- 
2.6.1

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

[toc] | [next] | [standalone]


#1248782 — [PATCH 1/3] power: bq27xxx_battery: fix platform probe

FromSebastian Reichel <sre@kernel.org>
Date2015-10-16 16:00 +0200
Subject[PATCH 1/3] power: bq27xxx_battery: fix platform probe
Message-ID<qkdI6-89o-31@gated-at.bofh.it>
In reply to#1248778
Add missing initialization of register mapping table to
platform probe function.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
---
 drivers/power/bq27xxx_battery.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/power/bq27xxx_battery.c b/drivers/power/bq27xxx_battery.c
index 994c78d9f426..69e6b371a51c 100644
--- a/drivers/power/bq27xxx_battery.c
+++ b/drivers/power/bq27xxx_battery.c
@@ -1292,6 +1292,7 @@ static int bq27xxx_battery_platform_probe(struct platform_device *pdev)
 
 	di->dev = &pdev->dev;
 	di->chip = pdata->chip;
+	di->regs = bq27xxx_regs[di->chip];
 
 	name = pdata->name ?: dev_name(&pdev->dev);
 	di->bus.read = &bq27xxx_battery_platform_read;
-- 
2.6.1

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

[toc] | [prev] | [next] | [standalone]


#1248822 — Re: [PATCH 1/3] power: bq27xxx_battery: fix platform probe

FromPali Rohár <pali.rohar@gmail.com>
Date2015-10-16 16:50 +0200
SubjectRe: [PATCH 1/3] power: bq27xxx_battery: fix platform probe
Message-ID<qkeut-Sc-1@gated-at.bofh.it>
In reply to#1248782
On Friday 16 October 2015 15:44:10 Sebastian Reichel wrote:
> Add missing initialization of register mapping table to
> platform probe function.
> 
> Signed-off-by: Sebastian Reichel <sre@kernel.org>
> ---
>  drivers/power/bq27xxx_battery.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/power/bq27xxx_battery.c b/drivers/power/bq27xxx_battery.c
> index 994c78d9f426..69e6b371a51c 100644
> --- a/drivers/power/bq27xxx_battery.c
> +++ b/drivers/power/bq27xxx_battery.c
> @@ -1292,6 +1292,7 @@ static int bq27xxx_battery_platform_probe(struct platform_device *pdev)
>  
>  	di->dev = &pdev->dev;
>  	di->chip = pdata->chip;
> +	di->regs = bq27xxx_regs[di->chip];
>  
>  	name = pdata->name ?: dev_name(&pdev->dev);
>  	di->bus.read = &bq27xxx_battery_platform_read;

Acked-by: Pali Rohár <pali.rohar@gmail.com>

-- 
Pali Rohár
pali.rohar@gmail.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1248831 — Re: [PATCH 1/3] power: bq27xxx_battery: fix platform probe

From"Andrew F. Davis" <afd@ti.com>
Date2015-10-16 17:00 +0200
SubjectRe: [PATCH 1/3] power: bq27xxx_battery: fix platform probe
Message-ID<qkeEa-13E-3@gated-at.bofh.it>
In reply to#1248782
On 10/16/2015 08:44 AM, Sebastian Reichel wrote:
> Add missing initialization of register mapping table to
> platform probe function.
>
> Signed-off-by: Sebastian Reichel <sre@kernel.org>
> ---
>   drivers/power/bq27xxx_battery.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/power/bq27xxx_battery.c b/drivers/power/bq27xxx_battery.c
> index 994c78d9f426..69e6b371a51c 100644
> --- a/drivers/power/bq27xxx_battery.c
> +++ b/drivers/power/bq27xxx_battery.c
> @@ -1292,6 +1292,7 @@ static int bq27xxx_battery_platform_probe(struct platform_device *pdev)
>
>   	di->dev = &pdev->dev;
>   	di->chip = pdata->chip;
> +	di->regs = bq27xxx_regs[di->chip];
>
>   	name = pdata->name ?: dev_name(&pdev->dev);
>   	di->bus.read = &bq27xxx_battery_platform_read;
>

Acked-by: Andrew F. Davis <afd@ti.com>

-- 
Andrew F. Davis
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1248783 — [PATCH 3/3] power: bq27xxx_battery: fix defined but not used warnings

FromSebastian Reichel <sre@kernel.org>
Date2015-10-16 16:00 +0200
Subject[PATCH 3/3] power: bq27xxx_battery: fix defined but not used warnings
Message-ID<qkdI6-89o-21@gated-at.bofh.it>
In reply to#1248778
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.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
---
 drivers/power/bq27xxx_battery.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/bq27xxx_battery.c b/drivers/power/bq27xxx_battery.c
index 880233ce9343..452c9f079e0d 100644
--- a/drivers/power/bq27xxx_battery.c
+++ b/drivers/power/bq27xxx_battery.c
@@ -991,7 +991,7 @@ static void bq27xxx_external_power_changed(struct power_supply *psy)
 	schedule_delayed_work(&di->work, 0);
 }
 
-static int bq27xxx_powersupply_init(struct bq27xxx_device_info *di,
+static int __maybe_unused bq27xxx_powersupply_init(struct bq27xxx_device_info *di,
 				    const char *name)
 {
 	int ret;
@@ -1026,7 +1026,7 @@ static int bq27xxx_powersupply_init(struct bq27xxx_device_info *di,
 	return 0;
 }
 
-static void bq27xxx_powersupply_unregister(struct bq27xxx_device_info *di)
+static void __maybe_unused bq27xxx_powersupply_unregister(struct bq27xxx_device_info *di)
 {
 	/*
 	 * power_supply_unregister call bq27xxx_battery_get_property which
-- 
2.6.1

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

[toc] | [prev] | [next] | [standalone]


#1248823 — Re: [PATCH 3/3] power: bq27xxx_battery: fix defined but not used warnings

FromPali Rohár <pali.rohar@gmail.com>
Date2015-10-16 16:50 +0200
SubjectRe: [PATCH 3/3] power: bq27xxx_battery: fix defined but not used warnings
Message-ID<qkeut-Sc-5@gated-at.bofh.it>
In reply to#1248783
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?

-- 
Pali Rohár
pali.rohar@gmail.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1248836 — Re: [PATCH 3/3] power: bq27xxx_battery: fix defined but not used warnings

From"Andrew F. Davis" <afd@ti.com>
Date2015-10-16 17:10 +0200
SubjectRe: [PATCH 3/3] power: bq27xxx_battery: fix defined but not used warnings
Message-ID<qkeNQ-1vA-11@gated-at.bofh.it>
In reply to#1248823
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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web