Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2910511ybf; Mon, 2 Mar 2020 18:27:46 -0800 (PST) X-Google-Smtp-Source: ADFU+vsOCbrqnWWu6ZFICuX6YYqRCGEnxbpuT7mp029q/pG0QlJ8UAFwfzp+v7GOKPrpmzE4cyVN X-Received: by 2002:a9d:2184:: with SMTP id s4mr1627611otb.121.1583202466427; Mon, 02 Mar 2020 18:27:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583202466; cv=none; d=google.com; s=arc-20160816; b=wU06PggctuP1PuEKzUYh57CLZkwMnXG+EAIsqqdy8j/XqrydfaEgoaOKcnHHERZDAp g14qxn3KljhBXu+nVw0gVUdQm/ipc5f/nXP+iEFOgKPjjIotXgylGc2m7Mo7pvUyWXm3 pEospyK/Dg5QMdg1HPBhnssG2PdkO90/HxkO9+59eyeu+rQVTn9IQjcGHWuyleX5tCTM 2tOQi6rOeyE4O+NdjJpGjLfD0dIyxWOHCMlxcvwXuMrIayEhUT8LrV1l6BHCI+Ygjs92 AwQdFR7uY1o0Qw7Xk0hmoilqqF81PEvH93c/zjyxuhj+sfVMLScSapQMhO1wFbJZPBtk yJmg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=We5qNhcF5BCMbwh1voeEXcbsfkgaJ3Y1FLQ61PY6cwY=; b=yRmKQu5hFHbgXpieqT2q+iadMOElugbuQL+TPBf3nwXJO+cd1JfvAb1QNSDVyvNTnd w6fr0Vx4sYSPWiWT1MEu4zEoHbRPplN7VtQm9Fg2ipbztBSqsLLIVEu909OPgzTSMx83 EZCkHTISt3oSvZZJBaux+dKjOjM+Is1IZBatfT20zIwfxJFUnY59d7UIf5t62ToTfxjZ t7CUXWRK52ErmJ/F7b82RcyuvQLIcjU1EPjAUmsr7dcLdmQrkDdg/PofLm6DElqdhRl0 beZkO/fxOBij8TJE0u3criA6plrXyaJVPxo9FDifNPQQ67WLOIjEO1ZDYFWC5e3ivoUy zlKA== 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 d3si6405946oia.236.2020.03.02.18.27.35; Mon, 02 Mar 2020 18:27:46 -0800 (PST) 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 S1727381AbgCCC1H (ORCPT + 99 others); Mon, 2 Mar 2020 21:27:07 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:11135 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726970AbgCCC1H (ORCPT ); Mon, 2 Mar 2020 21:27:07 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 1CA85A9F2E78C2E8C79E; Tue, 3 Mar 2020 10:27:02 +0800 (CST) Received: from [127.0.0.1] (10.173.221.207) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.439.0; Tue, 3 Mar 2020 10:26:56 +0800 Subject: Re: [PATCH -next] drivers/base/power: fix build error without SYSFS To: Greg KH CC: , , , , , References: <20200302092918.40163-1-yaohongbo@huawei.com> <20200302092308.GA1997164@kroah.com> From: Hongbo Yao Message-ID: <1b1e850f-18e1-4410-672c-4e010bae46e6@huawei.com> Date: Tue, 3 Mar 2020 10:26:54 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <20200302092308.GA1997164@kroah.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.173.221.207] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/3/2 17:23, Greg KH wrote: > On Mon, Mar 02, 2020 at 05:29:18PM +0800, Hongbo Yao wrote: >> If CONFIG_SYSFS=n, the following error is seen while building >> drivers/base/power/sysfs.c: >> >> drivers/base/power/sysfs.c: In function dpm_sysfs_change_owner: >> drivers/base/power/sysfs.c:708:44: error: passing argument 2 of >> sysfs_group_change_owner from incompatible pointer type >> [-Werror=incompatible-pointer-types] >> rc = sysfs_group_change_owner(&dev->kobj, &pm_attr_group, kuid, kgid); >> ^ >> In file included from ./include/linux/kobject.h:20:0, >> from ./include/linux/device.h:17, >> from drivers/base/power/sysfs.c:3: >> ./include/linux/sysfs.h:564:19: note: expected const struct >> attribute_group ** but argument is of type const struct attribute_group * >> >> dpm_sysfs_change_owner() should only used when CONFIG_SYSFS is >> defined. >> >> Reported-by: Hulk Robot >> Fixes: 3b52fc5d7876 ("drivers/base/power: add dpm_sysfs_change_owner()") >> Signed-off-by: Hongbo Yao >> --- >> drivers/base/power/power.h | 10 +++++++++- >> drivers/base/power/sysfs.c | 2 ++ > > You shouldn't have to add #ifdefs to a .c file here, it should all be > able to be fixed in the .h file by putting proper "empty" functions. I think it's a little difficult to fix this without changing the .c file, unless changing the Kconfig. This function was implemeted when CONFIG_PM=y, and if CONFIG_PM=n, this function would be "empty". However, I found this function should depends on CONFIG_SYSFS, if CONFIG_SYSFS=n, this function should also be empty, so only changing the dependency of the header file will cause redefinition. thanks, Hongbo. > thanks, > > greg k-h > > . >