From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE596C433E2 for ; Thu, 18 Jun 2020 17:34:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3D9D6208B8 for ; Thu, 18 Jun 2020 17:34:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HzCFkYdX"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iiqRWOJe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3D9D6208B8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bjBHLodWQ4wNtydhsNgq2J2OnzeeJ/PRWzg4kMyDEo4=; b=HzCFkYdXttNctC BesBWTQQnHf/+aq23t+Szh97KKQxKGHR/i/U+nY0u1EbDQpMKdHDCEHD8cQ3FKsqs84rgJvxV6GSu 0peE74KaGTr79GSe1ugj6NnYnLTW+IAxv/jkH7jV3yddJ8Q6w4WT5XhmbNsJqrH2eXEIC/sM9VlmF Qf6oTQxgyrtQsObVofB9owatYBqkdx3aEKFtjtnI5fvCKYmaQs+9BKSNL39L2+sHkcLeq3RLoPbnB xMoO9tcnGxPQWwjZdjWgnAriEDKUDCcxjig4LNG8NlIDDvA22QzPC2R6RqBOs0K6fhKchjs17xx4U yz4aR53cx2ikKh/mr1EQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jlyQY-0003ug-D0; Thu, 18 Jun 2020 17:34:14 +0000 Received: from mail-qv1-xf44.google.com ([2607:f8b0:4864:20::f44]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jlyQU-0003u5-Sn for linux-arm-kernel@lists.infradead.org; Thu, 18 Jun 2020 17:34:12 +0000 Received: by mail-qv1-xf44.google.com with SMTP id cv17so3127601qvb.13 for ; Thu, 18 Jun 2020 10:34:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=HEt4Pvebw1D02KEOJn4E0FCDzL41oY+kb0al+hZuU00=; b=iiqRWOJedzCE0nYhPevpMxA8E6GErKmVq3eX5LGN4vJS4nnKZIA9PyIsZHpqjFGHVs p/LDOiY/w5n9vRMD7htsyddAZewMnIg5W4pcBuRm+vrc+l3pTEy2OhoRkstG43xS/U5l 5BH2Ab5f8LC6ee+/Yn49oZvorgfF2aKN/i36uBuXFkxWluqJk3sCJQc4c3BgmbyLlUGz Ciy8z6wf1a5LrL9jGISLUlgKWKymwDUpxbumR2Ra4OKxnycymndz8538yK+RCIA7yQCS fubzWDqY3Ao/URof858vU9iylT4IqHWKeAfrLSinM68jauqU8TGW5Av2d0RTtNzqyoI3 MfKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HEt4Pvebw1D02KEOJn4E0FCDzL41oY+kb0al+hZuU00=; b=Ao9sSeL0juzkyWpqQ4wctvmkDxAsQUt6tp40RatXl0esL8+Hskcy6DAxPZpEJTpWoT VtUpw/ugO5xvZ3/DdvS4gu9hdDhxMC52aowckqXK812Jsm3R79Fh3rgfUL4B7sluENcm 6qtKiwDJFO+X/9CXrceyEE4HQ9DvBXCTJp/1KgWqhojhOZ6wD8cUnS5xg05XNXSS7AbO 9l+Dozree/DBscvDpbpu9XCnF1vY+gHI/YcZHl4B1s5DbEzqi2DUuC00MKwn2bp8Oysw fvmOIexfSPKRnk3Z48Wwqw1fq3m0E4meNm8KpBxgEcVfL2tuKvrXyltxlg06mYmj+d8F J9hQ== X-Gm-Message-State: AOAM53220ShahtO+WQGgsLv1bTRbOkzDcvu5TVRrmYPphAZ+I1KBx3xP UbJyhXPgZXlZjrfx0CivnWM= X-Google-Smtp-Source: ABdhPJzf++G2jVb6Z9CC0IL2NDF9hkq8ySX+4NfRd5wM/n+z3/yS5T9b//i24vaF/xge3XVL62440w== X-Received: by 2002:a05:6214:9ce:: with SMTP id dp14mr4790257qvb.216.1592501649452; Thu, 18 Jun 2020 10:34:09 -0700 (PDT) Received: from [192.168.1.46] (c-73-88-245-53.hsd1.tn.comcast.net. [73.88.245.53]) by smtp.gmail.com with ESMTPSA id n13sm4307698qtf.35.2020.06.18.10.34.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Jun 2020 10:34:08 -0700 (PDT) Subject: Re: [PATCH v2 1/3] mfd: core: Make a best effort attempt to match devices with the correct of_nodes To: Lee Jones References: <20200611191002.2256570-1-lee.jones@linaro.org> <4b188fb5-6667-720d-46e1-6f103efe8966@gmail.com> <20200615092644.GA2608702@dell> From: Frank Rowand Message-ID: Date: Thu, 18 Jun 2020 12:34:07 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200615092644.GA2608702@dell> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200618_103410_927196_3C30ADC0 X-CRM114-Status: GOOD ( 18.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, gregkh@linuxfoundation.org, broonie@kernel.org, michael@walle.cc, linux-kernel@vger.kernel.org, andy.shevchenko@gmail.com, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org, andriy.shevchenko@linux.intel.com, robin.murphy@arm.com, linus.walleij@linaro.org, linux@roeck-us.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2020-06-15 04:26, Lee Jones wrote: > On Sun, 14 Jun 2020, Frank Rowand wrote: > >> Hi Lee, >> >> I'm looking at 5.8-rc1. >> >> The only use of OF_MFD_CELL() where the same compatible is specified >> for multiple elements of a struct mfd_cell array is for compatible >> "stericsson,ab8500-pwm" in drivers/mfd/ab8500-core.c: >> >> OF_MFD_CELL("ab8500-pwm", >> NULL, NULL, 0, 1, "stericsson,ab8500-pwm"), >> OF_MFD_CELL("ab8500-pwm", >> NULL, NULL, 0, 2, "stericsson,ab8500-pwm"), >> OF_MFD_CELL("ab8500-pwm", >> NULL, NULL, 0, 3, "stericsson,ab8500-pwm"), OF_MFD_CELL("ab8500-pwm", NULL, NULL, 0, 0, "stericsson,ab8500-pwm"), OF_MFD_CELL_REG("ab8500-pwm-mc", NULL, NULL, 0, 0, "stericsson,ab8500-pwm", 0), OF_MFD_CELL_REG("ab8500-pwm-mc", NULL, NULL, 0, 1, "stericsson,ab8500-pwm", 1), OF_MFD_CELL_REG("ab8500-pwm-mc", NULL, NULL, 0, 2, "stericsson,ab8500-pwm", 2), >> >> The only .dts or .dtsi files where I see compatible "stericsson,ab8500-pwm" >> are: >> >> arch/arm/boot/dts/ste-ab8500.dtsi >> arch/arm/boot/dts/ste-ab8505.dtsi >> >> These two .dtsi files only have a single node with this compatible. >> Chasing back to .dts and .dtsi files that include these two .dtsi >> files, I see no case where there are multiple nodes with this >> compatible. >> >> So it looks to me like there is no .dts in mainline that is providing >> the three "stericsson,ab8500-pwm" nodes that drivers/mfd/ab8500-core.c >> is expecting. No case that there are multiple mfd child nodes where >> mfd_add_device() would assign the first of n child nodes with the >> same compatible to multiple devices. >> >> So it appears to me that drivers/mfd/ab8500-core.c is currently broken. >> Am I missing something here? >> >> If I am correct, then either drivers/mfd/ab8500-core.c or >> ste-ab8500.dtsi and ste-ab8505.dtsi need to be fixed. > > Your analysis is correct. OK, if I'm not overlooking anything, that is good news. Existing .dts source files only have one "ab8500-pwm" child. They already work correcly. Create a new compatible for the case of multiple children. In my example I will add "-mc" (multiple children) to the existing compatible. There is likely a better name, but this lets me provide an example. Modify drivers/mfd/ab8500-core.c to use the new compatible, and new .dts source files with multiple children use the new compatible: OF_MFD_CELL("ab8500-pwm", NULL, NULL, 0, 0, "stericsson,ab8500-pwm"), OF_MFD_CELL_REG("ab8500-pwm-mc", NULL, NULL, 0, 0, "stericsson,ab8500-pwm", 0), OF_MFD_CELL_REG("ab8500-pwm-mc", NULL, NULL, 0, 1, "stericsson,ab8500-pwm", 1), OF_MFD_CELL_REG("ab8500-pwm-mc", NULL, NULL, 0, 2, "stericsson,ab8500-pwm", 2), The "OF_MFD_CELL" entry is the existing entry, which will handle current .dts source files. The new "OF_MFD_CELL_REG" entries will handle new .dts source files. And of course the patch that creates OF_MFD_CELL_REG() needs to precede this change. I would remove the fallback code in the existing patch that tries to handle an incorrect binding. Just error out if the binding is not used properly. -Frank > > Although it's not "broken", it just works when it really shouldn't. > > I will be fixing the 'ab8500-pwm' case in due course. > >> Moving forward, your proposed OF_MFD_CELL_REG() method seems a good >> approach (I have not completely read the actual code in the patch yet >> though). > > Thanks. > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel