linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/2] fbdev: ssd1307fb: Drop optional dependency
@ 2022-11-01 15:09 Andy Shevchenko
  2022-11-01 15:09 ` [PATCH v1 2/2] fbdev: ssd1307fb: Drop duplicate NULL checks for PWM APIs Andy Shevchenko
  2022-11-01 15:30 ` [PATCH v1 1/2] fbdev: ssd1307fb: Drop optional dependency Helge Deller
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2022-11-01 15:09 UTC (permalink / raw)
  To: Javier Martinez Canillas, linux-fbdev, dri-devel, linux-kernel
  Cc: Helge Deller, Andy Shevchenko

Only a single out of three devices need a PWM, so from driver it's
optional. Moreover it's a single driver in the entire kernel that
currently selects PWM. Unfortunately this selection is a root cause
of the circular dependencies when we want to enable optional PWM
for some other drivers that select GPIOLIB.

Fixes: a2ed00da5047 ("drivers/video: add support for the Solomon SSD1307 OLED Controller")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/video/fbdev/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index a98987aa2784..b88d8bfe992e 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -2218,7 +2218,6 @@ config FB_SSD1307
 	select FB_SYS_COPYAREA
 	select FB_SYS_IMAGEBLIT
 	select FB_DEFERRED_IO
-	select PWM
 	select FB_BACKLIGHT
 	help
 	  This driver implements support for the Solomon SSD1307
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v1 2/2] fbdev: ssd1307fb: Drop duplicate NULL checks for PWM APIs
  2022-11-01 15:09 [PATCH v1 1/2] fbdev: ssd1307fb: Drop optional dependency Andy Shevchenko
@ 2022-11-01 15:09 ` Andy Shevchenko
  2022-11-01 15:30 ` [PATCH v1 1/2] fbdev: ssd1307fb: Drop optional dependency Helge Deller
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2022-11-01 15:09 UTC (permalink / raw)
  To: Javier Martinez Canillas, linux-fbdev, dri-devel, linux-kernel
  Cc: Helge Deller, Andy Shevchenko

pwm_disable() and pwm_put() are NULL-aware, no need to
duplicate the check in the caller.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/video/fbdev/ssd1307fb.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
index 5c891aa00d59..046b9990d27c 100644
--- a/drivers/video/fbdev/ssd1307fb.c
+++ b/drivers/video/fbdev/ssd1307fb.c
@@ -803,10 +803,8 @@ static int ssd1307fb_probe(struct i2c_client *client)
 bl_init_error:
 	unregister_framebuffer(info);
 panel_init_error:
-	if (par->device_info->need_pwm) {
-		pwm_disable(par->pwm);
-		pwm_put(par->pwm);
-	}
+	pwm_disable(par->pwm);
+	pwm_put(par->pwm);
 regulator_enable_error:
 	if (par->vbat_reg)
 		regulator_disable(par->vbat_reg);
@@ -827,10 +825,8 @@ static void ssd1307fb_remove(struct i2c_client *client)
 	backlight_device_unregister(info->bl_dev);
 
 	unregister_framebuffer(info);
-	if (par->device_info->need_pwm) {
-		pwm_disable(par->pwm);
-		pwm_put(par->pwm);
-	}
+	pwm_disable(par->pwm);
+	pwm_put(par->pwm);
 	if (par->vbat_reg)
 		regulator_disable(par->vbat_reg);
 	fb_deferred_io_cleanup(info);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/2] fbdev: ssd1307fb: Drop optional dependency
  2022-11-01 15:09 [PATCH v1 1/2] fbdev: ssd1307fb: Drop optional dependency Andy Shevchenko
  2022-11-01 15:09 ` [PATCH v1 2/2] fbdev: ssd1307fb: Drop duplicate NULL checks for PWM APIs Andy Shevchenko
@ 2022-11-01 15:30 ` Helge Deller
  1 sibling, 0 replies; 3+ messages in thread
From: Helge Deller @ 2022-11-01 15:30 UTC (permalink / raw)
  To: Andy Shevchenko, Javier Martinez Canillas, linux-fbdev,
	dri-devel, linux-kernel

On 11/1/22 16:09, Andy Shevchenko wrote:
> Only a single out of three devices need a PWM, so from driver it's
> optional. Moreover it's a single driver in the entire kernel that
> currently selects PWM. Unfortunately this selection is a root cause
> of the circular dependencies when we want to enable optional PWM
> for some other drivers that select GPIOLIB.
>
> Fixes: a2ed00da5047 ("drivers/video: add support for the Solomon SSD1307 OLED Controller")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Both patches applied to fbdev git tree.

Thanks!
Helge

> ---
>   drivers/video/fbdev/Kconfig | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
> index a98987aa2784..b88d8bfe992e 100644
> --- a/drivers/video/fbdev/Kconfig
> +++ b/drivers/video/fbdev/Kconfig
> @@ -2218,7 +2218,6 @@ config FB_SSD1307
>   	select FB_SYS_COPYAREA
>   	select FB_SYS_IMAGEBLIT
>   	select FB_DEFERRED_IO
> -	select PWM
>   	select FB_BACKLIGHT
>   	help
>   	  This driver implements support for the Solomon SSD1307


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-01 15:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01 15:09 [PATCH v1 1/2] fbdev: ssd1307fb: Drop optional dependency Andy Shevchenko
2022-11-01 15:09 ` [PATCH v1 2/2] fbdev: ssd1307fb: Drop duplicate NULL checks for PWM APIs Andy Shevchenko
2022-11-01 15:30 ` [PATCH v1 1/2] fbdev: ssd1307fb: Drop optional dependency Helge Deller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).