Skip to contentSkip to conversation

drm/arcpgu: remove drm_encoder_slave

PATCH In review Daniel Vetter 5 participants 12 messages Jan 17, 2018 – Jan 30, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/arcpgu: remove drm_encoder_slave

drm_encoder_slave is the old way to write bridge drivers, for i2c bridges only. It's deprecated, and definitely should not be used in new drivers.

What's even strange is that arcpgu doesn't even use any of this, it really only wants a plain normal drm_encoder. Nuke all the surplus real estate.

---
 drivers/gpu/drm/arc/arcpgu_sim.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
drivers/gpu/drm/arc/arcpgu_sim.c +5 -8
index bca3a678c955..d01f7743b63d 100644
@@ -29,7 +29,6 @@
 
 struct arcpgu_drm_connector {
 	struct drm_connector connector;
-	struct drm_encoder_slave *encoder_slave;
 };
 
 static int arcpgu_drm_connector_get_modes(struct drm_connector *connector)
@@ -68,7 +67,7 @@ static struct drm_encoder_funcs arcpgu_drm_encoder_funcs = {
 int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np)
 {
 	struct arcpgu_drm_connector *arcpgu_connector;
-	struct drm_encoder_slave *encoder;
+	struct drm_encoder *encoder;
 	struct drm_connector *connector;
 	int ret;
 
@@ -76,10 +75,10 @@ int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np)
 	if (encoder == NULL)
 		return -ENOMEM;
 
-	encoder->base.possible_crtcs = 1;
-	encoder->base.possible_clones = 0;
+	encoder->possible_crtcs = 1;
+	encoder->possible_clones = 0;
 
-	ret = drm_encoder_init(drm, &encoder->base, &arcpgu_drm_encoder_funcs,
+	ret = drm_encoder_init(drm, encoder, &arcpgu_drm_encoder_funcs,
 			       DRM_MODE_ENCODER_VIRTUAL, NULL);
 	if (ret)
 		return ret;
@@ -101,15 +100,13 @@ int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np)
 		goto error_encoder_cleanup;
 	}
 
-	ret = drm_mode_connector_attach_encoder(connector, &encoder->base);
+	ret = drm_mode_connector_attach_encoder(connector, encoder);
 	if (ret < 0) {
 		dev_err(drm->dev, "could not attach connector to encoder\n");
 		drm_connector_unregister(connector);
 		goto error_connector_cleanup;
 	}
 
-	arcpgu_connector->encoder_slave = encoder;
-
 	return 0;
 
 error_connector_cleanup:
Signature · 6 lines
2.15.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 1/1 drm/arcpgu: remove drm_encoder_slave

drm_encoder_slave is the old way to write bridge drivers, for i2c bridges only. It's deprecated, and definitely should not be used in new drivers.

What's even strange is that arcpgu doesn't even use any of this, it really only wants a plain normal drm_encoder. Nuke all the surplus real estate.

v2: Actually git add after compile testing ...

Cc Laurent Pinchart <[email protected]>
Cc Alexey Brodkin <[email protected]>
---
 drivers/gpu/drm/arc/arcpgu_sim.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/gpu/drm/arc/arcpgu_sim.c +6 -9
index bca3a678c955..19f5a781666d 100644
@@ -29,7 +29,6 @@
 
 struct arcpgu_drm_connector {
 	struct drm_connector connector;
-	struct drm_encoder_slave *encoder_slave;
 };
 
 static int arcpgu_drm_connector_get_modes(struct drm_connector *connector)
@@ -68,7 +67,7 @@ static struct drm_encoder_funcs arcpgu_drm_encoder_funcs = {
 int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np)
 {
 	struct arcpgu_drm_connector *arcpgu_connector;
-	struct drm_encoder_slave *encoder;
+	struct drm_encoder *encoder;
 	struct drm_connector *connector;
 	int ret;
 
@@ -76,10 +75,10 @@ int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np)
 	if (encoder == NULL)
 		return -ENOMEM;
 
-	encoder->base.possible_crtcs = 1;
-	encoder->base.possible_clones = 0;
+	encoder->possible_crtcs = 1;
+	encoder->possible_clones = 0;
 
