diff mbox series

[3/3] drm/omap: remove unused function

Message ID 20180329104038.29154-3-tomi.valkeinen@ti.com
State New
Headers show
Series [1/3] drm/omap: fix uninitialized ret variable | expand

Commit Message

Tomi Valkeinen March 29, 2018, 10:40 a.m. UTC
omap_framebuffer_get_next_connector() is not used, remove it.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/omap_fb.c | 27 ---------------------------
 drivers/gpu/drm/omapdrm/omap_fb.h |  2 --
 2 files changed, 29 deletions(-)

Comments

Emil Velikov March 29, 2018, 11 a.m. UTC | #1
On 29 March 2018 at 11:40, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
> omap_framebuffer_get_next_connector() is not used, remove it.
>
Seems to have been unused for a few years now.
Namely since commit 5a35876e2830511cb8110667fc426c6a6165a593

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

-Emil
Sebastian Reichel March 29, 2018, 12:31 p.m. UTC | #2
Hi,

On Thu, Mar 29, 2018 at 12:00:18PM +0100, Emil Velikov wrote:
> On 29 March 2018 at 11:40, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:

> > omap_framebuffer_get_next_connector() is not used, remove it.

> >

> Seems to have been unused for a few years now.

> Namely since commit 5a35876e2830511cb8110667fc426c6a6165a593

> 

> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>


I have a pending patch using that function to basically restore the
functionality from the referenced commit:

https://patchwork.kernel.org/patch/10207759/

-- Sebastian
Tomi Valkeinen March 29, 2018, 12:49 p.m. UTC | #3
On 29/03/18 15:31, Sebastian Reichel wrote:
> Hi,
> 
> On Thu, Mar 29, 2018 at 12:00:18PM +0100, Emil Velikov wrote:
>> On 29 March 2018 at 11:40, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
>>> omap_framebuffer_get_next_connector() is not used, remove it.
>>>
>> Seems to have been unused for a few years now.
>> Namely since commit 5a35876e2830511cb8110667fc426c6a6165a593
>>
>> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
> 
> I have a pending patch using that function to basically restore the
> functionality from the referenced commit:

Oh, ok. I'll drop this patch. These was a Klocwork warning for this
function, so the easiest fix was to remove it.

drivers/gpu/drm/omapdrm/omap_fb.c:326 INFINITE_LOOP.LOCAL (2:Error) Analyze
Infinite loop
  * omap_fb.c:326: Entering loop with precondition (from!=0) &&
(connector!=0) && from == connector
  * omap_fb.c:326: condition 0 is always false
  * omap_fb.c:326: condition 0 is always false
  * omap_fb.c:327: condition connector!=from is always false

 Tomi
Emil Velikov March 29, 2018, 1:24 p.m. UTC | #4
On 29 March 2018 at 13:31, Sebastian Reichel
<sebastian.reichel@collabora.co.uk> wrote:
> Hi,
>
> On Thu, Mar 29, 2018 at 12:00:18PM +0100, Emil Velikov wrote:
>> On 29 March 2018 at 11:40, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
>> > omap_framebuffer_get_next_connector() is not used, remove it.
>> >
>> Seems to have been unused for a few years now.
>> Namely since commit 5a35876e2830511cb8110667fc426c6a6165a593
>>
>> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
>
> I have a pending patch using that function to basically restore the
> functionality from the referenced commit:
>
> https://patchwork.kernel.org/patch/10207759/
>
Hmm I can see very few users of dirtyfb - modesetting, opentegra,
vmgfx, intel (sna only)  + the odd IGT test.

Wondering if that's because it doesn't provide that much of a benefit...
Although it might be because DRM drivers don't fully implement the
functionality ;-)

Just thinking out loud ^^.

-Emil
Sebastian Reichel March 29, 2018, 2:23 p.m. UTC | #5
Hi,

On Thu, Mar 29, 2018 at 02:24:40PM +0100, Emil Velikov wrote:
> On 29 March 2018 at 13:31, Sebastian Reichel

> <sebastian.reichel@collabora.co.uk> wrote:

> > Hi,

> >

> > On Thu, Mar 29, 2018 at 12:00:18PM +0100, Emil Velikov wrote:

> >> On 29 March 2018 at 11:40, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:

> >> > omap_framebuffer_get_next_connector() is not used, remove it.

> >> >

> >> Seems to have been unused for a few years now.

> >> Namely since commit 5a35876e2830511cb8110667fc426c6a6165a593

> >>

> >> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

> >

> > I have a pending patch using that function to basically restore the

> > functionality from the referenced commit:

> >

> > https://patchwork.kernel.org/patch/10207759/

> >

> Hmm I can see very few users of dirtyfb - modesetting, opentegra,

> vmgfx, intel (sna only)  + the odd IGT test.

>

> Wondering if that's because it doesn't provide that much of a benefit...

> Although it might be because DRM drivers don't fully implement the

> functionality ;-)

> 

> Just thinking out loud ^^.


Most DRM drivers don't implement DSI's command mode. That's not
surprising, if you consider that the typical development boards
don't have panels supporting DSI command mode. A quick grep
from me suggested, that rockchip supports DSI command mode and
they also use dirtyfb.

Also the benefit of panel self refresh seems to be big enough,
that intel tries to enable it by default since quite some time
:)

Note, that in mobile phones DSI command mode panels are not as
rare as on the development boards. Nokia N950, N9 and Droid 4
each have one of those displays.

-- Sebastian
Sebastian Reichel March 29, 2018, 2:44 p.m. UTC | #6
Hi,

On Thu, Mar 29, 2018 at 03:49:08PM +0300, Tomi Valkeinen wrote:
> On 29/03/18 15:31, Sebastian Reichel wrote:

> > Hi,

> > 

> > On Thu, Mar 29, 2018 at 12:00:18PM +0100, Emil Velikov wrote:

> >> On 29 March 2018 at 11:40, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:

> >>> omap_framebuffer_get_next_connector() is not used, remove it.

> >>>

> >> Seems to have been unused for a few years now.

> >> Namely since commit 5a35876e2830511cb8110667fc426c6a6165a593

> >>

> >> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

> > 

> > I have a pending patch using that function to basically restore the

> > functionality from the referenced commit:

> 

> Oh, ok. I'll drop this patch.


Thanks.

> These was a Klocwork warning for this function, so the easiest fix

> was to remove it.

> 

> drivers/gpu/drm/omapdrm/omap_fb.c:326 INFINITE_LOOP.LOCAL (2:Error) Analyze

> Infinite loop

>   * omap_fb.c:326: Entering loop with precondition (from!=0) &&

> (connector!=0) && from == connector


This makes sense to me, since the code initializes connector to from
and returns early if from is NULL.

>   * omap_fb.c:326: condition 0 is always false

>   * omap_fb.c:326: condition 0 is always false

>   * omap_fb.c:327: condition connector!=from is always false


Looks like list_for_each_entry_from() is not properly understood
by the static checker?

-- Sebastian
Tomi Valkeinen March 30, 2018, 6:24 a.m. UTC | #7
On 29/03/18 17:44, Sebastian Reichel wrote:

>>   * omap_fb.c:326: condition 0 is always false
>>   * omap_fb.c:326: condition 0 is always false
>>   * omap_fb.c:327: condition connector!=from is always false
> 
> Looks like list_for_each_entry_from() is not properly understood
> by the static checker?

I've seen a bunch of false positives from the checker, but this one is
the first where it indeed looks like the checker is confused. Or
alternatively it's too clever for us =).

 Tomi
diff mbox series

Patch

diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
index 5fd22ca73913..b54bcaad5cd1 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -309,33 +309,6 @@  void omap_framebuffer_unpin(struct drm_framebuffer *fb)
 	mutex_unlock(&omap_fb->lock);
 }
 
-/* iterate thru all the connectors, returning ones that are attached
- * to the same fb..
- */
-struct drm_connector *omap_framebuffer_get_next_connector(
-		struct drm_framebuffer *fb, struct drm_connector *from)
-{
-	struct drm_device *dev = fb->dev;
-	struct list_head *connector_list = &dev->mode_config.connector_list;
-	struct drm_connector *connector = from;
-
-	if (!from)
-		return list_first_entry_or_null(connector_list, typeof(*from),
-						head);
-
-	list_for_each_entry_from(connector, connector_list, head) {
-		if (connector != from) {
-			struct drm_encoder *encoder = connector->encoder;
-			struct drm_crtc *crtc = encoder ? encoder->crtc : NULL;
-			if (crtc && crtc->primary->fb == fb)
-				return connector;
-
-		}
-	}
-
-	return NULL;
-}
-
 #ifdef CONFIG_DEBUG_FS
 void omap_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m)
 {
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.h b/drivers/gpu/drm/omapdrm/omap_fb.h
index 94ad5f9e4404..c20cb4bc714d 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.h
+++ b/drivers/gpu/drm/omapdrm/omap_fb.h
@@ -38,8 +38,6 @@  int omap_framebuffer_pin(struct drm_framebuffer *fb);
 void omap_framebuffer_unpin(struct drm_framebuffer *fb);
 void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
 		struct drm_plane_state *state, struct omap_overlay_info *info);
-struct drm_connector *omap_framebuffer_get_next_connector(
-		struct drm_framebuffer *fb, struct drm_connector *from);
 bool omap_framebuffer_supports_rotation(struct drm_framebuffer *fb);
 void omap_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m);