public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: John Crispin <john@phrozen.org>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] MIPS: Lantiq: switch vmmc to use gpiod API
Date: Tue, 27 Sep 2022 08:29:42 -0700	[thread overview]
Message-ID: <YzMW5r5+1NY1tual@google.com> (raw)
In-Reply-To: <20220927082946.GA7667@alpha.franken.de>

On Tue, Sep 27, 2022 at 10:29:46AM +0200, Thomas Bogendoerfer wrote:
> On Tue, Sep 27, 2022 at 01:08:35AM -0700, Dmitry Torokhov wrote:
> > On September 27, 2022 12:49:53 AM PDT, Thomas Bogendoerfer <tsbogend@alpha.franken.de> wrote:
> > >On Mon, Sep 26, 2022 at 09:56:08PM -0700, Dmitry Torokhov wrote:
> > >> Hi Thomas,
> > >> 
> > >> On Sat, Sep 24, 2022 at 12:46:12PM +0200, Thomas Bogendoerfer wrote:
> > >> > On Thu, Sep 22, 2022 at 09:55:40PM -0700, Dmitry Torokhov wrote:
> > >> > > This switches vmmc to use gpiod API instead of OF-specific legacy gpio
> > >> > > API that we want to stop exporting from gpiolib.
> > >> > > 
> > >> > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > >> > > ---
> > >> > >  arch/mips/lantiq/xway/vmmc.c | 22 +++++++++++++---------
> > >> > >  1 file changed, 13 insertions(+), 9 deletions(-)
> > >> > 
> > >> > applied to mips-next.
> > >> 
> > >> My apologies, I screwed up. I thought this patch passed 0day before I
> > >> sent it to you, but apparently it has not.
> > >> 
> > >> Here is a fixup (actually cross-compiled this time), or I can send a v2
> > >> incorporating it into the original change.
> > >
> > >I need a fixup, but this one still fails in my build:
> > >
> > >/local/tbogendoerfer/korg/linux/arch/mips/lantiq/xway/vmmc.c: In function ‘vmmc_probe’:
> > >/local/tbogendoerfer/korg/linux/arch/mips/lantiq/xway/vmmc.c:43:5: error: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Werror=format=]
> > >     "failed to request GPIO idx %d: %d\n",
> > >     ^
> > 
> > I see, I did not realize PTR_ERR() is actually long. I guess I can introduce a temp variable and use PTR_ERR_OR_ZERO(), but there are a lot of places in the kernel that use %d and PTR_ERR(). I wonder why we can't define PTR_ERR() as (int)(long)ptr or something.
> > 
> > What compiler/version are you using for your builds? 
> 
> it's rather old:
> 
> gcc version 6.1.1 20160621 (Red Hat Cross 6.1.1-2) (GCC) 

OK, I tried the below with gcc 12.1.0 cross-compiler, hopefully this
does not trip on 6.1.1.

Thanks.

-- 
Dmitry

MIPS: Lantiq: vmmc: fix compile break introduced by gpiod patch

"MIPS: Lantiq: switch vmmc to use gpiod API" patch introduced compile
errors, this patch fixes them.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 arch/mips/lantiq/xway/vmmc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/mips/lantiq/xway/vmmc.c b/arch/mips/lantiq/xway/vmmc.c
index a1947306ac18..2796e87dfcae 100644
--- a/arch/mips/lantiq/xway/vmmc.c
+++ b/arch/mips/lantiq/xway/vmmc.c
@@ -29,6 +29,7 @@ static int vmmc_probe(struct platform_device *pdev)
 	struct gpio_desc *gpio;
 	int gpio_count;
 	dma_addr_t dma;
+	int error;
 
 	cp1_base =
 		(void *) CPHYSADDR(dma_alloc_coherent(&pdev->dev, CP1_SIZE,
@@ -38,14 +39,15 @@ static int vmmc_probe(struct platform_device *pdev)
 	while (gpio_count > 0) {
 		gpio = devm_gpiod_get_index(&pdev->dev,
 					    NULL, --gpio_count, GPIOD_OUT_HIGH);
-		if (IS_ERR(gpio)) {
+		error = PTR_ERR_OR_ZERO(gpio);
+		if (error) {
 			dev_err(&pdev->dev,
 				"failed to request GPIO idx %d: %d\n",
-				gpio_count, PTR_ERR(gpio);
+				gpio_count, error);
 			continue;
 		}
 
-		gpio_consumer_set_name(gpio, "vmmc-relay");
+		gpiod_set_consumer_name(gpio, "vmmc-relay");
 	}
 
 	dev_info(&pdev->dev, "reserved %dMB at 0x%p", CP1_SIZE >> 20, cp1_base);
-- 
2.38.0.rc1.362.ged0d419d3c-goog


  reply	other threads:[~2022-09-27 15:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-23  4:55 [PATCH] MIPS: Lantiq: switch vmmc to use gpiod API Dmitry Torokhov
2022-09-24 10:46 ` Thomas Bogendoerfer
2022-09-27  4:56   ` Dmitry Torokhov
2022-09-27  7:49     ` Thomas Bogendoerfer
2022-09-27  8:08       ` Dmitry Torokhov
2022-09-27  8:29         ` Thomas Bogendoerfer
2022-09-27 15:29           ` Dmitry Torokhov [this message]
2022-09-27 20:13             ` Thomas Bogendoerfer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YzMW5r5+1NY1tual@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=john@phrozen.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox