From patchwork Mon Nov 23 13:42:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 7682121 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3E0BBBF90C for ; Mon, 23 Nov 2015 13:43:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 360C920717 for ; Mon, 23 Nov 2015 13:43:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7D50720704 for ; Mon, 23 Nov 2015 13:43:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752561AbbKWNnY (ORCPT ); Mon, 23 Nov 2015 08:43:24 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:53762 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751855AbbKWNnX (ORCPT ); Mon, 23 Nov 2015 08:43:23 -0500 Received: from wuerfel.localnet ([134.3.118.24]) by mrelayeu.kundenserver.de (mreue104) with ESMTPSA (Nemesis) id 0MWjbX-1Zp7wS0shv-00Xw77; Mon, 23 Nov 2015 14:42:31 +0100 From: Arnd Bergmann To: linux-pm@vger.kernel.org Cc: Andreas Dannenberg , "Andrew F. Davis" , Pali Rohar , Dmitry Eremin-Solenikov , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, David Woodhouse Subject: [PATCH] power: bq27xxx_battery: avoid unused function warnings Date: Mon, 23 Nov 2015 14:42:29 +0100 Message-ID: <4421924.EN5kWY38Jp@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 X-Provags-ID: V03:K0:kSLhKaIuuSttz1LoE6psIDd58a0D7jUP/aKXcih12phCOQ+DTN8 PyLEWY1vEANwJf4iViMvUjnPSUKtncurEFfZsh5n6+cHp1r4csl5i75oDw2048F2rOlxJho fn/i2lwJQx9QdRZQvsdjESzo+uPgbTA9LSpPkUaFf8vUTMrDeCme3Q4K4t+P3c/kiZEo4WD i9FPeMPwXbQI7/tT806Tw== X-UI-Out-Filterresults: notjunk:1; V01:K0:oFd4kdkOXrg=:1sLgYwyHejs9mnYlT1WR9/ RVTIFdQcHGMEmxagrQnIdQQh17GTzoreFXqnfwxNoFgZ29gXu0WDNMe8VM7xH2wZHL+yEujPL RW6cv+XXRNz9xZL4EFLOcsL7pDLI2jmkguoXiALJtgttHS93VTzW7GLo/kOWOPvAA4ZSLkFDx Ok3oW1MOQcq4+Z+86P3XS6uKe02tGT6PrsOrXGB1JzXe+7+pxHWoPMSiGt9S9Js4D7wvIqr1z BhpXxSfG/HxRj1Y1Omhr8FDUEjfWjrE8EfFHYcwZJIxViqBFVReV/SIqKOiwNL6vnISF1ES4i uFl/we4X4MKvCmn3AtEwivpG3doRM5AKreKwcqVhjJcKREyvlItSgH0JhrYx3g5LG54ZT4EmH YqeV6FLd23ipWi+VMPmzlM0qKOqrQYWUQmDCk7/PaBC4By2FUlghf3Yl8HRGBs1QNEleLeNU/ FjskteovX1us1w583l/E9WucAza+VrY2FCdsILUdqYG6/ZWF4Z6EZeMHl7UdttV1mdIt6h/sj SNJvRwBQJsoAwhMc/uUBAgJ9zrQncNPHJUiaZ+937WMMUcLB5Zm2QwnmITBTpTulGt5O7N7o7 NkRJI0nBTzgJFS68n9C7i47u9fkgFJ0JNDK4dcVm8ahFeBDetc6A96mZ4M1QqqtNaB9baF1n8 jTHFcLzc/U6Lh5hhCEoW2PnbwgZT6QMFSAszLxYKB3HPKNY/cjYe9Lkd4gWQShNJBlqLhjvdN GEx3QusWNlPiErvd Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We can configure the bq27xxx_battery driver with neither the I2C nor the platform driver backends, which leaves out all references to some of the symbols, causing a couple of warnings in many randconfig builds: drivers/power/bq27xxx_battery.c:288:12: warning: 'bq27xxx_regs' defined but not used [-Wunused-variable] drivers/power/bq27xxx_battery.c:994:12: warning: 'bq27xxx_powersupply_init' defined but not used [-Wunused-function] drivers/power/bq27xxx_battery.c:1029:13: warning: 'bq27xxx_powersupply_unregister' defined but not used [-Wunused-function] I first tried replacing the existing #ifdefs with if(IS_ENABLED() statements, but that failed because the i2c framework does not declare functions when they are left out of the kernel. This just marks the unused functions as __maybe_unused, which is a correct description here. A better fix would be to restructure the driver into separate files and only build the common parts if at least one of the two bus specific drivers is enabled, but that requires much more work and testing on real hardware. For the time being, my simpler change at least avoids the warnings. Signed-off-by: Arnd Bergmann --- -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/power/bq27xxx_battery.c b/drivers/power/bq27xxx_battery.c index 880233ce9343..6c3a447f378b 100644 --- a/drivers/power/bq27xxx_battery.c +++ b/drivers/power/bq27xxx_battery.c @@ -285,7 +285,7 @@ static u8 bq27421_regs[] = { 0x18, /* AP */ }; -static u8 *bq27xxx_regs[] = { +static u8 *bq27xxx_regs[] __maybe_unused = { [BQ27000] = bq27000_regs, [BQ27010] = bq27010_regs, [BQ27500] = bq27500_regs, @@ -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