Message ID | 20231023162659.81397-1-afd@ti.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1410840vqx; Mon, 23 Oct 2023 09:27:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHPh3WD9Z0f5ROgmg3YWxNa2c29WyHz4ldvTDAnaUokkysjI4BoW+KDyr1yu6SiOP2Vfho9 X-Received: by 2002:a17:90b:3c0b:b0:27d:98f3:21a5 with SMTP id pb11-20020a17090b3c0b00b0027d98f321a5mr7030462pjb.24.1698078460223; Mon, 23 Oct 2023 09:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698078460; cv=none; d=google.com; s=arc-20160816; b=b3ipwxMe7Z615IsbvxK7u4pirWNhpJgGhEs3Xbitl5bQCcxnUoSUQvEUgdI/lZY7cM HrCqNjfgOj2+BTgOtqFNi2TmGQp1gE0B97Tsxw3ICX57PNuLNlipgXOeiw5c/U4y8FUp /9D+F3HykfCJVt22JATdBACM6PhTCdBWDTFzR82+k1YWZf0tmLJQj1T0tSEzYYJboox/ lvknS327DHaUVbufFLO2li2a3diYRmj8H/7PnQ4eE1gliFK9cN40CfoXFhC2bSyH6Egn fbLTouIroVwzbHmKidB74hptC1L8zCAmQEoJ4Zm3SJBQm9MII+9XjJe7/zMzrfaoHpc+ MPmg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=jtWF08naILkon915EMffsBHZ2FAx71FsAsp0B6E5a0A=; fh=+X1Cf9SyJlg5zvVqn0eAXHzZQfabkHWxlWEL9DjfXNc=; b=OJiYJTjoVLkyOA/6wGtoa9glgZoaHoyuGgiZ4TkA8fG9+nDh1xdf/nwunl+u9vpj5E aoJenK6mKVPaH72TzyN9z2bPdOE05wVcKkCQoTb7HUFmHCLxWrjP+nrWHH3cMAF0cRFk EsWrtpHZW1AlkD3hSUGQQ31ub1MB0O9I3bGZmtxFKyHq+lIu3/TVlWuZ7OB6MGZniu1z Sf24Fth0WRpeUGWMaaWP4fk9CqpBtYZvHD8cciUOjuS3dz4GXcYLPjOFyKSzYjl18xcD scjpRtZH/pRZvXX9u3kcMOJ2t9Fjmef8F6zry8dtVDu6IPc8cPuG/pezyzoXg0t3regV rv2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tDZauvxm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id t16-20020a17090aba9000b0027d1aed872dsi6769298pjr.95.2023.10.23.09.27.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 09:27:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tDZauvxm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id ED74180B1802; Mon, 23 Oct 2023 09:27:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233142AbjJWQ1R (ORCPT <rfc822;aposhian.dev@gmail.com> + 27 others); Mon, 23 Oct 2023 12:27:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233789AbjJWQ1L (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 23 Oct 2023 12:27:11 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D576E5; Mon, 23 Oct 2023 09:27:09 -0700 (PDT) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 39NGR1AZ104142; Mon, 23 Oct 2023 11:27:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1698078421; bh=jtWF08naILkon915EMffsBHZ2FAx71FsAsp0B6E5a0A=; h=From:To:CC:Subject:Date; b=tDZauvxmMBt/rPVm+YSnBky1Gh/yefYbWukB4ZrEqYWMoiaa5017tILg4I2IGehZU TACTR9eFhTe61T3F/tjpI5mIKIK29NkQNjQCjHifuQqghXZKI/A7Sr9D3QApA3p1O5 sdNdM/+9NQ0pBQV7+wNvmWWU9Ss+urtSCGW//Q7I= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 39NGR1Fp094422 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 23 Oct 2023 11:27:01 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 23 Oct 2023 11:27:01 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 23 Oct 2023 11:27:01 -0500 Received: from fllv0039.itg.ti.com (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 39NGR00G081049; Mon, 23 Oct 2023 11:27:00 -0500 From: Andrew Davis <afd@ti.com> To: Peter Rosin <peda@axentia.se>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Nishanth Menon <nm@ti.com>, Vignesh Raghavendra <vigneshr@ti.com> CC: <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Andrew Davis <afd@ti.com> Subject: [PATCH v4] mux: mmio: use reg property when parent device is not a syscon Date: Mon, 23 Oct 2023 11:26:59 -0500 Message-ID: <20231023162659.81397-1-afd@ti.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 23 Oct 2023 09:27:38 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780285042972971141 X-GMAIL-MSGID: 1780564319388076382 |
Series |
[v4] mux: mmio: use reg property when parent device is not a syscon
|
|
Commit Message
Andrew Davis
Oct. 23, 2023, 4:26 p.m. UTC
The DT binding for the reg-mux compatible states it can be used when the "parent device of mux controller is not syscon device". It also allows for a reg property. When the reg property is provided, use that to identify the address space for this mux. If not provided fallback to using the parent device as a regmap provider. While here use dev_err_probe() in the error path to prevent printing a message on probe defer which now can happen in extra ways. Signed-off-by: Andrew Davis <afd@ti.com> Reviewed-by: Nishanth Menon <nm@ti.com> --- Changes from v3: - Check for probe defer Changes from v2: - Rebased on v6.6-rc1 Changes from v1: - Flip logic as suggested in v1[0] [0] https://lore.kernel.org/lkml/1c27d9d4-b1cc-c158-90f7-f7e47e02c424@ti.com/T/ drivers/mux/mmio.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
Comments
Hi! 2023-10-23 at 18:26, Andrew Davis wrote: > The DT binding for the reg-mux compatible states it can be used when the > "parent device of mux controller is not syscon device". It also allows > for a reg property. When the reg property is provided, use that to > identify the address space for this mux. If not provided fallback to > using the parent device as a regmap provider. > > While here use dev_err_probe() in the error path to prevent printing > a message on probe defer which now can happen in extra ways. > > Signed-off-by: Andrew Davis <afd@ti.com> > Reviewed-by: Nishanth Menon <nm@ti.com> > --- > > Changes from v3: > - Check for probe defer > > Changes from v2: > - Rebased on v6.6-rc1 > > Changes from v1: > - Flip logic as suggested in v1[0] > > [0] https://lore.kernel.org/lkml/1c27d9d4-b1cc-c158-90f7-f7e47e02c424@ti.com/T/ > > drivers/mux/mmio.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c > index fd1d121a584ba..07c99588ff999 100644 > --- a/drivers/mux/mmio.c > +++ b/drivers/mux/mmio.c > @@ -44,14 +44,17 @@ static int mux_mmio_probe(struct platform_device *pdev) > int ret; > int i; > > - if (of_device_is_compatible(np, "mmio-mux")) > + if (of_device_is_compatible(np, "mmio-mux")) { > regmap = syscon_node_to_regmap(np->parent); > - else > - regmap = dev_get_regmap(dev->parent, NULL) ?: ERR_PTR(-ENODEV); > + } else { > + regmap = device_node_to_regmap(np); > + /* Fallback to checking the parent node on any error other than probe defer */ > + if (IS_ERR(regmap) && regmap != ERR_PTR(-EPROBE_DEFER)) > + regmap = dev_get_regmap(dev->parent, NULL) ?: ERR_PTR(-ENODEV); I'm not too fond of overly long lines, and the coding style document agrees with me. Also, please end comments with a period. /* Fallback to checking the parent node on "real" errors. */ if (IS_ERR(regmap) && regmap != ERR_PTR(-EPROBE_DEFER)) { regmap = dev_get_regmap(dev->parent, NULL); if (!regmap) regmap = ERR_PTR(-ENODEV); } > + } > if (IS_ERR(regmap)) { > ret = PTR_ERR(regmap); > - dev_err(dev, "failed to get regmap: %d\n", ret); > - return ret; > + return dev_err_probe(dev, ret, "failed to get regmap\n"); > } Now that you use dev_err_probe(), please drop the pointless ret assignment: if (IS_ERR(regmap)) return dev_err_probe(dev, PTR_ERR(regmap), "failed to get regmap\n"); With those changes, you can add "Acked-by: Peter Rosin <peda@axentia.se>", so that Greg can pick it up. Cheers, Peter > > ret = of_property_count_u32_elems(np, "mux-reg-masks");
diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c index fd1d121a584ba..07c99588ff999 100644 --- a/drivers/mux/mmio.c +++ b/drivers/mux/mmio.c @@ -44,14 +44,17 @@ static int mux_mmio_probe(struct platform_device *pdev) int ret; int i; - if (of_device_is_compatible(np, "mmio-mux")) + if (of_device_is_compatible(np, "mmio-mux")) { regmap = syscon_node_to_regmap(np->parent); - else - regmap = dev_get_regmap(dev->parent, NULL) ?: ERR_PTR(-ENODEV); + } else { + regmap = device_node_to_regmap(np); + /* Fallback to checking the parent node on any error other than probe defer */ + if (IS_ERR(regmap) && regmap != ERR_PTR(-EPROBE_DEFER)) + regmap = dev_get_regmap(dev->parent, NULL) ?: ERR_PTR(-ENODEV); + } if (IS_ERR(regmap)) { ret = PTR_ERR(regmap); - dev_err(dev, "failed to get regmap: %d\n", ret); - return ret; + return dev_err_probe(dev, ret, "failed to get regmap\n"); } ret = of_property_count_u32_elems(np, "mux-reg-masks");