From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5B28C55179 for ; Thu, 29 Oct 2020 16:03:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F9082076E for ; Thu, 29 Oct 2020 16:03:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XoEoMxKH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725952AbgJ2QDZ (ORCPT ); Thu, 29 Oct 2020 12:03:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:35803 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725824AbgJ2QDZ (ORCPT ); Thu, 29 Oct 2020 12:03:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603987403; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uOasBam5gXvdPPyM9scWn8lcoOXB0UukZC1GOkaCgrA=; b=XoEoMxKHG6JkNAn9mJOnJIbX5PwDN+BGYiGejMC+1hYrfhngMakCvbU1sXSNh1zyjxXAfB yvQVzyoLIWaC5mL/d5yEkROkozz1vJajgEn2o9+nNmaTdiczLOQQ96vilSGOghf6fdLEgM jzy+V1WJBjgxop2D7zERVsnAERqDspc= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-109-rg5Gb23gNO2hn6XbMECMaw-1; Thu, 29 Oct 2020 12:03:21 -0400 X-MC-Unique: rg5Gb23gNO2hn6XbMECMaw-1 Received: by mail-ed1-f69.google.com with SMTP id u12so1350812edi.17 for ; Thu, 29 Oct 2020 09:03:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=uOasBam5gXvdPPyM9scWn8lcoOXB0UukZC1GOkaCgrA=; b=gwwUyNHQW8iHTItjxqOMDgSNGKXYuxbXBK5SGvewQHA9RWW391vjdv6Ix1P13U8wce aq82hT0qD19emiIWmhdL0u2vt0VuQz2qAOM+Wbr2uZ9Yc83gGYciKjShw0rG19My9B4c Sx/ESCTYNpNFaxPHRWviU+N09uI43uGZ5Lu9PQmlCJ+tuzsqJSly4DpnJUbz2b+lXJnt jxN9FAu6+rSN0hGKrSaCPke/3XuKwIJ+ETDD8szBYXlqZsoKU6H362sAtcbhiUHpO9UT 03qOvOUjP+os/F5/E7NDkHTuPh2ycmV7UR12XOvxoB+mnrYkrh2Np2AYFeXNLmfuKMGC BXNg== X-Gm-Message-State: AOAM533DhQZ//qSJdPkxqGGFVc2TQ8gJ7JVWwoj4b/axj5yU1+Orb7LM mqL4C8iE7dZ/26CS+2BFXq1XVZNQKwEXXVD8yPeXNbh4gHKcQq6qNTK4SBU5l+s7x1L1KeHzalH Febl8aMaURKf1UbOk5H9NLCuv X-Received: by 2002:a50:f190:: with SMTP id x16mr3457797edl.292.1603987399721; Thu, 29 Oct 2020 09:03:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFUhd3qUcLDQTPQgyVyZlDEFRb12fWwjdMuW58utoTfR7ZjAeL6gRI9dXv6/xZdlYXP0Mf5w== X-Received: by 2002:a50:f190:: with SMTP id x16mr3457780edl.292.1603987399513; Thu, 29 Oct 2020 09:03:19 -0700 (PDT) Received: from x1.localdomain (2001-1c00-0c0c-fe00-6c10-fbf3-14c4-884c.cable.dynamic.v6.ziggo.nl. [2001:1c00:c0c:fe00:6c10:fbf3:14c4:884c]) by smtp.gmail.com with ESMTPSA id pw17sm1711891ejb.116.2020.10.29.09.03.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Oct 2020 09:03:18 -0700 (PDT) Subject: Re: [PATCH] power: supply: olpc_battery: remove unnecessary CONFIG_PM_SLEEP To: Coiby Xu Cc: Ingo Molnar , Darren Hart , Borislav Petkov , Thomas Gleixner , Andy Shevchenko , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , "open list:X86 PLATFORM DRIVERS - ARCH" , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" References: <20201029074100.225806-1-coiby.xu@gmail.com> <5350ef53-cf70-c4b6-cdf8-5738e9d4b10a@redhat.com> <20201029105941.i2kr2424wnrgtvz5@Rk> <2c09e34a-3312-628e-c9cd-518e9f58efb4@redhat.com> <20201029141646.sijo6iuj44ekytg7@Rk> From: Hans de Goede Message-ID: Date: Thu, 29 Oct 2020 17:03:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <20201029141646.sijo6iuj44ekytg7@Rk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 10/29/20 3:16 PM, Coiby Xu wrote: > On Thu, Oct 29, 2020 at 12:09:23PM +0100, Hans de Goede wrote: >> Hi, >> >> On 10/29/20 11:59 AM, Coiby Xu wrote: >>> Hi Hans, >>> >>> Thank you for reviewing this patch! >>> >>> On Thu, Oct 29, 2020 at 11:04:36AM +0100, Hans de Goede wrote: >>>> Hi, >>>> >>>> On 10/29/20 8:41 AM, Coiby Xu wrote: >>>>> SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG. >>>> >>>> No it does not, when CONFIG_PM_SLEEP is not set then the >>>> SET_SYSTEM_SLEEP_PM_OPS macro which SIMPLE_DEV_PM_OPS uses >>>> is a no-op, so nothing will reference xo15_sci_resume leading to >>>> a compiler warning when CONFIG_PM_SLEEP is not set. >>>> >>>> You could drop the ifdef and add __maybe_unused to the definition >>>> of xo15_sci_resume, but that feels like needless churn, best to >>>> just keep this as is IMHO. >>>> >>> >>> Actually, this is a tree-wide change by some semi-automation scripts. >>> Thank you for pointing out the issue to prevent me from releasing >>> another ~150 emails to flood other mailing lists. >>> >>> Currently there are 929 drivers has device PM callbacks, >>> >>> $ grep -rI "\.pm = &" --include=*.c  ./|wc -l >>> 929 >>> >>> I put all files having device PM callbacks into four categories >>> based on weather a file has CONFIG_PM_SLEEP or PM macro like >>> SET_SYSTEM_SLEEP_PM_OPS, here are the statistics, >>>   1. have both CONFIG_PM_SLEEP and PM_OPS macro: 213 >>>   2. have CONFIG_PM_SLEEP but no PM_OPS macro: 19 >>>   3. have PM macro but not CONFIG_PM_SLEEP: 347 >>>   4. no PM macro or CONFIG_PM_SLEEP: 302 >>> >>> Some drivers which have PM macro but not CONFIG_PM_SLEEP like >>> sound/x86/intel_hdmi_audio.c indeed use __maybe_unused to eliminate >>> the compiling warning. In 2011, there's a patch proposing to remove >>> ONFIG_PM altogether but an objection was turning CONFIG_PM on would >>> increase the kernel size [1]. So __maybe_unused also have this issue. >> >> I would expect the compiler to remove the unused function, it knows >> it is unused, that is why __maybe_unused is necessary to suppress >> the warning and compilers are pretty smart and agressive wrt remove >> unnecessary code these days. >> > Then __maybe_unused is a good solution and there's also convincing > reason to prefer __maybe_unused over CONFIG_PM_SLEEP according to > Arnd Bergmann [2], Ok, I would be happy to merge a patch for this which drops the #ifdef-s and adds a __maybe_unused. Regards, Hans