Received: by 10.192.165.148 with SMTP id m20csp136450imm; Wed, 9 May 2018 10:01:28 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpRXVWm5wmb6tpX25TS22rty5ZPjegySXg5EvmQ/wW0hI6EBmoYr3hBC5/iKr2QkganFB6L X-Received: by 2002:a17:902:5481:: with SMTP id e1-v6mr45404990pli.137.1525885288648; Wed, 09 May 2018 10:01:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525885288; cv=none; d=google.com; s=arc-20160816; b=pa10ikMSxv8TF1ycd4pIS5xRnMLxrfqiOW3ww0m3Nr2kFzvmYWy8xq76q1/cQiMUWA OfHY+IDMka44pE1K2Chz8g2W9wl+BP+r9w/Bcr1SegYqw7vqXxtGfC7JJXlWjcHZgqvi geeQM75cjq099qENSTJQHvMVydOutuSoMmn1IZz5CZn9q48dmZ9tXEFPh7BjfEfcdxRq YiolsysMy3Kw5rNwpN5VrPfiJmBefZ06chHvxOVvDYofT86mdIaiV65PUrP8n77+/hps KbpK18wjJMbSvu0QAmez2VTNrYTQ5lxdF4duwuc4nqYKGjoHFlDN1ffUTAvsOqUYjd3V Up3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=1CIQInrTuw7zZYabYtG66d+dDzokW27RWZDs3OLyOL0=; b=qRegiO60xzmosNUXJFcHy0w5PpC40BgA5bd/XHFcHG7iP7W2Dw0Q+GOzJJ7HHRps6c bMSfwUbRRNDO5oK0GP3cNbEZHfSg8E29pL6igxDCgo9M2TOtsiUvCCuyn+KczRTtKhPz o0Ulca9Gte0FYvBNIbF5jVbVJkxADp4UvevPgTxqNKDeIi7eOkjOk+Icpu0jI1GIRiYl b6ntDgFVACPSt0DpOpuSGZ2mFKgS+9vwmnbGnnZCENda9wxqDDvqLrcpGzxmjZnEHWEx vJu+zPGUE9rh3avk4qNr6NkCi2uqyagrFEbTDqoT7HM8A+GKW5NhjtmPSrNdl9BooPN2 EpJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 81si4272026pfl.295.2018.05.09.10.01.12; Wed, 09 May 2018 10:01:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935507AbeEIRBA convert rfc822-to-8bit (ORCPT + 99 others); Wed, 9 May 2018 13:01:00 -0400 Received: from mx2.suse.de ([195.135.220.15]:49783 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934820AbeEIRA6 (ORCPT ); Wed, 9 May 2018 13:00:58 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7341CAEC4; Wed, 9 May 2018 17:00:57 +0000 (UTC) Date: Wed, 9 May 2018 19:00:55 +0200 From: Jean Delvare To: Anders Roxell Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] i2c: i801: mark PM functions as __maybe_unused Message-ID: <20180509190055.61ad929b@endymion> In-Reply-To: <20180508073852.16840-1-anders.roxell@linaro.org> References: <20180508073852.16840-1-anders.roxell@linaro.org> Organization: SUSE Linux X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.31; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Anders, On Tue, 8 May 2018 09:38:52 +0200, Anders Roxell wrote: > With CONFIG_PM, we get a harmless build warning: > drivers/i2c/busses/i2c-i801.c:1723:12: warning: ‘i801_resume’ defined but not used [-Wunused-function] > static int i801_resume(struct device *dev) > ^~~~~~~~~~~ > drivers/i2c/busses/i2c-i801.c:1714:12: warning: ‘i801_suspend’ defined but not used [-Wunused-function] > static int i801_suspend(struct device *dev) > ^~~~~~~~~~~~ I have CONFIG_PM=y and I don't get this warning, even with W=1. Which gcc version are you using, which exact kernel version are you building, and what is the value of all the CONFIG_PM_* options? > This marks the affected functions as __maybe_unused. I'm not a big fan of __maybe_unused, at least not in this specific situation. We should be able to know exactly when these functions are needed, and only include them when this is the case. Building unused code just to discard it later (hopefully?) is a waste of CPU time. > > Fixes: a9c8088c7988 ("i2c: i801: Don't restore config registers on runtime PM") If SIMPLE_DEV_PM_OPS causes it but UNIVERSAL_DEV_PM_OPS did not, I suppose that what matters is CONFIG_PM_SLEEP. So maybe we can just replace "#ifdef CONFIG_PM" with "ifdef CONFIG_PM_SLEEP" in the code below? > Signed-off-by: Anders Roxell > --- > drivers/i2c/busses/i2c-i801.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c > index ed07f9002710..ff18c6ed2bec 100644 > --- a/drivers/i2c/busses/i2c-i801.c > +++ b/drivers/i2c/busses/i2c-i801.c > @@ -1711,7 +1711,7 @@ static void i801_shutdown(struct pci_dev *dev) > } > > #ifdef CONFIG_PM > -static int i801_suspend(struct device *dev) > +static int __maybe_unused i801_suspend(struct device *dev) > { > struct pci_dev *pci_dev = to_pci_dev(dev); > struct i801_priv *priv = pci_get_drvdata(pci_dev); > @@ -1720,7 +1720,7 @@ static int i801_suspend(struct device *dev) > return 0; > } > > -static int i801_resume(struct device *dev) > +static int __maybe_unused i801_resume(struct device *dev) > { > struct pci_dev *pci_dev = to_pci_dev(dev); > struct i801_priv *priv = pci_get_drvdata(pci_dev); -- Jean Delvare SUSE L3 Support