Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil+cisco@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Bradford Love <brad@nextdimension.cc>,
	linux-gpio@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org,
	linux-media@vger.kernel.org
Cc: "Linus Walleij" <linusw@kernel.org>,
	"Bartosz Golaszewski" <brgl@kernel.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Daniel Mack" <daniel@zonque.org>,
	"Haojian Zhuang" <haojian.zhuang@gmail.com>,
	"Robert Jarzmik" <robert.jarzmik@free.fr>,
	"Russell King" <linux@armlinux.org.uk>,
	"Hauke Mehrtens" <hauke@hauke-m.de>,
	"Rafał Miłecki" <zajec5@gmail.com>,
	"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>
Subject: Re: [PATCH v1 2/7] media: em28xx: Split em28xx_pctv_290e_set_lna_gpio() helper
Date: Mon, 27 Jul 2026 11:52:40 +0200	[thread overview]
Message-ID: <1666c7f9-4d32-495f-a737-3fc06872690b@kernel.org> (raw)
In-Reply-To: <20260715185112.1323510-3-andriy.shevchenko@linux.intel.com>

On 15/07/2026 20:46, Andy Shevchenko wrote:
> Split em28xx_pctv_290e_set_lna_gpio() helper in order to deduplicate
> the GPIO request and setting.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Hans Verkuil <hverkuil+cisco@kernel.org>

Regards,

	Hans

> ---
>  drivers/media/usb/em28xx/em28xx-dvb.c | 31 ++++++++++++---------------
>  1 file changed, 14 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
> index 8482fc4045ea..ef148a27c94d 100644
> --- a/drivers/media/usb/em28xx/em28xx-dvb.c
> +++ b/drivers/media/usb/em28xx/em28xx-dvb.c
> @@ -737,17 +737,14 @@ static void pctv_520e_init(struct em28xx *dev)
>  				regs[i].r, regs[i].len);
>  };
>  
> -static int em28xx_pctv_290e_set_lna(struct dvb_frontend *fe)
> +static int em28xx_pctv_290e_set_lna_gpio(struct em28xx *dev, u32 lna)
>  {
> -	struct dtv_frontend_properties *c = &fe->dtv_property_cache;
> -	struct em28xx_i2c_bus *i2c_bus = fe->dvb->priv;
> -	struct em28xx *dev = i2c_bus->dev;
>  #ifdef CONFIG_GPIOLIB_LEGACY
>  	struct em28xx_dvb *dvb = dev->dvb;
>  	int ret;
>  	unsigned long flags;
>  
> -	if (c->lna == 1)
> +	if (lna == 1)
>  		flags = GPIOF_OUT_INIT_HIGH; /* enable LNA */
>  	else
>  		flags = GPIOF_OUT_INIT_LOW; /* disable LNA */
> @@ -761,11 +758,20 @@ static int em28xx_pctv_290e_set_lna(struct dvb_frontend *fe)
>  	return ret;
>  #else
>  	dev_warn(&dev->intf->dev, "%s: LNA control is disabled (lna=%u)\n",
> -		 KBUILD_MODNAME, c->lna);
> +		 KBUILD_MODNAME, lna);
>  	return 0;
>  #endif
>  }
>  
> +static int em28xx_pctv_290e_set_lna(struct dvb_frontend *fe)
> +{
> +	struct dtv_frontend_properties *c = &fe->dtv_property_cache;
> +	struct em28xx_i2c_bus *i2c_bus = fe->dvb->priv;
> +	struct em28xx *dev = i2c_bus->dev;
> +
> +	return em28xx_pctv_290e_set_lna_gpio(dev, c->lna);
> +}
> +
>  static int em28xx_pctv_292e_set_lna(struct dvb_frontend *fe)
>  {
>  	struct dtv_frontend_properties *c = &fe->dtv_property_cache;
> @@ -1920,19 +1926,10 @@ static int em28xx_dvb_init(struct em28xx *dev)
>  				goto out_free;
>  			}
>  
> -#ifdef CONFIG_GPIOLIB_LEGACY
>  			/* enable LNA for DVB-T, DVB-T2 and DVB-C */
> -			result = gpio_request_one(dvb->lna_gpio,
> -						  GPIOF_OUT_INIT_LOW, NULL);
> -			if (result)
> -				dev_err(&dev->intf->dev,
> -					"gpio request failed %d\n",
> -					result);
> -			else
> -				gpio_free(dvb->lna_gpio);
> +			em28xx_pctv_290e_set_lna_gpio(dev, 0);
>  
> -			result = 0; /* continue even set LNA fails */
> -#endif
> +			/* continue even set LNA fails */
>  			dvb->fe[0]->ops.set_lna = em28xx_pctv_290e_set_lna;
>  		}
>  


  reply	other threads:[~2026-07-27  9:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15 18:46 [PATCH v1 0/7] gpiolib: kill gpio_request_one() Andy Shevchenko
2026-07-15 18:46 ` [PATCH v1 1/7] ARM: pxa: spitz: Open code gpio_request_one() Andy Shevchenko
2026-07-15 18:46 ` [PATCH v1 2/7] media: em28xx: Split em28xx_pctv_290e_set_lna_gpio() helper Andy Shevchenko
2026-07-27  9:52   ` Hans Verkuil [this message]
2026-07-15 18:46 ` [PATCH v1 3/7] media: em28xx: Open code gpio_request_one() Andy Shevchenko
2026-07-27  9:53   ` Hans Verkuil
2026-07-15 18:46 ` [PATCH v1 4/7] MIPS: BCM47XX: " Andy Shevchenko
2026-07-15 18:46 ` [PATCH v1 5/7] MIPS: BCM63XX: Remove one time use ephy_reset_gpio_flags Andy Shevchenko
2026-07-15 18:46 ` [PATCH v1 6/7] MIPS: BCM63XX: Open code gpio_request_one() Andy Shevchenko
2026-07-15 18:46 ` [PATCH v1 7/7] gpiolib: Get rid of not used anymore gpio_request_one() Andy Shevchenko
2026-07-24 21:40 ` [PATCH v1 0/7] gpiolib: kill gpio_request_one() Linus Walleij

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=1666c7f9-4d32-495f-a737-3fc06872690b@kernel.org \
    --to=hverkuil+cisco@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=brad@nextdimension.cc \
    --cc=brgl@kernel.org \
    --cc=corbet@lwn.net \
    --cc=daniel@zonque.org \
    --cc=haojian.zhuang@gmail.com \
    --cc=hauke@hauke-m.de \
    --cc=linusw@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mchehab@kernel.org \
    --cc=robert.jarzmik@free.fr \
    --cc=skhan@linuxfoundation.org \
    --cc=tsbogend@alpha.franken.de \
    --cc=zajec5@gmail.com \
    /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