Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp10730649rwl; Mon, 2 Jan 2023 07:19:42 -0800 (PST) X-Google-Smtp-Source: AMrXdXuj7AifSvuOv4Tx0RmMy3xutOcAm4AcrDSAcm12uxx0kkXRMqOSsO/BiyOLbXIXd+kQk9oa X-Received: by 2002:a17:903:264c:b0:192:85fe:9f0a with SMTP id je12-20020a170903264c00b0019285fe9f0amr24975000plb.69.1672672782054; Mon, 02 Jan 2023 07:19:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672672782; cv=none; d=google.com; s=arc-20160816; b=peMK2Jfd/EPZLm5b4hdcz5QsQjwCoeHQ+eG2lTFfDXZzzugMGZSB2NAbs2Ce9JFGr3 li9LEPPJ3aLUNaJ4dRl1+iYwRDMzcQ/y9zTgLym8EWb9TmiQWAkrlZ9MEhwGHykrTIV5 oKgnUjyCykbh1NfC5kwmG/tSPXVWREZYr1eJpaNFohUYRTC0i+E75hVaUHRXafaeco1e uZ1VI/E2OS21cqkjDZCQlxnNMU2LT8BS+h1IEReRRrQFHZfeNOeBHzP/bCPDIASvfiBj 3mxXksidHSXkUcxMO7G+YG5c9ha8jpTcbnZG89oB0HpwcztcDyQhbmupAeEmHxhsqC8C Usdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Py+mEqQrMGrkTWxmxdenUzEXoKA3++r71/dyBxZERsw=; b=EMIDrPRrwwQsmq+D8vhqXIpCdOwMRM1MwkELQjflVydH57hOfyJVREx5owNx8ER/Ih 5FeQNmkTvPF2UWdbNVexWpI5WiX116vJ65LPTQQKyEwZ7TS9d4gUNH4GAZ6wWQvGjPJ9 2xJ7dNlh65huN5v8CDhzOboL7zFKtte01/e8Ue8BNAXS0hIHMryHVi+G1zr8L8OJ5bNV QAM+2CLN9oTM3zPPoy8DPdDqgX+XxO/MpBQBPPGE1pRklmwTZWVFnvX8MCk/aGags9L4 VC4LH5vbbVTGi9W7zIAE/nePMmFgmgrRF74LPyf2+c4ZBJQeOkM5nUnkjuWK4rQckRxc jppw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XqAPGNKY; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020a170903124b00b00188d892999esi35746850plh.521.2023.01.02.07.19.33; Mon, 02 Jan 2023 07:19:42 -0800 (PST) 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=@linaro.org header.s=google header.b=XqAPGNKY; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236276AbjABPIB (ORCPT + 61 others); Mon, 2 Jan 2023 10:08:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236242AbjABPHt (ORCPT ); Mon, 2 Jan 2023 10:07:49 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF44B9585 for ; Mon, 2 Jan 2023 07:07:42 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id y19so10735430plb.2 for ; Mon, 02 Jan 2023 07:07:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Py+mEqQrMGrkTWxmxdenUzEXoKA3++r71/dyBxZERsw=; b=XqAPGNKYWKsdaCjTLnL19DjUzyvHU1zDCW+L9YztruS26V5NLRL+50aGaQ0+n4MPfH qipaSASdXYBD80SNIVtmnM6eaTylCiYgyg1aO0KBSXzpYp3biaY32Ij0wynLb/ypdHyJ C74mNjYFAJFiBEfm2rINUile4beFOFRNp0EB7FD9ZU64HIKoYuTJQhYMG1B7c5To2MLv qENvQUSxOT2OZXLmPA6b6B4Xy6NptV0rLcYLIArt47DQJBTZP9rNvbMUHhQWyzW3LJrn /lcGBkXao5Xr8s0NSyz6XskOSD1PR+WNN0EU+oWzz+6xjX8yGgBv/s7Fp6imMzA/7GDJ l1cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Py+mEqQrMGrkTWxmxdenUzEXoKA3++r71/dyBxZERsw=; b=tLm/avK9RBtSkp3DtcMjTrWEafSGuXivhgzR5o0WDeDEsn0AMS6arFBeRGzY3upcLy 5BNsX5YDlOSXirLKEE/JbZRW1b4g76BWGqQaqBz5EwpygTa9PpoOVXXn+fDvSkfswR56 4Qj8DSmd4V9kqwRkuZ5nmV5PSGhgeheNgkYeK7EFXl/TlrTBM8Wt5WvCtYXYkxbeDXh5 XXYvNu5ATW49c67iMSFC/JJ5knA7/QtlYRigW1OeBCOu0u5Gk18ZxFVcTIeS7f6naddq G3pkUTGWdPQrs9obt2+kwUvKTs9jEX5PguXg6QGtD/fmCRpRSj5nx5f6pxuZEtq2A4sb xi+A== X-Gm-Message-State: AFqh2kpcylUhUqcol61KTqr2Ivg22zfFsa+WD6pCh2z70kH0vrkuCG5j 2dsa7GzeeVYDoQzQnO2Ck3inu0KIUJuBFgK7tARQag== X-Received: by 2002:a17:902:b902:b0:190:e27b:b554 with SMTP id bf2-20020a170902b90200b00190e27bb554mr2443908plb.148.1672672062362; Mon, 02 Jan 2023 07:07:42 -0800 (PST) MIME-Version: 1.0 References: <20221226073908.17317-1-balamanikandan.gunasundar@microchip.com> <20221226073908.17317-2-balamanikandan.gunasundar@microchip.com> In-Reply-To: From: Ulf Hansson Date: Mon, 2 Jan 2023 16:07:06 +0100 Message-ID: Subject: Re: [PATCH v3 1/2] mmc: atmel-mci: Convert to gpio descriptors To: Balamanikandan Gunasundar , Linus Walleij Cc: ludovic.desroches@microchip.com, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, hari.prasathge@microchip.com, dmitry.torokhov@gmail.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 29 Dec 2022 at 01:23, Linus Walleij wrote: > > Hi Balamanikandan, > > thanks for your patch! > > On Mon, Dec 26, 2022 at 8:39 AM Balamanikandan Gunasundar > wrote: > > > Replace the legacy GPIO APIs with gpio descriptor consumer interface. > > > > To maintain backward compatibility, we rely on the "cd-inverted" > > property to manage the invertion flag instead of GPIO property. > > > > Signed-off-by: Balamanikandan Gunasundar > > Overall this looks really nice! I thought about converting this driver > but was a bit afraid of doing mistakes since it was a bit elaborate. > Nice that you use fwnode accessors! > > Acked-by: Linus Walleij Linus, thanks for helping out by reviewing this! > > Improvement to consider (can also be a separate patch): I tried to apply the $subject patch as is, but it failed. It needs to be rebased on top of my latest next branch. Please re-spin and if possible, consider incorporating Linus's suggestions too as part of the series. Kind regards Uffe > > > + if (slot->detect_pin) { > > + present = !(gpiod_get_raw_value(slot->detect_pin) ^ > > slot->detect_is_active_high); > > Normally we contain all this active low/high mess in mmc_of_parse(), > but I guess this doesn't work here because the of node is different > from the device :P > > Since the code says *explicitly* "active high" not "inverted" as the > core code parses it, could you try just push this to gpiolib like > we usually do, by deleting the detect_is_active_high stuff and > just apply a patch like this? > > diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c > index 4fff7258ee41..5979c9a75cf9 100644 > --- a/drivers/gpio/gpiolib-of.c > +++ b/drivers/gpio/gpiolib-of.c > @@ -199,7 +199,9 @@ static void of_gpio_set_polarity_by_property(const > struct device_node *np, > { "fsl,imx8mm-pcie", "reset-gpio", "reset-gpio-active-high" }, > { "fsl,imx8mp-pcie", "reset-gpio", "reset-gpio-active-high" }, > #endif > - > +#if IS_ENABLED(CONFIG_MMC_ATMELMCI) > + { "atmel,hsmci", "cd-gpios", "cd-inverted" }, > +#endif > /* > * The regulator GPIO handles are specified such that the > * presence or absence of "enable-active-high" solely controls > > (It's fine to include in your MMC patch if some GPIO maintainer like > me ACK it.) > > Yours, > Linus Walleij