Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp767263ybj; Thu, 19 Sep 2019 23:12:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBzx+NTEzusDSMHIyXpevMxGP18Y6HZ62jp8ZuW9yAWBK3lg63TeCWRkuxGVZ4uzvhTu33 X-Received: by 2002:a05:6402:1a52:: with SMTP id bf18mr10798107edb.67.1568959926767; Thu, 19 Sep 2019 23:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568959926; cv=none; d=google.com; s=arc-20160816; b=0Bqx7tv4ohwoPc7RaM0u3G8CsJqsBjIWpeaqYilhHX1MIQYGM+j/A+q9g0Gwrfqohg JCWDe2eLPdDlr5iols0poqDE6IRZ7yK74l+LvJvfDcr9vnizQzvkHnsvVX281lB/iRO3 4XB+419TffFhLioKjjzypjNOIBuuvmHn6CnTioyDz4CJWd2GqfuIv929tlQXD3r4pwcV VJWRXEZwpt8S6NOvO/iIaYMsZ5qczgMeCShc83EM902BMsSOryW0EErJnhM/PHK3bRIJ nTFDZM4PDzCxCQuFGfu48c8bSK0r/TF8bk5Ve7RGqKsgraZraFjWdUdqt5NjMP6nty4B GQFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=b35u3YHtHvLjAmawSZpI6H9pSVTTTQhTjijAUHSsftE=; b=UoDJmn2P97GynDls4QwDIxrNwRk81qFBhxEA0+0VQ/LleTzhsJ2kGgFXU+llABVoiq YvTOwfYQGZZr9eMH45sD/YnXf2v9uMiOJGOaVUwT90P0kdz4VwuYcKYnsSgKFsYnfsW4 pxaxI40ZDZJ+nbiRtSVBKPnvpkRsDXq6IlUHPr2X58/z4EzbLGCzrfOCZDzSlJ3Ewcp5 7YgKu3SWKF9vcIWZJv0NbP53Y4QKyfqGciVdkr0zOEqTaWYlyqDzah7+rJiTuaqlanyU OciyeY5jx+QX5YTGdMXaLvrCKIvEMbeYXn9vJ5iC61MVk+C3obiWVMl0DWWlYhsxv6Vn cMaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bLMaT8iG; 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 g90si712347edd.329.2019.09.19.23.11.43; Thu, 19 Sep 2019 23:12:06 -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; dkim=pass header.i=@kernel.org header.s=default header.b=bLMaT8iG; 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 S2391282AbfISVcH (ORCPT + 99 others); Thu, 19 Sep 2019 17:32:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:33342 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391073AbfISVcH (ORCPT ); Thu, 19 Sep 2019 17:32:07 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 93992208C0; Thu, 19 Sep 2019 21:32:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568928726; bh=fyy4pGkypScQBRM9b52pi6ZBUVk2OvSUIYo4S6uxfhg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bLMaT8iGJC+IywrDUUTZxffTo79vi6uPPkqKNpMTgbzTqcGEWoT3e6CU3sDQN7PL5 reqEcnIeu3XYtOoed0Tp6JKs+7O0nF45MgL8PP8t1w56IuBNI3PB4n1UR9e+bjDoWA 7qlFISStacI3VRWSihLsJKUWehJhEE2B+lJGwkZg= Date: Thu, 19 Sep 2019 23:32:03 +0200 From: Greg KH To: Murali Nalajala Cc: rafael@kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, bjorn.andersson@linaro.org Subject: Re: [PATCH] base: soc: Export soc_device_to_device API Message-ID: <20190919213203.GA395325@kroah.com> References: <1568927624-13682-1-git-send-email-mnalajal@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1568927624-13682-1-git-send-email-mnalajal@codeaurora.org> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 19, 2019 at 02:13:44PM -0700, Murali Nalajala wrote: > If the soc drivers want to add custom sysfs entries it needs to > access "dev" field in "struct soc_device". This can be achieved > by "soc_device_to_device" API. Soc drivers which are built as a > module they need above API to be exported. Otherwise one can > observe compilation issues. > > Signed-off-by: Murali Nalajala > --- > drivers/base/soc.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/base/soc.c b/drivers/base/soc.c > index 7c0c5ca..4ad52f6 100644 > --- a/drivers/base/soc.c > +++ b/drivers/base/soc.c > @@ -41,6 +41,7 @@ struct device *soc_device_to_device(struct soc_device *soc_dev) > { > return &soc_dev->dev; > } > +EXPORT_SYMBOL_GPL(soc_device_to_device); > > static umode_t soc_attribute_mode(struct kobject *kobj, > struct attribute *attr, What in-kernel driver needs this? Is linux-next breaking without this? We don't export things unless we have a user of the export. Also, adding "custom" sysfs attributes is almost always not the correct thing to do at all. The driver should be doing it, by setting up the attribute group properly so that the driver core can do it automatically for it. No driver should be doing individual add/remove of sysfs files. If it does so, it is almost guaranteed to be doing it incorrectly and racing userspace. And yes, there's loads of in-kernel examples of doing this wrong, I've been working on fixing that up, look at the patches now in Linus's tree for platform and USB drivers that do this as examples of how to do it right. thanks, greg k-h