-	ret = drm_encoder_init(drm, &encoder->base, &arcpgu_drm_encoder_funcs,
+	ret = drm_encoder_init(drm, encoder, &arcpgu_drm_encoder_funcs,
 			       DRM_MODE_ENCODER_VIRTUAL, NULL);
 	if (ret)
 		return ret;
@@ -101,21 +100,19 @@ int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np)
 		goto error_encoder_cleanup;
 	}
 
-	ret = drm_mode_connector_attach_encoder(connector, &encoder->base);
+	ret = drm_mode_connector_attach_encoder(connector, encoder);
 	if (ret < 0) {
 		dev_err(drm->dev, "could not attach connector to encoder\n");
 		drm_connector_unregister(connector);
 		goto error_connector_cleanup;
 	}
 
-	arcpgu_connector->encoder_slave = encoder;
-
 	return 0;
 
 error_connector_cleanup:
 	drm_connector_cleanup(connector);
 
 error_encoder_cleanup:
-	drm_encoder_cleanup(&encoder->base);
+	drm_encoder_cleanup(encoder);
 	return ret;
 }
Signature · 6 lines
2.15.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#2 lore raw

Hi Daniel,

Thank you for the patch.

Quoted 8 lines · On Wednesday, 17 January 2018 15:53:07 EET Daniel Vetter wrote:

drm_encoder_slave is the old way to write bridge drivers, for i2c bridges only. It's deprecated, and definitely should not be used in new drivers.

What's even strange is that arcpgu doesn't even use any of this, it really only wants a plain normal drm_encoder. Nuke all the surplus real estate.

Quoted 5 lines

v2: Actually git add after compile testing ...

Cc Laurent Pinchart <[email protected]>
Cc Alexey Brodkin <[email protected]>

Could you merge this along with "[PATCH] drm: Don't include drm/ drm_encoder_slave.h when not needed" ? We will then only have two users of the encoder slave API left, nouveau and armada (and of course the encoder slave drivers themselves), and no stray occurrence of the encoder slave term in other source files.

Quoted 62 lines
---
 drivers/gpu/drm/arc/arcpgu_sim.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/arc/arcpgu_sim.c index bca3a678c955..19f5a781666d 100644

drivers/gpu/drm/arc/arcpgu_sim.c +6 -9
@@ -29,7 +29,6 @@
 
 struct arcpgu_drm_connector {
 	struct drm_connector connector;
-	struct drm_encoder_slave *encoder_slave;
 };
 
 static int arcpgu_drm_connector_get_modes(struct drm_connector *connector)
@@ -68,7 +67,7 @@ static struct drm_encoder_funcs arcpgu_drm_encoder_funcs =
 { int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np) {
 	struct arcpgu_drm_connector *arcpgu_connector;
-	struct drm_encoder_slave *encoder;
+	struct drm_encoder *encoder;
 	struct drm_connector *connector;
 	int ret;
 
@@ -76,10 +75,10 @@ int arcpgu_drm_sim_init(struct drm_device *drm, struct
 device_node *np) if (encoder == NULL)
 		return -ENOMEM;
 
-	encoder->base.possible_crtcs = 1;
-	encoder->base.possible_clones = 0;
+	encoder->possible_crtcs = 1;
+	encoder->possible_clones = 0;
 
-	ret = drm_encoder_init(drm, &encoder->base, &arcpgu_drm_encoder_funcs,
+	ret = drm_encoder_init(drm, encoder, &arcpgu_drm_encoder_funcs,
 			       DRM_MODE_ENCODER_VIRTUAL, NULL);
 	if (ret)
 		return ret;
@@ -101,21 +100,19 @@ int arcpgu_drm_sim_init(struct drm_device *drm, struct
 device_node *np) goto error_encoder_cleanup;
 	}
 
-	ret = drm_mode_connector_attach_encoder(connector, &encoder->base);
+	ret = drm_mode_connector_attach_encoder(connector, encoder);
 	if (ret < 0) {
 		dev_err(drm->dev, "could not attach connector to encoder\n");
 		drm_connector_unregister(connector);
 		goto error_connector_cleanup;
 	}
 
-	arcpgu_connector->encoder_slave = encoder;
-
 	return 0;
 
 error_connector_cleanup:
 	drm_connector_cleanup(connector);
 
 error_encoder_cleanup:
-	drm_encoder_cleanup(&encoder->base);
+	drm_encoder_cleanup(encoder);
 	return ret;
 }
Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw
In reply to Daniel Vetter

Hi Daniel,

Quoted 7 lines · Daniel Vetter

drm_encoder_slave is the old way to write bridge drivers, for i2c bridges only. It's deprecated, and definitely should not be used in new drivers.

What's even strange is that arcpgu doesn't even use any of this, it really only wants a plain normal drm_encoder. Nuke all the surplus real estate.

As of today we use either use adv7511 encoder or dw-hdmi. And I guess proposed change is OK for both bridge versions, rigth?

-Alexey
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw
Quoted 7 lines · Alexey Brodkin

Hi Daniel,

Quoted 4 lines · Daniel Vetter

drm_encoder_slave is the old way to write bridge drivers, for i2c bridges only. It's deprecated, and definitely should not be used in new drivers.

Quoted 6 lines
Quoted 3 lines

What's even strange is that arcpgu doesn't even use any of this, it really only wants a plain normal drm_encoder. Nuke all the surplus real estate.

As of today we use either use adv7511 encoder or dw-hdmi. And I guess proposed change is OK for both bridge versions, rigth?

drm_encoder_slave is something completely different from drm_bridge. The latter will keep working.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw

PATCH 1/1 drm/arcpgu: remove drm_encoder_slave

In reply to Daniel Vetter

drm_encoder_slave is the old way to write bridge drivers, for i2c bridges only. It's deprecated, and definitely should not be used in new drivers. This has absolutely nothing to do with the new bridge driver infrastructure implemented by drm_bridge.

What's even strange is that arcpgu doesn't even use any of this, it really only wants a plain normal drm_encoder. Nuke all the surplus real estate.

v2: Actually git add after compile testing ...

v3: Clarify commit message and stop including drm_encoder_slave.h.

---
 drivers/gpu/drm/arc/arcpgu_hdmi.c |  3 ++-
 drivers/gpu/drm/arc/arcpgu_sim.c  | 16 ++++++----------
 2 files changed, 8 insertions(+), 11 deletions(-)
drivers/gpu/drm/arc/arcpgu_hdmi.c +2 -1
index 0ce7f398bcff..977dfa55162f 100644
@@ -15,7 +15,8 @@
  */
 
 #include <drm/drm_crtc.h>
-#include <drm/drm_encoder_slave.h>
+#include <drm/drm_encoder.h>
+#include <drm/drm_device.h>
 
 #include "arcpgu.h"
 
drivers/gpu/drm/arc/arcpgu_sim.c +6 -10
index bca3a678c955..b8f6f9a5dfbe 100644
@@ -15,7 +15,6 @@
  */
 
 #include <drm/drm_crtc_helper.h>
-#include <drm/drm_encoder_slave.h>
 #include <drm/drm_atomic_helper.h>
 
 #include "arcpgu.h"
@@ -29,7 +28,6 @@
 
 struct arcpgu_drm_connector {
 	struct drm_connector connector;
-	struct drm_encoder_slave *encoder_slave;
 };
 
 static int arcpgu_drm_connector_get_modes(struct drm_connector *connector)
@@ -68,7 +66,7 @@ static struct drm_encoder_funcs arcpgu_drm_encoder_funcs = {
 int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np)
 {
 	struct arcpgu_drm_connector *arcpgu_connector;
-	struct drm_encoder_slave *encoder;
+	struct drm_encoder *encoder;
 	struct drm_connector *connector;
 	int ret;
 
@@ -76,10 +74,10 @@ int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np)
 	if (encoder == NULL)
 		return -ENOMEM;
 
-	encoder->base.possible_crtcs = 1;
-	encoder->base.possible_clones = 0;
+	encoder->possible_crtcs = 1;
+	encoder->possible_clones = 0;
 
-	ret = drm_encoder_init(drm, &encoder->base, &arcpgu_drm_encoder_funcs,
+	ret = drm_encoder_init(drm, encoder, &arcpgu_drm_encoder_funcs,
 			       DRM_MODE_ENCODER_VIRTUAL, NULL);
 	if (ret)
 		return ret;
@@ -101,21 +99,19 @@ int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np)
 		goto error_encoder_cleanup;
 	}
 
-	ret = drm_mode_connector_attach_encoder(connector, &encoder->base);
+	ret = drm_mode_connector_attach_encoder(connector, encoder);
 	if (ret < 0) {
 		dev_err(drm->dev, "could not attach connector to encoder\n");
 		drm_connector_unregister(connector);
 		goto error_connector_cleanup;
 	}
 
-	arcpgu_connector->encoder_slave = encoder;
-
 	return 0;
 
 error_connector_cleanup:
 	drm_connector_cleanup(connector);
 
 error_encoder_cleanup:
-	drm_encoder_cleanup(&encoder->base);
+	drm_encoder_cleanup(encoder);
 	return ret;
 }
Signature · 6 lines
2.15.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw
Quoted 9 lines · Daniel Vetter

drm_encoder_slave is the old way to write bridge drivers, for i2c bridges only. It's deprecated, and definitely should not be used in new drivers. This has absolutely nothing to do with the new bridge driver infrastructure implemented by drm_bridge.

What's even strange is that arcpgu doesn't even use any of this, it really only wants a plain normal drm_encoder. Nuke all the surplus real estate.

Quoted 8 lines

v2: Actually git add after compile testing ...

v3: Clarify commit message and stop including drm_encoder_slave.h.

I assumed this is ok and applied it to drm-misc-next. -Daniel

Quoted 89 lines
---
 drivers/gpu/drm/arc/arcpgu_hdmi.c |  3 ++-
 drivers/gpu/drm/arc/arcpgu_sim.c  | 16 ++++++----------
 2 files changed, 8 insertions(+), 11 deletions(-)
drivers/gpu/drm/arc/arcpgu_hdmi.c +2 -1
index 0ce7f398bcff..977dfa55162f 100644
@@ -15,7 +15,8 @@
  */
 
 #include <drm/drm_crtc.h>
-#include <drm/drm_encoder_slave.h>
+#include <drm/drm_encoder.h>
+#include <drm/drm_device.h>
 
 #include "arcpgu.h"
 
drivers/gpu/drm/arc/arcpgu_sim.c +6 -10
index bca3a678c955..b8f6f9a5dfbe 100644
@@ -15,7 +15,6 @@
  */
 
 #include <drm/drm_crtc_helper.h>
-#include <drm/drm_encoder_slave.h>
 #include <drm/drm_atomic_helper.h>
 
 #include "arcpgu.h"
@@ -29,7 +28,6 @@
 
 struct arcpgu_drm_connector {
 	struct drm_connector connector;
-	struct drm_encoder_slave *encoder_slave;
 };
 
 static int arcpgu_drm_connector_get_modes(struct drm_connector *connector)
@@ -68,7 +66,7 @@ static struct drm_encoder_funcs arcpgu_drm_encoder_funcs = {
 int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np)
 {
 	struct arcpgu_drm_connector *arcpgu_connector;
-	struct drm_encoder_slave *encoder;
+	struct drm_encoder *encoder;
 	struct drm_connector *connector;
 	int ret;
 
@@ -76,10 +74,10 @@ int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np)
 	if (encoder == NULL)
 		return -ENOMEM;
 
-	encoder->base.possible_crtcs = 1;
-	encoder->base.possible_clones = 0;
+	encoder->possible_crtcs = 1;
+	encoder->possible_clones = 0;
 
-	ret = drm_encoder_init(drm, &encoder->base, &arcpgu_drm_encoder_funcs,
+	ret = drm_encoder_init(drm, encoder, &arcpgu_drm_encoder_funcs,
 			       DRM_MODE_ENCODER_VIRTUAL, NULL);
 	if (ret)
 		return ret;
@@ -101,21 +99,19 @@ int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np)
 		goto error_encoder_cleanup;
 	}
 
-	ret = drm_mode_connector_attach_encoder(connector, &encoder->base);
+	ret = drm_mode_connector_attach_encoder(connector, encoder);
 	if (ret < 0) {
 		dev_err(drm->dev, "could not attach connector to encoder\n");
 		drm_connector_unregister(connector);
 		goto error_connector_cleanup;
 	}
 
-	arcpgu_connector->encoder_slave = encoder;
-
 	return 0;
 
 error_connector_cleanup:
 	drm_connector_cleanup(connector);
 
 error_encoder_cleanup:
-	drm_encoder_cleanup(&encoder->base);
+	drm_encoder_cleanup(encoder);
 	return ret;
 }
Signature · 1 line
2.15.1
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw

Hi Daniel,

Quoted 14 lines · Daniel Vetter
Quoted 13 lines · Daniel Vetter

drm_encoder_slave is the old way to write bridge drivers, for i2c bridges only. It's deprecated, and definitely should not be used in new drivers. This has absolutely nothing to do with the new bridge driver infrastructure implemented by drm_bridge.

What's even strange is that arcpgu doesn't even use any of this, it really only wants a plain normal drm_encoder. Nuke all the surplus real estate.

v2: Actually git add after compile testing ...

v3: Clarify commit message and stop including drm_encoder_slave.h.

Quoted 7 lines
Quoted 4 lines

I assumed this is ok and applied it to drm-misc-next. -Daniel

Not sure but I still cannot see anything arcpgu-related here
https://cgit.freedesktop.org/drm-misc/log/

Am I looking at the wrong place?

-Alexey
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw
Quoted 22 lines · Alexey Brodkin

Hi Daniel,

Quoted 19 lines · Daniel Vetter
Quoted 17 lines · Daniel Vetter

drm_encoder_slave is the old way to write bridge drivers, for i2c bridges only. It's deprecated, and definitely should not be used in new drivers. This has absolutely nothing to do with the new bridge driver infrastructure implemented by drm_bridge.

What's even strange is that arcpgu doesn't even use any of this, it really only wants a plain normal drm_encoder. Nuke all the surplus real estate.

v2: Actually git add after compile testing ...

v3: Clarify commit message and stop including drm_encoder_slave.h.

Quoted 7 lines
Quoted 2 lines

I assumed this is ok and applied it to drm-misc-next. -Daniel

Not sure but I still cannot see anything arcpgu-related here
https://cgit.freedesktop.org/drm-misc/log/

Am I looking at the wrong place?

Build test script got stuck, pushed for real now.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#9 lore raw

Hi Daniel,

Quoted 27 lines · Daniel Vetter
Quoted 25 lines · Alexey Brodkin

Hi Daniel,

Quoted 21 lines · Daniel Vetter
Quoted 9 lines · Daniel Vetter

drm_encoder_slave is the old way to write bridge drivers, for i2c bridges only. It's deprecated, and definitely should not be used in new drivers. This has absolutely nothing to do with the new bridge driver infrastructure implemented by drm_bridge.

What's even strange is that arcpgu doesn't even use any of this, it really only wants a plain normal drm_encoder. Nuke all the surplus real estate.

Quoted 8 lines

v2: Actually git add after compile testing ...

v3: Clarify commit message and stop including drm_encoder_slave.h.

I assumed this is ok and applied it to drm-misc-next. -Daniel

Quoted 7 lines
Quoted 5 lines

Not sure but I still cannot see anything arcpgu-related here
https://urldefense.proofpoint.com/v2/url?u=https-3A__cgit.freedesktop.org_drm-2Dmisc_log_&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656e
ViXO7breS55ytWkhpk5R81I&m=ZsFKo3w8gSf8Ul8_sl5RG8BACV1SwqgPV3wf6m4YtVM&s=f9P3-3L_o6CCd_1IQjGPNtAPAOtlO8rj2D2X8T5v_xw&e=

Am I looking at the wrong place?

Build test script got stuck, pushed for real now.

Thanks!

Gave it a try and it works perfectly fine.
If it still makes any sense...

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#10 lore raw
In reply to Daniel Vetter
I love your patch! Yet something to improve:

Hi Daniel,

I love your patch! Yet something to improve:

[auto build test ERROR on drm/drm-next]
[also build test ERROR on v4.15-rc8 next-20180119]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Daniel-Vetter/drm-arcpgu-remove-drm_encoder_slave/20180120-085901
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: x86_64-randconfig-x008-201802 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

drivers/gpu//drm/arc/arcpgu_sim.c: In function 'arcpgu_drm_sim_init':

>> drivers/gpu//drm/arc/arcpgu_sim.c:116:22: error: passing argument 1 of 'drm_encoder_cleanup' from incompatible pointer type [-Werror=incompatible-pointer-types]
     drm_encoder_cleanup(&encoder->base);
                         ^
   In file included from include/drm/drm_modeset_helper_vtables.h:33:0,
                    from include/drm/drm_crtc_helper.h:43,
                    from drivers/gpu//drm/arc/arcpgu_sim.c:17:
   include/drm/drm_encoder.h:232:6: note: expected 'struct drm_encoder *' but argument is of type 'struct drm_mode_object *'
    void drm_encoder_cleanup(struct drm_encoder *encoder);
         ^~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

vim +/drm_encoder_cleanup +116 drivers/gpu//drm/arc/arcpgu_sim.c

a189d28e Ruud Derwig   2016-06-06   66  
a189d28e Ruud Derwig   2016-06-06   67  int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np)
a189d28e Ruud Derwig   2016-06-06   68  {
a189d28e Ruud Derwig   2016-06-06   69  	struct arcpgu_drm_connector *arcpgu_connector;
70fbd4a0 Daniel Vetter 2018-01-17   70  	struct drm_encoder *encoder;
a189d28e Ruud Derwig   2016-06-06   71  	struct drm_connector *connector;
a189d28e Ruud Derwig   2016-06-06   72  	int ret;
a189d28e Ruud Derwig   2016-06-06   73  
a189d28e Ruud Derwig   2016-06-06   74  	encoder = devm_kzalloc(drm->dev, sizeof(*encoder), GFP_KERNEL);
a189d28e Ruud Derwig   2016-06-06   75  	if (encoder == NULL)
a189d28e Ruud Derwig   2016-06-06   76  		return -ENOMEM;
a189d28e Ruud Derwig   2016-06-06   77  
70fbd4a0 Daniel Vetter 2018-01-17   78  	encoder->possible_crtcs = 1;
70fbd4a0 Daniel Vetter 2018-01-17   79  	encoder->possible_clones = 0;
a189d28e Ruud Derwig   2016-06-06   80  
70fbd4a0 Daniel Vetter 2018-01-17   81  	ret = drm_encoder_init(drm, encoder, &arcpgu_drm_encoder_funcs,
a189d28e Ruud Derwig   2016-06-06   82  			       DRM_MODE_ENCODER_VIRTUAL, NULL);
a189d28e Ruud Derwig   2016-06-06   83  	if (ret)
a189d28e Ruud Derwig   2016-06-06   84  		return ret;
a189d28e Ruud Derwig   2016-06-06   85  
a189d28e Ruud Derwig   2016-06-06   86  	arcpgu_connector = devm_kzalloc(drm->dev, sizeof(*arcpgu_connector),
a189d28e Ruud Derwig   2016-06-06   87  					GFP_KERNEL);
a189d28e Ruud Derwig   2016-06-06   88  	if (!arcpgu_connector) {
a189d28e Ruud Derwig   2016-06-06   89  		ret = -ENOMEM;
a189d28e Ruud Derwig   2016-06-06   90  		goto error_encoder_cleanup;
a189d28e Ruud Derwig   2016-06-06   91  	}
a189d28e Ruud Derwig   2016-06-06   92  
a189d28e Ruud Derwig   2016-06-06   93  	connector = &arcpgu_connector->connector;
a189d28e Ruud Derwig   2016-06-06   94  	drm_connector_helper_add(connector, &arcpgu_drm_connector_helper_funcs);
a189d28e Ruud Derwig   2016-06-06   95  
a189d28e Ruud Derwig   2016-06-06   96  	ret = drm_connector_init(drm, connector, &arcpgu_drm_connector_funcs,
a189d28e Ruud Derwig   2016-06-06   97  			DRM_MODE_CONNECTOR_VIRTUAL);
a189d28e Ruud Derwig   2016-06-06   98  	if (ret < 0) {
a189d28e Ruud Derwig   2016-06-06   99  		dev_err(drm->dev, "failed to initialize drm connector\n");
a189d28e Ruud Derwig   2016-06-06  100  		goto error_encoder_cleanup;
a189d28e Ruud Derwig   2016-06-06  101  	}
a189d28e Ruud Derwig   2016-06-06  102  
70fbd4a0 Daniel Vetter 2018-01-17  103  	ret = drm_mode_connector_attach_encoder(connector, encoder);
a189d28e Ruud Derwig   2016-06-06  104  	if (ret < 0) {
a189d28e Ruud Derwig   2016-06-06  105  		dev_err(drm->dev, "could not attach connector to encoder\n");
a189d28e Ruud Derwig   2016-06-06  106  		drm_connector_unregister(connector);
a189d28e Ruud Derwig   2016-06-06  107  		goto error_connector_cleanup;
a189d28e Ruud Derwig   2016-06-06  108  	}
a189d28e Ruud Derwig   2016-06-06  109  
a189d28e Ruud Derwig   2016-06-06  110  	return 0;
a189d28e Ruud Derwig   2016-06-06  111  
a189d28e Ruud Derwig   2016-06-06  112  error_connector_cleanup:
a189d28e Ruud Derwig   2016-06-06  113  	drm_connector_cleanup(connector);
a189d28e Ruud Derwig   2016-06-06  114  
a189d28e Ruud Derwig   2016-06-06  115  error_encoder_cleanup:

a189d28e Ruud Derwig 2016-06-06 @116 drm_encoder_cleanup(&encoder->base);

:::::: The code at line 116 was first introduced by commit
:::::: a189d28e5edea70f20995547ddc84c79b2f76c03 drm/arcpgu: Make ARC PGU usable on simulation platforms

:::::: TO: Ruud Derwig <[email protected]> :::::: CC: Alexey Brodkin <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#11 lore raw
In reply to Daniel Vetter
I love your patch! Perhaps something to improve:

Hi Daniel,

I love your patch! Perhaps something to improve:

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.15-rc8 next-20180119]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Daniel-Vetter/drm-arcpgu-remove-drm_encoder_slave/20180120-085901
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__

sparse warnings: (new ones prefixed by >>)

>> drivers/gpu/drm/arc/arcpgu_sim.c:116:30: sparse: incorrect type in argument 1 (different base types) @@ expected struct drm_encoder @@ got strustruct drm_encoder @@
   drivers/gpu/drm/arc/arcpgu_sim.c:116:30: expected struct drm_encoder
   drivers/gpu/drm/arc/arcpgu_sim.c:116:30: got struct drm_mode_object
   drivers/gpu/drm/arc/arcpgu_sim.c: In function 'arcpgu_drm_sim_init':
   drivers/gpu/drm/arc/arcpgu_sim.c:116:22: error: passing argument 1 of 'drm_encoder_cleanup' from incompatible pointer type
    drm_encoder_cleanup(&encoder->base);
    ^

In file included from include/drm/drm_modeset_helper_vtables.h:33:0,
from include/drm/drm_crtc_helper.h:43,
from drivers/gpu/drm/arc/arcpgu_sim.c:17:
include/drm/drm_encoder.h:232:6: note: expected 'struct drm_encoder but argument is of type 'struct drm_mode_object
void drm_encoder_cleanup(struct drm_encoder
^~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +116 drivers/gpu/drm/arc/arcpgu_sim.c

a189d28e Ruud Derwig   2016-06-06   66  
a189d28e Ruud Derwig   2016-06-06   67  int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np)
a189d28e Ruud Derwig   2016-06-06   68  {
a189d28e Ruud Derwig   2016-06-06   69  	struct arcpgu_drm_connector *arcpgu_connector;
70fbd4a0 Daniel Vetter 2018-01-17   70  	struct drm_encoder *encoder;
a189d28e Ruud Derwig   2016-06-06   71  	struct drm_connector *connector;
a189d28e Ruud Derwig   2016-06-06   72  	int ret;
a189d28e Ruud Derwig   2016-06-06   73  
a189d28e Ruud Derwig   2016-06-06   74  	encoder = devm_kzalloc(drm->dev, sizeof(*encoder), GFP_KERNEL);
a189d28e Ruud Derwig   2016-06-06   75  	if (encoder == NULL)
a189d28e Ruud Derwig   2016-06-06   76  		return -ENOMEM;
a189d28e Ruud Derwig   2016-06-06   77  
70fbd4a0 Daniel Vetter 2018-01-17   78  	encoder->possible_crtcs = 1;
70fbd4a0 Daniel Vetter 2018-01-17   79  	encoder->possible_clones = 0;
a189d28e Ruud Derwig   2016-06-06   80  
70fbd4a0 Daniel Vetter 2018-01-17   81  	ret = drm_encoder_init(drm, encoder, &arcpgu_drm_encoder_funcs,
a189d28e Ruud Derwig   2016-06-06   82  			       DRM_MODE_ENCODER_VIRTUAL, NULL);
a189d28e Ruud Derwig   2016-06-06   83  	if (ret)
a189d28e Ruud Derwig   2016-06-06   84  		return ret;
a189d28e Ruud Derwig   2016-06-06   85  
a189d28e Ruud Derwig   2016-06-06   86  	arcpgu_connector = devm_kzalloc(drm->dev, sizeof(*arcpgu_connector),
a189d28e Ruud Derwig   2016-06-06   87  					GFP_KERNEL);
a189d28e Ruud Derwig   2016-06-06   88  	if (!arcpgu_connector) {
a189d28e Ruud Derwig   2016-06-06   89  		ret = -ENOMEM;
a189d28e Ruud Derwig   2016-06-06   90  		goto error_encoder_cleanup;
a189d28e Ruud Derwig   2016-06-06   91  	}
a189d28e Ruud Derwig   2016-06-06   92  
a189d28e Ruud Derwig   2016-06-06   93  	connector = &arcpgu_connector->connector;
a189d28e Ruud Derwig   2016-06-06   94  	drm_connector_helper_add(connector, &arcpgu_drm_connector_helper_funcs);
a189d28e Ruud Derwig   2016-06-06   95  
a189d28e Ruud Derwig   2016-06-06   96  	ret = drm_connector_init(drm, connector, &arcpgu_drm_connector_funcs,
a189d28e Ruud Derwig   2016-06-06   97  			DRM_MODE_CONNECTOR_VIRTUAL);
a189d28e Ruud Derwig   2016-06-06   98  	if (ret < 0) {
a189d28e Ruud Derwig   2016-06-06   99  		dev_err(drm->dev, "failed to initialize drm connector\n");
a189d28e Ruud Derwig   2016-06-06  100  		goto error_encoder_cleanup;
a189d28e Ruud Derwig   2016-06-06  101  	}
a189d28e Ruud Derwig   2016-06-06  102  
70fbd4a0 Daniel Vetter 2018-01-17  103  	ret = drm_mode_connector_attach_encoder(connector, encoder);
a189d28e Ruud Derwig   2016-06-06  104  	if (ret < 0) {
a189d28e Ruud Derwig   2016-06-06  105  		dev_err(drm->dev, "could not attach connector to encoder\n");
a189d28e Ruud Derwig   2016-06-06  106  		drm_connector_unregister(connector);
a189d28e Ruud Derwig   2016-06-06  107  		goto error_connector_cleanup;
a189d28e Ruud Derwig   2016-06-06  108  	}
a189d28e Ruud Derwig   2016-06-06  109  
a189d28e Ruud Derwig   2016-06-06  110  	return 0;
a189d28e Ruud Derwig   2016-06-06  111  
a189d28e Ruud Derwig   2016-06-06  112  error_connector_cleanup:
a189d28e Ruud Derwig   2016-06-06  113  	drm_connector_cleanup(connector);
a189d28e Ruud Derwig   2016-06-06  114  
a189d28e Ruud Derwig   2016-06-06  115  error_encoder_cleanup:

a189d28e Ruud Derwig 2016-06-06 @116 drm_encoder_cleanup(&encoder->base);

:::::: The code at line 116 was first introduced by commit
:::::: a189d28e5edea70f20995547ddc84c79b2f76c03 drm/arcpgu: Make ARC PGU usable on simulation platforms

:::::: TO: Ruud Derwig <[email protected]>
:::::: CC: Alexey Brodkin <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel