From patchwork Wed May 10 15:48:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 92195 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3738704vqo; Wed, 10 May 2023 09:06:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4n3e+WMWdHUN456Zc/C7CmdTkapH1/T7+st3sBYBOj075RZIihngHexuEUDo1zoV/zrPVI X-Received: by 2002:a9d:6b13:0:b0:6a6:3f1c:2d66 with SMTP id g19-20020a9d6b13000000b006a63f1c2d66mr3608912otp.12.1683734816821; Wed, 10 May 2023 09:06:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683734816; cv=none; d=google.com; s=arc-20160816; b=uvKNi5G+t0l5rBOm7iKdnKiqqs/ymBiMcIiiKyURRYGe4L4cokRfrz6C30Irbksb+J aEwSHq9c/45B9TY3qnepejtVNLE/KzD+VLO+HfbMSEVEQl9NmetIgbt+kMu4WvgaWFpu v0LU2bhBql/1eCByAFzjyrxF2IUdtz/iH0i2ylbvGXWC6AkKQLM6lPsI69ZGeFJvaU29 pD7bXzFhW4ptw3/lSgeBngLKytoK8VrYPb3DhpbSCAT4SDnbWQNAy77O4d7aWyfoMA22 tnPKS4wL1zxFYaAPizghiNTPDe+nAOWzsvkGlSMjTlVCxo+tcKDnVYg+HULCtUsOMDps A/XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=o8C8MXrqjqKXj0eKsxGXL9GkrBq/7JcKAOeht6U8KtQ=; b=0+QBzcnlLYEr/XNfHcV6AJnxehyB0jEZ6Nc5rN7571rmJ+P6MaPnJvvy+OKnwFNa0o 3fVnHXcIBlOLguLcb+XJpsSwa/IjkfccQEsk0CDKoD6mD2gsgVsx86fXMVjpDInoZaqx SpQjdEMtInuC5XwUzhbvf/uzYsCr8un/NKqoB53sbuWW3VJ1MLHsQa0Aro49wxroNUgx DiBgyODOpmb4837Em9dmdzaNz+GcfUT1UqbXJ0diIw/WSt83B0McwM6OyzrvtHN9mjF6 S7LqRgu3J0XHOXUdTDhi7ECo3I2PHPTyxC14GDzZwr+Jd8Ie7GCObQQJnFyOf9dM8BjH lZDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=jrmGFUr2; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bx4-20020a056830600400b006a3e0da9a2asi8353877otb.151.2023.05.10.09.06.22; Wed, 10 May 2023 09:06:56 -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=@bootlin.com header.s=gm1 header.b=jrmGFUr2; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237702AbjEJPsb (ORCPT + 99 others); Wed, 10 May 2023 11:48:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237496AbjEJPsO (ORCPT ); Wed, 10 May 2023 11:48:14 -0400 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4367619B6; Wed, 10 May 2023 08:48:12 -0700 (PDT) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 073A0C000C; Wed, 10 May 2023 15:48:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1683733690; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o8C8MXrqjqKXj0eKsxGXL9GkrBq/7JcKAOeht6U8KtQ=; b=jrmGFUr2y+aOVqpJ1iPloWve2lq8N4iHH6SoENv2W/wV94WrcuwK8jOqlG7rPvLt6gckhN gvzm94tlydwTS5IAluF6icZG/5auLBEKIUhgJgnsgZCsJseLP8iZ2duxFoPVJ4FFI8itRm Qqltvlr4+O7bdd/MMgublxvFBUvHaam1Dyc9gIvpT11ca+1kPdL3p56QFa2XGUC9GDbfWR LPr75aieSdqJVFFIkFxE8wtBPDxETpKU28oNQ/9FeOoRq+dpF9Zmn1XihIqsgVtb50GrRw xVSkPb4DRopl5PhnUFfgsGAZWDgZdxOS5uNNF0+QR1Ocw0KLQ5Oq3ITr6KVtvA== From: Miquel Raynal To: Rob Herring Cc: Frank Rowand , Thomas Petazzoni , devicetree@vger.kernel.org, , linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, Thierry Reding , David Airlie , Daniel Vetter , Mikko Perttunen , Miquel Raynal Subject: [PATCH 5/5] gpu: host1x: Stop open-coding of_device_uevent() Date: Wed, 10 May 2023 17:48:03 +0200 Message-Id: <20230510154803.189096-6-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230510154803.189096-1-miquel.raynal@bootlin.com> References: <20230510154803.189096-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765523919445479293?= X-GMAIL-MSGID: =?utf-8?q?1765523919445479293?= There is apparently no reasons to open-code of_device_uevent() besides: - The helper receives a struct device while we want to use the of_node member of the struct device *parent*. - of_device_uevent() could not be called by modules because of a missing EXPORT_SYMBOL*(). In practice, the former point is not very constraining, just calling of_device_uevent(dev->parent, ...) would have made the trick. The latter point is more an observation rather than a real blocking point because nothing prevented of_uevent() (called by the inline function of_device_uevent()) to be exported to modules. In practice, this helper is now exported, so nothing prevent us from using of_device_uevent() anymore. Let's use the core helper directly instead of open-coding it. Cc: Thierry Reding Cc: David Airlie Cc: Daniel Vetter Cc: Mikko Perttunen Cc: Rob Herring Cc: Frank Rowand Signed-off-by: Miquel Raynal --- This patch depends on the changes performed earlier in the series under the drivers/of/ folder. --- drivers/gpu/host1x/bus.c | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c index 4d16a3396c4a..6434a183fb72 100644 --- a/drivers/gpu/host1x/bus.c +++ b/drivers/gpu/host1x/bus.c @@ -338,34 +338,15 @@ static int host1x_device_match(struct device *dev, struct device_driver *drv) return strcmp(dev_name(dev), drv->name) == 0; } +/* + * Note that this is really only needed for backwards compatibility + * with libdrm, which parses this information from sysfs and will + * fail if it can't find the OF_FULLNAME, specifically. + */ static int host1x_device_uevent(const struct device *dev, struct kobj_uevent_env *env) { - struct device_node *np = dev->parent->of_node; - unsigned int count = 0; - struct property *p; - const char *compat; - - /* - * This duplicates most of of_device_uevent(), but the latter cannot - * be called from modules and operates on dev->of_node, which is not - * available in this case. - * - * Note that this is really only needed for backwards compatibility - * with libdrm, which parses this information from sysfs and will - * fail if it can't find the OF_FULLNAME, specifically. - */ - add_uevent_var(env, "OF_NAME=%pOFn", np); - add_uevent_var(env, "OF_FULLNAME=%pOF", np); - - of_property_for_each_string(np, "compatible", p, compat) { - add_uevent_var(env, "OF_COMPATIBLE_%u=%s", count, compat); - count++; - } - - add_uevent_var(env, "OF_COMPATIBLE_N=%u", count); - - return 0; + return of_device_uevent((const struct device *)&dev->parent, env); } static int host1x_dma_configure(struct device *dev)