Linux-Renesas-SoC Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/2] drm: encoder_slave: some updates
@ 2020-03-16 16:39 Wolfram Sang
  2020-03-16 16:39 ` [PATCH 1/2] drm: encoder_slave: fix refcouting error for modules Wolfram Sang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Wolfram Sang @ 2020-03-16 16:39 UTC (permalink / raw)
  To: dri-devel
  Cc: linux-renesas-soc, Wolfram Sang, Dave Airlie, Francisco Jerez,
	linux-kernel

While converting I2C users to new APIs, I found a refcounting problem in
the encoder_slave implementation. This series fixes it and converts to
the new API.

Based on linux-next and only build tested.

Wolfram Sang (2):
  drm: encoder_slave: fix refcouting error for modules
  drm: encoder_slave: use new I2C API

 drivers/gpu/drm/drm_encoder_slave.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

-- 
2.20.1


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

* [PATCH 1/2] drm: encoder_slave: fix refcouting error for modules
  2020-03-16 16:39 [PATCH 0/2] drm: encoder_slave: some updates Wolfram Sang
@ 2020-03-16 16:39 ` Wolfram Sang
  2020-03-16 16:39 ` [PATCH 2/2] drm: encoder_slave: use new I2C API Wolfram Sang
  2020-05-12 16:28 ` [PATCH 0/2] drm: encoder_slave: some updates Wolfram Sang
  2 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2020-03-16 16:39 UTC (permalink / raw)
  To: dri-devel
  Cc: linux-renesas-soc, Wolfram Sang, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter,
	Francisco Jerez, Dave Airlie, linux-kernel

module_put() balances try_module_get(), not request_module(). Fix the
error path to match that.

Fixes: 2066facca4c7 ("drm/kms: slave encoder interface.")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/gpu/drm/drm_encoder_slave.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c
index cf804389f5ec..d50a7884e69e 100644
--- a/drivers/gpu/drm/drm_encoder_slave.c
+++ b/drivers/gpu/drm/drm_encoder_slave.c
@@ -84,7 +84,7 @@ int drm_i2c_encoder_init(struct drm_device *dev,
 
 	err = encoder_drv->encoder_init(client, dev, encoder);
 	if (err)
-		goto fail_unregister;
+		goto fail_module_put;
 
 	if (info->platform_data)
 		encoder->slave_funcs->set_config(&encoder->base,
@@ -92,9 +92,10 @@ int drm_i2c_encoder_init(struct drm_device *dev,
 
 	return 0;
 
+fail_module_put:
+	module_put(module);
 fail_unregister:
 	i2c_unregister_device(client);
-	module_put(module);
 fail:
 	return err;
 }
-- 
2.20.1


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

* [PATCH 2/2] drm: encoder_slave: use new I2C API
  2020-03-16 16:39 [PATCH 0/2] drm: encoder_slave: some updates Wolfram Sang
  2020-03-16 16:39 ` [PATCH 1/2] drm: encoder_slave: fix refcouting error for modules Wolfram Sang
@ 2020-03-16 16:39 ` Wolfram Sang
  2020-05-12 16:28 ` [PATCH 0/2] drm: encoder_slave: some updates Wolfram Sang
  2 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2020-03-16 16:39 UTC (permalink / raw)
  To: dri-devel
  Cc: linux-renesas-soc, Wolfram Sang, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter,
	linux-kernel

i2c_new_client() is deprecated, use the replacement
i2c_new_client_device(). Also, we have a helper to check if a driver is
bound. Use it to simplify the code. Note that this changes the errno for
a failed device creation from ENOMEM to ENODEV. No callers currently
interpret this errno, though, so we use this condensed error check.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/gpu/drm/drm_encoder_slave.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c
index d50a7884e69e..e464429d32df 100644
--- a/drivers/gpu/drm/drm_encoder_slave.c
+++ b/drivers/gpu/drm/drm_encoder_slave.c
@@ -61,13 +61,8 @@ int drm_i2c_encoder_init(struct drm_device *dev,
 
 	request_module("%s%s", I2C_MODULE_PREFIX, info->type);
 
-	client = i2c_new_device(adap, info);
-	if (!client) {
-		err = -ENOMEM;
-		goto fail;
-	}
-
-	if (!client->dev.driver) {
+	client = i2c_new_client_device(adap, info);
+	if (!i2c_client_has_driver(client)) {
 		err = -ENODEV;
 		goto fail_unregister;
 	}
@@ -96,7 +91,6 @@ int drm_i2c_encoder_init(struct drm_device *dev,
 	module_put(module);
 fail_unregister:
 	i2c_unregister_device(client);
-fail:
 	return err;
 }
 EXPORT_SYMBOL(drm_i2c_encoder_init);
-- 
2.20.1


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

* Re: [PATCH 0/2] drm: encoder_slave: some updates
  2020-03-16 16:39 [PATCH 0/2] drm: encoder_slave: some updates Wolfram Sang
  2020-03-16 16:39 ` [PATCH 1/2] drm: encoder_slave: fix refcouting error for modules Wolfram Sang
  2020-03-16 16:39 ` [PATCH 2/2] drm: encoder_slave: use new I2C API Wolfram Sang
@ 2020-05-12 16:28 ` Wolfram Sang
  2020-05-13  9:35   ` Emil Velikov
  2 siblings, 1 reply; 6+ messages in thread
From: Wolfram Sang @ 2020-05-12 16:28 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-renesas-soc, Dave Airlie, Francisco Jerez, linux-kernel


[-- Attachment #1: Type: text/plain, Size: 578 bytes --]

On Mon, Mar 16, 2020 at 05:39:05PM +0100, Wolfram Sang wrote:
> While converting I2C users to new APIs, I found a refcounting problem in
> the encoder_slave implementation. This series fixes it and converts to
> the new API.
> 
> Based on linux-next and only build tested.
> 
> Wolfram Sang (2):
>   drm: encoder_slave: fix refcouting error for modules
>   drm: encoder_slave: use new I2C API
> 
>  drivers/gpu/drm/drm_encoder_slave.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)

Is there someone I should add to the CC list maybe?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 0/2] drm: encoder_slave: some updates
  2020-05-12 16:28 ` [PATCH 0/2] drm: encoder_slave: some updates Wolfram Sang
@ 2020-05-13  9:35   ` Emil Velikov
  2020-05-17 20:50     ` Emil Velikov
  0 siblings, 1 reply; 6+ messages in thread
From: Emil Velikov @ 2020-05-13  9:35 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: ML dri-devel, linux-renesas-soc, Dave Airlie,
	Linux-Kernel@Vger. Kernel. Org

Hi Wolfram,

On Wed, 13 May 2020 at 10:10, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> On Mon, Mar 16, 2020 at 05:39:05PM +0100, Wolfram Sang wrote:
> > While converting I2C users to new APIs, I found a refcounting problem in
> > the encoder_slave implementation. This series fixes it and converts to
> > the new API.
> >
> > Based on linux-next and only build tested.
> >
> > Wolfram Sang (2):
> >   drm: encoder_slave: fix refcouting error for modules
> >   drm: encoder_slave: use new I2C API
> >
> >  drivers/gpu/drm/drm_encoder_slave.c | 15 +++++----------
> >  1 file changed, 5 insertions(+), 10 deletions(-)
>
> Is there someone I should add to the CC list maybe?
>
The series is:
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>

Unless someone beats me to it, I'll commit them to drm-misc later today.

-Emil

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

* Re: [PATCH 0/2] drm: encoder_slave: some updates
  2020-05-13  9:35   ` Emil Velikov
@ 2020-05-17 20:50     ` Emil Velikov
  0 siblings, 0 replies; 6+ messages in thread
From: Emil Velikov @ 2020-05-17 20:50 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: ML dri-devel, linux-renesas-soc, Dave Airlie,
	Linux-Kernel@Vger. Kernel. Org

On Wed, 13 May 2020 at 10:35, Emil Velikov <emil.l.velikov@gmail.com> wrote:
>
> Hi Wolfram,
>
> On Wed, 13 May 2020 at 10:10, Wolfram Sang
> <wsa+renesas@sang-engineering.com> wrote:
> >
> > On Mon, Mar 16, 2020 at 05:39:05PM +0100, Wolfram Sang wrote:
> > > While converting I2C users to new APIs, I found a refcounting problem in
> > > the encoder_slave implementation. This series fixes it and converts to
> > > the new API.
> > >
> > > Based on linux-next and only build tested.
> > >
> > > Wolfram Sang (2):
> > >   drm: encoder_slave: fix refcouting error for modules
> > >   drm: encoder_slave: use new I2C API
> > >
> > >  drivers/gpu/drm/drm_encoder_slave.c | 15 +++++----------
> > >  1 file changed, 5 insertions(+), 10 deletions(-)
> >
> > Is there someone I should add to the CC list maybe?
> >
> The series is:
> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
>
> Unless someone beats me to it, I'll commit them to drm-misc later today.
>
And after a short delay, pushed to drm-misc-next.
Thanks for the patches Wolfram.

-Emil

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

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-16 16:39 [PATCH 0/2] drm: encoder_slave: some updates Wolfram Sang
2020-03-16 16:39 ` [PATCH 1/2] drm: encoder_slave: fix refcouting error for modules Wolfram Sang
2020-03-16 16:39 ` [PATCH 2/2] drm: encoder_slave: use new I2C API Wolfram Sang
2020-05-12 16:28 ` [PATCH 0/2] drm: encoder_slave: some updates Wolfram Sang
2020-05-13  9:35   ` Emil Velikov
2020-05-17 20:50     ` Emil Velikov

Linux-Renesas-SoC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-renesas-soc/0 linux-renesas-soc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-renesas-soc linux-renesas-soc/ https://lore.kernel.org/linux-renesas-soc \
		linux-renesas-soc@vger.kernel.org
	public-inbox-index linux-renesas-soc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-renesas-soc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git