Message ID | 20230313182918.1312597-16-gregkh@linuxfoundation.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1347671wrd; Mon, 13 Mar 2023 11:48:32 -0700 (PDT) X-Google-Smtp-Source: AK7set90SPfPxOK2Im1ZiYG37FeKXmkgShd2pyXm/mH65B2GFpYfk1eMtlGePbqlL6L3VawLCeUp X-Received: by 2002:a17:902:9b84:b0:19e:7d66:ff29 with SMTP id y4-20020a1709029b8400b0019e7d66ff29mr29057132plp.61.1678733311831; Mon, 13 Mar 2023 11:48:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678733311; cv=none; d=google.com; s=arc-20160816; b=F2RoHq/oZVEeH85RuZSqBSBBo++wvzeMlcRGX1lG6Y1XRXSuoLcwAsOdm2Kc83yB/C LKeVjGstj72eg8pUcb/N1QgdDDNxahmcOotBxY/xhk8qGBZ869MqFUrjkv9B7WxpuqCj hhIApu4coqGARD0ul8b6OxWJbTDuFsOtBfhUxPzHOq1c9FQXrdUIYcCJo02E35xpIr62 OgKisfEcntWYV1CboI8x7lCHl5NpeYEbOhRTZS+puF1XL+V0cBE4HMPzk+DedJLKj/OF e3/3GgLQo2Uxw77gxav/vH+2SVI6Y199evwn7OU+YxT1/TZdlka5UVdm9fqskfouMFy2 FTrA== 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=eqqa7CdhSt8kWgqKihgYkoUPGNduzOlWfhnIbXYHG20=; b=A5uKsSK4iuPTmPPdxBUN5b2sQ2WFkNzAg2mE87WyeVGoWfjWzS+a25g807wvZ6Tco1 k+10xAMqpP0fwpXXZLpu3A62WqCXytbMoj7tf0UvtQwOZrJod+5iUjtoJ/I4LjjNs7Tv 035zClD4YC5V/JcZXCq/uxOlYH8Cn9LjJEloAgkz17Zz9isDr1eZj1TZ0tRrROtF3YaP DRz6qC76km4qV2TLC6s9JiIuJHNkmpu49ZzSplc9trin1UWTmkEdFWvdxsUU5hbCLUpB 9IP2tSURDVbSEgudmKuqWStrulkO1gnTe15DEMIWxKYh0ZpANhFG+aFSQxI44Ht2re0H hD/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A5pZkIFW; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ke13-20020a170903340d00b0019aa6d30d64si362083plb.183.2023.03.13.11.48.19; Mon, 13 Mar 2023 11:48:31 -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=A5pZkIFW; 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 S231351AbjCMSbh (ORCPT <rfc822;realc9580@gmail.com> + 99 others); Mon, 13 Mar 2023 14:31:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230493AbjCMSa6 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 13 Mar 2023 14:30:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA68F84809; Mon, 13 Mar 2023 11:30:31 -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 E0306B811DD; Mon, 13 Mar 2023 18:29:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56053C4339B; Mon, 13 Mar 2023 18:29:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678732183; bh=eoKf67z0RJnZv79uQSS4O970nfxW9TSz1wAks4pBByU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A5pZkIFW5L4V/98zs6OBmVYuIlG1i6es/nQYVUrj0P/iA0qiRIoGKniahO790i2C0 ibG0+FXU9GeKK7FMeiwpsIyz7AVl9Rx5PuKYhWUYrQWYNveTcvvQhoAsfJeQgiwh2w PsBFyUCjVYJ7VplsjWB6FSh+rFDQ4nPoZW+6pPmk= From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> To: linux-kernel@vger.kernel.org Cc: rafael@kernel.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Yoshinori Sato <ysato@users.sourceforge.jp>, Rich Felker <dalias@libc.org>, linux-sh@vger.kernel.org Subject: [PATCH 16/36] sh: dma-sysfs: move to use bus_get_dev_root() Date: Mon, 13 Mar 2023 19:28:58 +0100 Message-Id: <20230313182918.1312597-16-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313182918.1312597-1-gregkh@linuxfoundation.org> References: <20230313182918.1312597-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1572; i=gregkh@linuxfoundation.org; h=from:subject; bh=eoKf67z0RJnZv79uQSS4O970nfxW9TSz1wAks4pBByU=; b=owGbwMvMwCRo6H6F97bub03G02pJDCn82RUr5qbG39X19HhySf2YgPJ/t03OPxNClzwy1S/Xa WhO6kvriGVhEGRikBVTZPmyjefo/opDil6Gtqdh5rAygQxh4OIUgIn8zmOYZx1QlT3lkf7i13dq n6S0JTTeSZ+oxTA/OMiUfd234PQVsRfPuGhWvrl8otkTAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit 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 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760279461030892811?= X-GMAIL-MSGID: =?utf-8?q?1760279461030892811?= |
Series |
[01/36] EDAC/sysfs: move to use bus_get_dev_root()
|
|
Commit Message
Greg KH
March 13, 2023, 6:28 p.m. UTC
Direct access to the struct bus_type dev_root pointer is going away soon
so replace that with a call to bus_get_dev_root() instead, which is what
it is there for.
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: linux-sh@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
Note, this is a patch that is a prepatory cleanup as part of a larger
series of patches that is working on resolving some old driver core
design mistakes. It will build and apply cleanly on top of 6.3-rc2 on
its own, but I'd prefer if I could take it through my driver-core tree
so that the driver core changes can be taken through there for 6.4-rc1.
arch/sh/drivers/dma/dma-sysfs.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
Comments
On Mon, 2023-03-13 at 19:28 +0100, Greg Kroah-Hartman wrote: > Direct access to the struct bus_type dev_root pointer is going away soon > so replace that with a call to bus_get_dev_root() instead, which is what > it is there for. > > Cc: Yoshinori Sato <ysato@users.sourceforge.jp> > Cc: Rich Felker <dalias@libc.org> > Cc: linux-sh@vger.kernel.org > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > --- > Note, this is a patch that is a prepatory cleanup as part of a larger > series of patches that is working on resolving some old driver core > design mistakes. It will build and apply cleanly on top of 6.3-rc2 on > its own, but I'd prefer if I could take it through my driver-core tree > so that the driver core changes can be taken through there for 6.4-rc1. > > arch/sh/drivers/dma/dma-sysfs.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/arch/sh/drivers/dma/dma-sysfs.c b/arch/sh/drivers/dma/dma-sysfs.c > index 8ef318150f84..431bc18f0a41 100644 > --- a/arch/sh/drivers/dma/dma-sysfs.c > +++ b/arch/sh/drivers/dma/dma-sysfs.c > @@ -45,13 +45,19 @@ static DEVICE_ATTR(devices, S_IRUGO, dma_show_devices, NULL); > > static int __init dma_subsys_init(void) > { > + struct device *dev_root; > int ret; > > ret = subsys_system_register(&dma_subsys, NULL); > if (unlikely(ret)) > return ret; > > - return device_create_file(dma_subsys.dev_root, &dev_attr_devices); > + dev_root = bus_get_dev_root(&dma_subsys); > + if (dev_root) { > + ret = device_create_file(dev_root, &dev_attr_devices); > + put_device(dev_root); > + } > + return ret; > } > postcore_initcall(dma_subsys_init); > Acked-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Hi Greg! On Mon, 2023-03-13 at 19:28 +0100, Greg Kroah-Hartman wrote: > Direct access to the struct bus_type dev_root pointer is going away soon > so replace that with a call to bus_get_dev_root() instead, which is what > it is there for. > > Cc: Yoshinori Sato <ysato@users.sourceforge.jp> > Cc: Rich Felker <dalias@libc.org> > Cc: linux-sh@vger.kernel.org > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > --- > Note, this is a patch that is a prepatory cleanup as part of a larger > series of patches that is working on resolving some old driver core > design mistakes. It will build and apply cleanly on top of 6.3-rc2 on > its own, but I'd prefer if I could take it through my driver-core tree > so that the driver core changes can be taken through there for 6.4-rc1. > > arch/sh/drivers/dma/dma-sysfs.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/arch/sh/drivers/dma/dma-sysfs.c b/arch/sh/drivers/dma/dma-sysfs.c > index 8ef318150f84..431bc18f0a41 100644 > --- a/arch/sh/drivers/dma/dma-sysfs.c > +++ b/arch/sh/drivers/dma/dma-sysfs.c > @@ -45,13 +45,19 @@ static DEVICE_ATTR(devices, S_IRUGO, dma_show_devices, NULL); > > static int __init dma_subsys_init(void) > { > + struct device *dev_root; > int ret; > > ret = subsys_system_register(&dma_subsys, NULL); > if (unlikely(ret)) > return ret; > > - return device_create_file(dma_subsys.dev_root, &dev_attr_devices); > + dev_root = bus_get_dev_root(&dma_subsys); > + if (dev_root) { > + ret = device_create_file(dev_root, &dev_attr_devices); > + put_device(dev_root); > + } > + return ret; > } > postcore_initcall(dma_subsys_init); > After acking this, I noticed that if bus_get_dev_root() fails, "ret" remains set to the value by subsys_system_register() which might confuse the caller thinking that dma_subsys_init() succeeded unless I am missing something? Adrian
diff --git a/arch/sh/drivers/dma/dma-sysfs.c b/arch/sh/drivers/dma/dma-sysfs.c index 8ef318150f84..431bc18f0a41 100644 --- a/arch/sh/drivers/dma/dma-sysfs.c +++ b/arch/sh/drivers/dma/dma-sysfs.c @@ -45,13 +45,19 @@ static DEVICE_ATTR(devices, S_IRUGO, dma_show_devices, NULL); static int __init dma_subsys_init(void) { + struct device *dev_root; int ret; ret = subsys_system_register(&dma_subsys, NULL); if (unlikely(ret)) return ret; - return device_create_file(dma_subsys.dev_root, &dev_attr_devices); + dev_root = bus_get_dev_root(&dma_subsys); + if (dev_root) { + ret = device_create_file(dev_root, &dev_attr_devices); + put_device(dev_root); + } + return ret; } postcore_initcall(dma_subsys_init);