Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp4953563rwb; Wed, 17 Aug 2022 08:35:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR5xhMSU475HOctZ+BbIliT2vAPqlWabimwWtyV8UPR7/LR+YePKpORFd7TqWPBjZs6THPsD X-Received: by 2002:a17:902:ecd2:b0:16e:d87f:d19e with SMTP id a18-20020a170902ecd200b0016ed87fd19emr26917274plh.75.1660750550101; Wed, 17 Aug 2022 08:35:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660750550; cv=none; d=google.com; s=arc-20160816; b=V0Og5iR50nAaqyupzaNy7/DKDzHShrBqAqOOMLvwCmv0w3/4FLL/dFY15ZZwOE1eWR E9nGlBaGXYqNVsTLB3+ofvWf2QS6BrfNXd3Dnd0f2BfA8JrVEip193Tq+jn1Kd7bjktY rTM/JnDM1Z8chx8LoUzwJ3F/dKNw/ZVxrCgb6x+X3cFywXSGaPTfgi3jAklnY5gumqrO 5HzbNPmL1klOMQxHQucishFdsluA+onIDgTfFHPShGL8HSpt/FtZZ80Ww+lqtCvNWcUX q5h6zyr4ftTVqlutbPGoDLMOTDYGTxYSVGbmUU6DzpDP81jCgkWYV+gYA11Khn/Ni8L5 B+gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EV66DXbSegdeiYeozixeQJAWMOXzJokFFp78a8Vwu7M=; b=gzWvoeEx8Lu1SY39Fx1ji9sV40K9qCYGXP6/JJnbIimdRz0BH3FwaUs+oxSLDe0luM DSZgSO1/CwrxZc4OxBxdNQ1hxN5N7phAzdc7cN6ZHLzfr9xeVUsl2eNzN50EofTKPdKR nIY59HvgSkVTfr5AiF3p2teZle41+vciq0/bq65L0Jkc0F923gYBAb7qRZmfb+37jj9k isdEhNVo2bjBzKk420Mg9+zFG4f3H/PKTKyTrHIDsZZKu4z2kNqFXd/X7e5vTrxFdeXo QJEkXUxA/LJE0DSBRpe5cSDlnAXSB8nh97C16Ml2oEN5iwErQ3D1G+U6BuFg+LdqYWGW nJww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VSoHMsyz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pg2-20020a17090b1e0200b001f20c50d659si2291285pjb.116.2022.08.17.08.35.38; Wed, 17 Aug 2022 08:35:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VSoHMsyz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240842AbiHQPbG (ORCPT + 99 others); Wed, 17 Aug 2022 11:31:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239354AbiHQPbD (ORCPT ); Wed, 17 Aug 2022 11:31:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BA108C028; Wed, 17 Aug 2022 08:31:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BBBD4B81DBA; Wed, 17 Aug 2022 15:31:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD293C433C1; Wed, 17 Aug 2022 15:30:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660750259; bh=d/FJfKqmE+4mWdoX8d+ChMQU/Kkst9TDtaxZD7wIgIE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VSoHMsyzI7smwd82uDLxGUKoigW3f8nM/LAWg7JhgdiAXMOXqORDciqGPCaZON/wV UVLudLV5g9cUA2wshQ/lU9nMXNRLcnE4iLOuay3YoFUX/ciKI2NvttWrUxTHy72tUI TiXrsqp7FRVsu2b+Z8iCc0PhicvB3gtIS/zcI3TY= Date: Wed, 17 Aug 2022 17:30:56 +0200 From: Greg KH To: Nipun Gupta Cc: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, rafael@kernel.org, eric.auger@redhat.com, alex.williamson@redhat.com, cohuck@redhat.com, puneet.gupta@amd.com, song.bao.hua@hisilicon.com, mchehab+huawei@kernel.org, maz@kernel.org, f.fainelli@gmail.com, jeffrey.l.hugo@gmail.com, saravanak@google.com, Michael.Srba@seznam.cz, mani@kernel.org, yishaih@nvidia.com, jgg@ziepe.ca, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, okaya@kernel.org, harpreet.anand@amd.com, nikhil.agarwal@amd.com, michal.simek@amd.com, git@amd.com Subject: Re: [RFC PATCH v2 6/6] driver core: add compatible string in sysfs for platform devices Message-ID: References: <20220803122655.100254-1-nipun.gupta@amd.com> <20220817150542.483291-1-nipun.gupta@amd.com> <20220817150542.483291-7-nipun.gupta@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220817150542.483291-7-nipun.gupta@amd.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 17, 2022 at 08:35:42PM +0530, Nipun Gupta wrote: > This change adds compatible string for the platform based > devices. What exactly is a "compatible string"? > > Signed-off-by: Nipun Gupta > --- > Documentation/ABI/testing/sysfs-bus-platform | 8 +++++++ > drivers/base/platform.c | 23 ++++++++++++++++++++ > 2 files changed, 31 insertions(+) > > diff --git a/Documentation/ABI/testing/sysfs-bus-platform b/Documentation/ABI/testing/sysfs-bus-platform > index c4dfe7355c2d..d95ff83d768c 100644 > --- a/Documentation/ABI/testing/sysfs-bus-platform > +++ b/Documentation/ABI/testing/sysfs-bus-platform > @@ -54,3 +54,11 @@ Description: > Other platform devices use, instead: > > - platform:`driver name` > + > +What: /sys/bus/platform/devices/.../compatible > +Date: August 2022 > +Contact: Nipun Gupta > +Description: > + compatible string associated with the device. This is > + a read only and is visible if the device have "compatible" > + property associated with it. Where is it defined what a compatible property is? > diff --git a/drivers/base/platform.c b/drivers/base/platform.c > index 51bb2289865c..94c33efaa9b8 100644 > --- a/drivers/base/platform.c > +++ b/drivers/base/platform.c > @@ -1289,10 +1289,25 @@ static ssize_t driver_override_store(struct device *dev, > } > static DEVICE_ATTR_RW(driver_override); > > +static ssize_t compatible_show(struct device *dev, struct device_attribute *attr, > + char *buf) > +{ > + const char *compat; > + int ret; > + > + ret = device_property_read_string(dev, "compatible", &compat); > + if (ret != 0) > + return 0; Shouldn't you return an error here? thanks, greg k-h