From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 153BE3803D2 for ; Thu, 4 Jun 2026 08:24:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780561474; cv=none; b=D1HiqaUh5FZNNfRfeYXyl2xj6ee6BEZHduo6KizMOcZArtG3b5LrekAW+is7wK+5h6ze5AlTB109kgydvDjs7NYenzTRpsFLlwf4dQXv+LbfC2z2LRLtewPMrq66Svs99A1hlHO4eXL2qg34fqaUAk78JrLCoxtXWY0Tmvs5/Jw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780561474; c=relaxed/simple; bh=ItZVIpPCgyL5nx+nGGOvCi+EgeZ5vNXFUGur22mF1lM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=blIopDdI/P8uHEv3GwUqiP7iiuDM7jUp0syeWBmcLu6n8CTHCCnPp6pfgAfDotI/NBRMYP1VmkFggqyrjdw+1n0vecurVV+ZBm92D5+9psz3vaxk7fYsfeAQlsV2WOibtZkiJ+PbVP4YrOxD2n+SyVYlvHB2dInV/CCov78Oa0g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=a/S06ixk; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="a/S06ixk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D57C41F00893; Thu, 4 Jun 2026 08:24:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780561472; bh=JulNNZEEG3FJVfWHiYWEV4D4RkEJCs5RPOKvt/BEQdw=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=a/S06ixk9dWQIHc+etNiH+Ckg+Uy1+kmYNwhxpL8UXxHFP7vqj5yUug4wb89eRy7E GBG6SUyNby291WPZ3wohMz0vfGCTNbXLpW9LBNTKlkf+jB7sfTC/pFftlBH+FouM2i 3BqCd6MnISoNUXNLo7JqdKi7G6dDCyPUOImVXD/UuC8ZcvqLxCfCyDnOaIn/4tNR+W QkaKEq33zvhwz/QrCaZTyzmvr5r74wHSqiRDie31jZ0Sq7d3I/dQb7Cm7cpcd/bOaB VM3ZZIxS6UOxKDxmOR+R6kDMFt9drWPsF+DaXhHSXgBZaCK6NgHVBjsppxzlPR0Ht8 xXKPXWMVvMtfg== Message-ID: <8a5a1bce-b841-4eff-ab3c-4f09a7ba3b60@kernel.org> Date: Thu, 4 Jun 2026 10:24:27 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RFT] powerpc/8xx: implement get_direction() in cpm1 To: Bartosz Golaszewski , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Linus Walleij , Dmitry Torokhov Cc: brgl@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20260603-powerpc-8xx-cpm1-get-dir-v1-1-2ae1c9a5b992@oss.qualcomm.com> Content-Language: fr-FR From: "Christophe Leroy (CS GROUP)" In-Reply-To: <20260603-powerpc-8xx-cpm1-get-dir-v1-1-2ae1c9a5b992@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Le 03/06/2026 à 10:26, Bartosz Golaszewski a écrit : > The lack of get_direction() callbacks in this driver causes GPIOLIB to > emit a warning. Implement them for 16- and 32-bit variants. > > Reported-by: Christophe Leroy > Closes: https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fall%2F63487206f6e5a93eaf9f41784317fe99d394312f.1780399750.git.chleroy%40kernel.org%2F&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C67d2207e02454f2ecf0008dec149d67c%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639160720043016747%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=k6%2FENNl94WS7QvRdhhmx8VvDyZKMNW8sAlKEq3AtQe4%3D&reserved=0 > Fixes: ec2cceadfae7 ("gpiolib: normalize the return value of gc->get() on behalf of buggy drivers") Isn't it e623c4303ed1 ("gpiolib: sanitize the return value of gpio_chip::get_direction()") ? > Signed-off-by: Bartosz Golaszewski > --- > Hi Christophe, please test if this works for you to silence the warning > from GPIO core. > --- > arch/powerpc/platforms/8xx/cpm1.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/arch/powerpc/platforms/8xx/cpm1.c b/arch/powerpc/platforms/8xx/cpm1.c > index f00734f0590cf7c7382f808dce27373d9ff3d8bc..b31376bf6778802a7f6b6b499066846b6b1f61e9 100644 > --- a/arch/powerpc/platforms/8xx/cpm1.c > +++ b/arch/powerpc/platforms/8xx/cpm1.c > @@ -472,6 +472,18 @@ static int cpm1_gpio16_dir_in(struct gpio_chip *gc, unsigned int gpio) > return 0; > } > > +static int cpm1_gpio16_get_direction(struct gpio_chip *gc, unsigned int gpio) > +{ > + struct cpm1_gpio16_chip *cpm1_gc = gpiochip_get_data(gc); > + struct cpm_ioport16 __iomem *iop = cpm1_gc->regs; > + u16 pin_mask = 1 << (15 - gpio); > + > + if (in_be16(&iop->dir) & pin_mask) > + return GPIO_LINE_DIRECTION_OUT; > + > + return GPIO_LINE_DIRECTION_IN; > +} > + > int cpm1_gpiochip_add16(struct device *dev) > { > struct device_node *np = dev->of_node; > @@ -498,6 +510,7 @@ int cpm1_gpiochip_add16(struct device *dev) > gc->ngpio = 16; > gc->direction_input = cpm1_gpio16_dir_in; > gc->direction_output = cpm1_gpio16_dir_out; > + gc->get_direction = cpm1_gpio16_get_direction; > gc->get = cpm1_gpio16_get; > gc->set = cpm1_gpio16_set; > gc->to_irq = cpm1_gpio16_to_irq; > @@ -604,6 +617,18 @@ static int cpm1_gpio32_dir_in(struct gpio_chip *gc, unsigned int gpio) > return 0; > } > > +static int cpm1_gpio32_get_direction(struct gpio_chip *gc, unsigned int gpio) > +{ > + struct cpm1_gpio32_chip *cpm1_gc = gpiochip_get_data(gc); > + struct cpm_ioport32b __iomem *iop = cpm1_gc->regs; > + u32 pin_mask = 1 << (31 - gpio); > + > + if (in_be32(&iop->dir) & pin_mask) > + return GPIO_LINE_DIRECTION_OUT; > + > + return GPIO_LINE_DIRECTION_IN; > +} > + > int cpm1_gpiochip_add32(struct device *dev) > { > struct device_node *np = dev->of_node; > @@ -621,6 +646,7 @@ int cpm1_gpiochip_add32(struct device *dev) > gc->ngpio = 32; > gc->direction_input = cpm1_gpio32_dir_in; > gc->direction_output = cpm1_gpio32_dir_out; > + gc->get_direction = cpm1_gpio32_get_direction; > gc->get = cpm1_gpio32_get; > gc->set = cpm1_gpio32_set; > gc->parent = dev; > > --- > base-commit: b7bee4ca5688e30ca50fbc87b1b8f7eed7006c17 > change-id: 20260603-powerpc-8xx-cpm1-get-dir-698cefe92647 > > Best regards,