From nobody Tue Sep 29 00:33:20 2026 Received: from cstnet.cn (smtp21.cstnet.cn [159.226.251.21]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1DD041F349 for ; Fri, 14 Aug 2026 07:50:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.226.251.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786693832; cv=none; b=bbREYjznNhadiQEgcXw0X/ItVY3qv2/1ZrFvUAsd2cgsj2VOfqPPVoma7Re8z7FNuc/PE0l+fw5id6IocPg+ex3DsCRIUwj4wyIlZ9vgg922/klbfkkK+3/dvuApMppDk2AZMCMAG8yUvZZ/xUuhgy+UyKQ3KZgOFOJUvxM7dmc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786693832; c=relaxed/simple; bh=aL84np01b4e38YT1mdnDLtM3mBXRkrAge0iNfAS1ZaA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=sidxMEEwsO0oYGT04y3Hfd3KcYZ89GetyTmTKtqslUj557ejihjCMjMq6C6aajHNEbwNbjYiAIlB8vCKrh1D/0nYKiN5x0mT3cmKNC7raY/T1O7DG7/l5gMOAa41H9YJQeSHGAsShjiAsht2RYJnMcNzOS7XTwV67656O/54kgM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn; spf=pass smtp.mailfrom=iscas.ac.cn; arc=none smtp.client-ip=159.226.251.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iscas.ac.cn Received: from localhost.localdomain (unknown [111.196.241.250]) by APP-01 (Coremail) with SMTP id qwCowAC3ie2xyH5q21KeBQ--.63393S2; Fri, 14 Aug 2026 15:50:10 +0800 (CST) From: Pengpeng Hou To: Eddie James , Ninad Palsule Cc: Joel Stanley , Andrew Jeffery , Ryan Chen , Billy Tsai , linux-fsi@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, Pengpeng Hou Subject: [PATCH v2] fsi: aspeed: publish cfam_reset through driver groups Date: Fri, 14 Aug 2026 15:50:08 +0800 Message-ID: <20260814075008.9031-1-pengpeng@iscas.ac.cn> X-Mailer: git-send-email 2.50.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: qwCowAC3ie2xyH5q21KeBQ--.63393S2 X-Coremail-Antispam: 1UD129KBjvJXoWxGF47XFW7XrWUur1kGFW8Xrb_yoW5uF4kpa 97WFWYgr48Gr1fJayDJan2v3WF9w4rtrWUGr4fKw1S9asxAa4YqryxtrWIvF1xZFWrCF15 Jr1Dt3yUuF4kZr7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9Y14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r4j6ryUM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j 6F4UM28EF7xvwVC2z280aVAFwI0_Cr1j6rxdM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628v n2kIc2xKxwCY1x0262kKe7AKxVWUtVW8ZwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7x kEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E 67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCw CI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1x MIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr1j6F4UJbIYCT nIWIevJa73UjIFyTuYvjfUonmRUUUUU X-CM-SenderInfo: pshqw1xhqjqxpvfd2hldfou0/ The cfam_reset attribute currently gets created manually while probe is still initializing the master. Its store callback expects device drvdata and the master's mutex to be ready, and manual publication also requires matching cleanup on every later failure and remove path. Expose the attribute through the driver's default groups instead. The driver core publishes those groups only after probe succeeds. Hide the attribute when the optional reset GPIO is unavailable, while retaining probe deferral and other GPIO acquisition errors. Fixes: 4a851d714eade ("fsi: aspeed: Support CFAM reset GPIO") Assisted-by: Codex:gpt-5 Signed-off-by: Pengpeng Hou --- Changes since v1: https://lore.kernel.org/all/20260615065944.34767-1-pengpe= ng@iscas.ac.cn/ - replace manual sysfs publication with driver-core groups and is_visible() - preserve optional-GPIO and probe-deferral error semantics - remove manual sysfs unwind paths The probe/publication ordering was reviewed statically; no Aspeed FSI hardware test was performed. drivers/fsi/fsi-master-aspeed.c | 38 ++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspee= d.c index aa1380cdff33..ac05e1a263ac 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -464,26 +464,42 @@ static ssize_t cfam_reset_store(struct device *dev, s= truct device_attribute *att =20 static DEVICE_ATTR(cfam_reset, 0200, NULL, cfam_reset_store); =20 +static umode_t fsi_master_aspeed_attr_is_visible(struct kobject *kobj, + struct attribute *attr, int n) +{ + struct fsi_master_aspeed *aspeed =3D dev_get_drvdata(kobj_to_dev(kobj)); + + if (!aspeed || !aspeed->cfam_reset_gpio) + return 0; + + return attr->mode; +} + +static struct attribute *fsi_master_aspeed_attrs[] =3D { + &dev_attr_cfam_reset.attr, + NULL, +}; + +static const struct attribute_group fsi_master_aspeed_group =3D { + .attrs =3D fsi_master_aspeed_attrs, + .is_visible =3D fsi_master_aspeed_attr_is_visible, +}; + +static const struct attribute_group *fsi_master_aspeed_groups[] =3D { + &fsi_master_aspeed_group, + NULL, +}; + static int setup_cfam_reset(struct fsi_master_aspeed *aspeed) { struct device *dev =3D aspeed->dev; struct gpio_desc *gpio; - int rc; =20 gpio =3D devm_gpiod_get_optional(dev, "cfam-reset", GPIOD_OUT_LOW); if (IS_ERR(gpio)) return PTR_ERR(gpio); - if (!gpio) - return 0; =20 aspeed->cfam_reset_gpio =3D gpio; - - rc =3D device_create_file(dev, &dev_attr_cfam_reset); - if (rc) { - devm_gpiod_put(dev, gpio); - return rc; - } - return 0; } =20 @@ -573,6 +589,7 @@ static int fsi_master_aspeed_probe(struct platform_devi= ce *pdev) rc =3D setup_cfam_reset(aspeed); if (rc) { dev_err(&pdev->dev, "CFAM reset GPIO setup failed\n"); + goto err_release; } =20 writel(0x1, aspeed->base + OPB_CLK_SYNC); @@ -664,6 +681,7 @@ static struct platform_driver fsi_master_aspeed_driver = =3D { .driver =3D { .name =3D "fsi-master-aspeed", .of_match_table =3D fsi_master_aspeed_match, + .dev_groups =3D fsi_master_aspeed_groups, }, .probe =3D fsi_master_aspeed_probe, .remove =3D fsi_master_aspeed_remove, --=20 2.50.1 (Apple Git-155)