Skip to contentSkip to conversation

drm/bridge: adv7511: Remove unused code blocks

PATCH Superseded Jitendra Sharma 4 participants 13 messages Oct 18, 2016 – Oct 20, 2016

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

PATCH 1/1 drm/bridge: adv7511: Remove unused code blocks

Remove unused id_table entries
Currently this driver supports only device tree based configuration. So, no need in keeping the id_table entries

Remove redundant condition check
Remove not necessary if-else block for checking DT entry because else part will never be picked as in absence of device node, probe will fail in initial stage only.

---
 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +1 -16
index 8ed3906..44eea5c 100644
@@ -942,10 +942,7 @@ static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
 	adv7511->powered = false;
 	adv7511->status = connector_status_disconnected;
 
-	if (dev->of_node)
-		adv7511->type = (enum adv7511_type)of_device_get_match_data(dev);
-	else
-		adv7511->type = id->driver_data;
+	adv7511->type = (enum adv7511_type)of_device_get_match_data(dev);
 
 	memset(&link_config, 0, sizeof(link_config));
 
@@ -1065,17 +1062,6 @@ static int adv7511_remove(struct i2c_client *i2c)
 	return 0;
 }
 
-static const struct i2c_device_id adv7511_i2c_ids[] = {
-	{ "adv7511", ADV7511 },
-	{ "adv7511w", ADV7511 },
-	{ "adv7513", ADV7511 },
-#ifdef CONFIG_DRM_I2C_ADV7533
-	{ "adv7533", ADV7533 },
-#endif
-	{ }
-};
-MODULE_DEVICE_TABLE(i2c, adv7511_i2c_ids);
-
 static const struct of_device_id adv7511_of_ids[] = {
 	{ .compatible = "adi,adv7511", .data = (void *)ADV7511 },
 	{ .compatible = "adi,adv7511w", .data = (void *)ADV7511 },
@@ -1096,7 +1082,6 @@ static int adv7511_remove(struct i2c_client *i2c)
 		.name = "adv7511",
 		.of_match_table = adv7511_of_ids,
 	},
-	.id_table = adv7511_i2c_ids,
 	.probe = adv7511_probe,
 	.remove = adv7511_remove,
 };
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

Hi Jitendra,

Thank you for the patch.

Quoted 20 lines · On Tuesday 18 Oct 2016 15:39:58 Jitendra Sharma wrote:

Remove unused id_table entries
Currently this driver supports only device tree based configuration. So, no need in keeping the id_table entries

Remove redundant condition check
Remove not necessary if-else block for checking DT entry because else part will never be picked as in absence of device node, probe will fail in initial stage only.

---
 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 8ed3906..44eea5c 100644

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c static int adv7511_probe(struct i2c_client *i2c, const · line 946

Quoted 5 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0 -2
@@ -942,10 +942,7 @@ static int adv7511_probe(struct i2c_client *i2c, const
 struct i2c_device_id *id) adv7511->powered = false;
 	adv7511->status = connector_status_disconnected;
 
-	if (dev->of_node)
-		adv7511->type = (enum 

adv7511_type)of_device_get_match_data(dev);

Quoted 25 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +1 -13
-	else
-		adv7511->type = id->driver_data;
+	adv7511->type = (enum adv7511_type)of_device_get_match_data(dev);
 
 	memset(&link_config, 0, sizeof(link_config));
 
@@ -1065,17 +1062,6 @@ static int adv7511_remove(struct i2c_client *i2c)
 	return 0;
 }
 
-static const struct i2c_device_id adv7511_i2c_ids[] = {
-	{ "adv7511", ADV7511 },
-	{ "adv7511w", ADV7511 },
-	{ "adv7513", ADV7511 },
-#ifdef CONFIG_DRM_I2C_ADV7533
-	{ "adv7533", ADV7533 },
-#endif
-	{ }
-};
-MODULE_DEVICE_TABLE(i2c, adv7511_i2c_ids);
-
 static const struct of_device_id adv7511_of_ids[] = {
 	{ .compatible = "adi,adv7511", .data = (void *)ADV7511 },
 	{ .compatible = "adi,adv7511w", .data = (void *)ADV7511 },

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c static int adv7511_remove(struct i2c_client *i2c) · line 1099

Quoted 4 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0 -1
@@ -1096,7 +1082,6 @@ static int adv7511_remove(struct i2c_client *i2c)
 		.name = "adv7511",
 		.of_match_table = adv7511_of_ids,
 	},
-	.id_table = adv7511_i2c_ids,

Have you tested this ? With your patch applied the OF-instantiated adv7611w is never probed on my system.

Quoted 3 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0 -0
 	.probe = adv7511_probe,
 	.remove = adv7511_remove,
 };
Signature · 8 lines
Regards,

Laurent Pinchart

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

Hi Laurent,

Thanks for trying it out.

Quoted 54 lines · Laurent Pinchart

Hi Jitendra,

Thank you for the patch.

Quoted 20 lines · On Tuesday 18 Oct 2016 15:39:58 Jitendra Sharma wrote:

Remove unused id_table entries
Currently this driver supports only device tree based configuration. So, no need in keeping the id_table entries

Remove redundant condition check
Remove not necessary if-else block for checking DT entry because else part will never be picked as in absence of device node, probe will fail in initial stage only.

---
  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 17 +----------------
  1 file changed, 1 insertion(+), 16 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 8ed3906..44eea5c 100644

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c static int adv7511_probe(struct i2c_client *i2c, const · line 946

Quoted 5 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0 -2
@@ -942,10 +942,7 @@ static int adv7511_probe(struct i2c_client *i2c, const
 struct i2c_device_id *id) adv7511->powered = false;
  	adv7511->status = connector_status_disconnected;
 
-	if (dev->of_node)
-		adv7511->type = (enum

adv7511_type)of_device_get_match_data(dev);

Quoted 23 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +1 -13
-	else
-		adv7511->type = id->driver_data;
+	adv7511->type = (enum adv7511_type)of_device_get_match_data(dev);
 
  	memset(&link_config, 0, sizeof(link_config));
 
@@ -1065,17 +1062,6 @@ static int adv7511_remove(struct i2c_client *i2c)
  	return 0;
  }
 
-static const struct i2c_device_id adv7511_i2c_ids[] = {
-	{ "adv7511", ADV7511 },
-	{ "adv7511w", ADV7511 },
-	{ "adv7513", ADV7511 },
-#ifdef CONFIG_DRM_I2C_ADV7533
-	{ "adv7533", ADV7533 },
-#endif
-	{ }
-};
-MODULE_DEVICE_TABLE(i2c, adv7511_i2c_ids);
-
  static const struct of_device_id adv7511_of_ids[] = {
  	{ .compatible = "adi,adv7511", .data = (void *)ADV7511 },
Quoted 8 lines

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c static int adv7511_remove(struct i2c_client *i2c) · line 1099

Quoted 6 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0 -1
  	{ .compatible = "adi,adv7511w", .data = (void *)ADV7511 },
@@ -1096,7 +1082,6 @@ static int adv7511_remove(struct i2c_client *i2c)
  		.name = "adv7511",
  		.of_match_table = adv7511_of_ids,
  	},
-	.id_table = adv7511_i2c_ids,

Have you tested this ? With your patch applied the OF-instantiated adv7611w is never probed on my system.

Will look into it

Quoted 4 lines

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c static int adv7511_remove(struct i2c_client *i2c) · line 1087

Quoted 4 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0 -0
  	.probe = adv7511_probe,
  	.remove = adv7511_remove,
  };

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

#3 lore raw

PATCH v2 1/1 drm/bridge: adv7511: Remove unused code blocks

In reply to Jitendra Sharma

Remove redundant condition check
Remove not necessary if-else block for checking DT entry because else part will never be picked as in absence of device node, probe will fail in initial stage only.

Remove unused id->driver_data entries
As id->driver_data is not used in driver source. So no need in Keeping these entries in id_table

---
Probe was not happening in Patch v1 due to removal of .id_table.As the intention of this patch is not to change any functionality, also changes looks simple enough.So, didn't verified Patch v1 over hardware Hence fixing the issues in Patch v1 and posting patch v2

Changes for v2:
- Keep the id_table entries
- Keep the id->driver_data to 0

---
 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +5 -8
index 8ed3906..3279059 100644
@@ -942,10 +942,7 @@ static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
 	adv7511->powered = false;
 	adv7511->status = connector_status_disconnected;
 
-	if (dev->of_node)
-		adv7511->type = (enum adv7511_type)of_device_get_match_data(dev);
-	else
-		adv7511->type = id->driver_data;
+	adv7511->type = (enum adv7511_type)of_device_get_match_data(dev);
 
 	memset(&link_config, 0, sizeof(link_config));
 
@@ -1066,11 +1063,11 @@ static int adv7511_remove(struct i2c_client *i2c)
 }
 
 static const struct i2c_device_id adv7511_i2c_ids[] = {
-	{ "adv7511", ADV7511 },
-	{ "adv7511w", ADV7511 },
-	{ "adv7513", ADV7511 },
+	{ "adv7511", 0 },
+	{ "adv7511w", 0 },
+	{ "adv7513", 0 },
 #ifdef CONFIG_DRM_I2C_ADV7533
-	{ "adv7533", ADV7533 },
+	{ "adv7533", 0 },
 #endif
 	{ }
 };
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

Hi Jitendra,

Thank you for the patch.

Quoted 9 lines · On Wednesday 19 Oct 2016 17:12:48 Jitendra Sharma wrote:

Remove redundant condition check
Remove not necessary if-else block for checking DT entry because else part will never be picked as in absence of device node, probe will fail in initial stage only.

Remove unused id->driver_data entries
As id->driver_data is not used in driver source. So no need in Keeping these entries in id_table

Quoted 5 lines

---
Probe was not happening in Patch v1 due to removal of .id_table.As the intention of this patch is not to change any functionality, also changes looks simple enough.So, didn't verified Patch v1 over hardware

You should *ALWAYS* verify patches before sending them out.

I assume you've now properly tested this one ?

Quoted 15 lines

Hence fixing the issues in Patch v1 and posting patch v2

Changes for v2:
- Keep the id_table entries
- Keep the id->driver_data to 0

---
 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 8ed3906..3279059 100644

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c static int adv7511_probe(struct i2c_client *i2c, const · line 946

Quoted 5 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0 -2
@@ -942,10 +942,7 @@ static int adv7511_probe(struct i2c_client *i2c, const
 struct i2c_device_id *id) adv7511->powered = false;
 	adv7511->status = connector_status_disconnected;
 
-	if (dev->of_node)
-		adv7511->type = (enum 

adv7511_type)of_device_get_match_data(dev);

Quoted 10 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +1 -2
-	else
-		adv7511->type = id->driver_data;
+	adv7511->type = (enum adv7511_type)of_device_get_match_data(dev);
 
 	memset(&link_config, 0, sizeof(link_config));
 
@@ -1066,11 +1063,11 @@ static int adv7511_remove(struct i2c_client *i2c)
 }
 
 static const struct i2c_device_id adv7511_i2c_ids[] = {

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c static int adv7511_remove(struct i2c_client *i2c) · line 1071

Quoted 10 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +4 -4
-	{ "adv7511", ADV7511 },
-	{ "adv7511w", ADV7511 },
-	{ "adv7513", ADV7511 },
+	{ "adv7511", 0 },
+	{ "adv7511w", 0 },
+	{ "adv7513", 0 },
 #ifdef CONFIG_DRM_I2C_ADV7533
-	{ "adv7533", ADV7533 },
+	{ "adv7533", 0 },
 #endif

What's the purpose of this ? It doesn't save any memory or CPU cycle.

Quoted 2 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0 -0
 	{ }
 };
Signature · 8 lines
Regards,

Laurent Pinchart

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

Hi Laurent,

Quoted 14 lines · Laurent Pinchart

Hi Jitendra,

Thank you for the patch.

Quoted 9 lines · On Wednesday 19 Oct 2016 17:12:48 Jitendra Sharma wrote:

Remove redundant condition check
Remove not necessary if-else block for checking DT entry because else part will never be picked as in absence of device node, probe will fail in initial stage only.

Remove unused id->driver_data entries
As id->driver_data is not used in driver source. So no need in Keeping these entries in id_table

Quoted 6 lines
Quoted 5 lines

---
Probe was not happening in Patch v1 due to removal of .id_table.As the intention of this patch is not to change any functionality, also changes looks simple enough.So, didn't verified Patch v1 over hardware

You should *ALWAYS* verify patches before sending them out.

Will keep in mind

Quoted 33 lines

I assume you've now properly tested this one ?

Quoted 15 lines

Hence fixing the issues in Patch v1 and posting patch v2

Changes for v2:
- Keep the id_table entries
- Keep the id->driver_data to 0

---
  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 13 +++++--------
  1 file changed, 5 insertions(+), 8 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 8ed3906..3279059 100644

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c static int adv7511_probe(struct i2c_client *i2c, const · line 946

Quoted 5 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0 -2
@@ -942,10 +942,7 @@ static int adv7511_probe(struct i2c_client *i2c, const
 struct i2c_device_id *id) adv7511->powered = false;
  	adv7511->status = connector_status_disconnected;
 
-	if (dev->of_node)
-		adv7511->type = (enum

adv7511_type)of_device_get_match_data(dev);

Quoted 9 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +1 -2
-	else
-		adv7511->type = id->driver_data;
+	adv7511->type = (enum adv7511_type)of_device_get_match_data(dev);
 
  	memset(&link_config, 0, sizeof(link_config));
 
@@ -1066,11 +1063,11 @@ static int adv7511_remove(struct i2c_client *i2c)
  }
 
Quoted 12 lines

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c static int adv7511_remove(struct i2c_client *i2c) · line 1071

Quoted 11 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +4 -4
  static const struct i2c_device_id adv7511_i2c_ids[] = {
-	{ "adv7511", ADV7511 },
-	{ "adv7511w", ADV7511 },
-	{ "adv7513", ADV7511 },
+	{ "adv7511", 0 },
+	{ "adv7511w", 0 },
+	{ "adv7513", 0 },
  #ifdef CONFIG_DRM_I2C_ADV7533
-	{ "adv7533", ADV7533 },
+	{ "adv7533", 0 },
  #endif

What's the purpose of this ? It doesn't save any memory or CPU cycle.

Idea is to remove unnecessary code, variables and if possible to reduce lines of code for example here by eliminating obvious branching. Regarding memory or cpu cyles, no difference could be because of compiler optimization

Quoted 3 lines

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c static int adv7511_remove(struct i2c_client *i2c) · line 1073

Quoted 3 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0 -0
  	{ }
  };

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

#6 lore raw

Hi.,

Quoted 18 lines · Jitendra

Hi Laurent,

Quoted 14 lines · Laurent Pinchart

Hi Jitendra,

Thank you for the patch.

Quoted 9 lines · On Wednesday 19 Oct 2016 17:12:48 Jitendra Sharma wrote:

Remove redundant condition check
Remove not necessary if-else block for checking DT entry because else part will never be picked as in absence of device node, probe will fail in initial stage only.

Remove unused id->driver_data entries
As id->driver_data is not used in driver source. So no need in Keeping these entries in id_table

Quoted 9 lines
Quoted 6 lines
Quoted 5 lines

---
Probe was not happening in Patch v1 due to removal of .id_table.As the intention of this patch is not to change any functionality, also changes looks simple enough.So, didn't verified Patch v1 over hardware

You should *ALWAYS* verify patches before sending them out.

Will keep in mind

Quoted 2 lines

I assume you've now properly tested this one ?

Tested v2 on Jitendra's behalf.

Thanks,
Archit

Quoted 53 lines
Quoted 33 lines
Quoted 20 lines

Hence fixing the issues in Patch v1 and posting patch v2

Changes for v2:
- Keep the id_table entries
- Keep the id->driver_data to 0

---
  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 13 +++++--------
  1 file changed, 5 insertions(+), 8 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 8ed3906..3279059 100644

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0 -0
@@ -942,10 +942,7 @@ static int adv7511_probe(struct i2c_client *i2c,

const

struct i2c_device_id *id) adv7511->powered = false;
      adv7511->status = connector_status_disconnected;

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c

Quoted 2 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0 -2
-    if (dev->of_node)
-        adv7511->type = (enum

adv7511_type)of_device_get_match_data(dev);

Quoted 10 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +1 -2
-    else
-        adv7511->type = id->driver_data;
+    adv7511->type = (enum adv7511_type)of_device_get_match_data(dev);
 
      memset(&link_config, 0, sizeof(link_config));
@@ -1066,11 +1063,11 @@ static int adv7511_remove(struct i2c_client
 *i2c)
  }
 
Quoted 12 lines

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c static int adv7511_remove(struct i2c_client *i2c) · line 1071

Quoted 11 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +4 -4
  static const struct i2c_device_id adv7511_i2c_ids[] = {
-    { "adv7511", ADV7511 },
-    { "adv7511w", ADV7511 },
-    { "adv7513", ADV7511 },
+    { "adv7511", 0 },
+    { "adv7511w", 0 },
+    { "adv7513", 0 },
  #ifdef CONFIG_DRM_I2C_ADV7533
-    { "adv7533", ADV7533 },
+    { "adv7533", 0 },
  #endif

What's the purpose of this ? It doesn't save any memory or CPU cycle.

Idea is to remove unnecessary code, variables and if possible to reduce lines of code for example here by eliminating obvious branching. Regarding memory or cpu cyles, no difference could be because of compiler optimization

Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0 -0
      { }
  };
Signature · 6 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw
In reply to Sharma, Jitendra

Hi Jitendra,

Quoted 74 lines · Jitendra
Quoted 10 lines · Laurent Pinchart
Quoted 9 lines · On Wednesday 19 Oct 2016 17:12:48 Jitendra Sharma wrote:

Remove redundant condition check
Remove not necessary if-else block for checking DT entry because else part will never be picked as in absence of device node, probe will fail in initial stage only.

Remove unused id->driver_data entries
As id->driver_data is not used in driver source. So no need in Keeping these entries in id_table

Quoted 7 lines
Quoted 5 lines

---
Probe was not happening in Patch v1 due to removal of .id_table.As the intention of this patch is not to change any functionality, also changes looks simple enough.So, didn't verified Patch v1 over hardware

You should *ALWAYS* verify patches before sending them out.

Will keep in mind

Quoted 53 lines

I assume you've now properly tested this one ?

Quoted 22 lines

Hence fixing the issues in Patch v1 and posting patch v2

Changes for v2:
- Keep the id_table entries
- Keep the id->driver_data to 0

---

  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 13 +++++--------
  1 file changed, 5 insertions(+), 8 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 8ed3906..3279059 100644

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0 -0
@@ -942,10 +942,7 @@ static int adv7511_probe(struct i2c_client *i2c,

const
struct i2c_device_id *id) adv7511->powered = false;

  	adv7511->status = connector_status_disconnected;

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c

Quoted 2 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0 -2
-	if (dev->of_node)
-		adv7511->type = (enum

adv7511_type)of_device_get_match_data(dev);

Quoted 24 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +5 -6
-	else
-		adv7511->type = id->driver_data;
+	adv7511->type = (enum adv7511_type)of_device_get_match_data(dev);
 
  	memset(&link_config, 0, sizeof(link_config));
@@ -1066,11 +1063,11 @@ static int adv7511_remove(struct i2c_client *i2c)
 
  }
 
  static const struct i2c_device_id adv7511_i2c_ids[] = {
 
-	{ "adv7511", ADV7511 },
-	{ "adv7511w", ADV7511 },
-	{ "adv7513", ADV7511 },
+	{ "adv7511", 0 },
+	{ "adv7511w", 0 },
+	{ "adv7513", 0 },
 
  #ifdef CONFIG_DRM_I2C_ADV7533
 
-	{ "adv7533", ADV7533 },
+	{ "adv7533", 0 },
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
  #endif

What's the purpose of this ? It doesn't save any memory or CPU cycle.

Idea is to remove unnecessary code, variables and if possible to reduce lines of code for example here by eliminating obvious branching. Regarding memory or cpu cyles, no difference could be because of compiler optimization

For the code block in the probe function I understand, but for the initializers here I don't see the point.

And one might argue that using id->driver_data unconditionally would be better as it would save a call to of_device_get_match_data()...

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

{ }

  };
Signature · 8 lines
Regards,

Laurent Pinchart

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

Hi Laurent,

Quoted 80 lines · Laurent Pinchart

Hi Jitendra,

Quoted 71 lines · Jitendra
Quoted 10 lines · Laurent Pinchart
Quoted 9 lines · On Wednesday 19 Oct 2016 17:12:48 Jitendra Sharma wrote:

Remove redundant condition check
Remove not necessary if-else block for checking DT entry because else part will never be picked as in absence of device node, probe will fail in initial stage only.

Remove unused id->driver_data entries
As id->driver_data is not used in driver source. So no need in Keeping these entries in id_table

Quoted 6 lines
Quoted 5 lines

---
Probe was not happening in Patch v1 due to removal of .id_table.As the intention of this patch is not to change any functionality, also changes looks simple enough.So, didn't verified Patch v1 over hardware

You should *ALWAYS* verify patches before sending them out.

Will keep in mind

Quoted 52 lines

I assume you've now properly tested this one ?

Quoted 22 lines

Hence fixing the issues in Patch v1 and posting patch v2

Changes for v2:
- Keep the id_table entries
- Keep the id->driver_data to 0

---

   drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 13 +++++--------
   1 file changed, 5 insertions(+), 8 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 8ed3906..3279059 100644

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0 -0
@@ -942,10 +942,7 @@ static int adv7511_probe(struct i2c_client *i2c,

const
struct i2c_device_id *id) adv7511->powered = false;

   	adv7511->status = connector_status_disconnected;

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c

Quoted 2 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0 -2
-	if (dev->of_node)
-		adv7511->type = (enum

adv7511_type)of_device_get_match_data(dev);

Quoted 24 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +5 -6
-	else
-		adv7511->type = id->driver_data;
+	adv7511->type = (enum adv7511_type)of_device_get_match_data(dev);
 
   	memset(&link_config, 0, sizeof(link_config));
@@ -1066,11 +1063,11 @@ static int adv7511_remove(struct i2c_client *i2c)
 
   }
 
   static const struct i2c_device_id adv7511_i2c_ids[] = {
 
-	{ "adv7511", ADV7511 },
-	{ "adv7511w", ADV7511 },
-	{ "adv7513", ADV7511 },
+	{ "adv7511", 0 },
+	{ "adv7511w", 0 },
+	{ "adv7513", 0 },
 
   #ifdef CONFIG_DRM_I2C_ADV7533
 
-	{ "adv7533", ADV7533 },
+	{ "adv7533", 0 },
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
   #endif

What's the purpose of this ? It doesn't save any memory or CPU cycle.

Idea is to remove unnecessary code, variables and if possible to reduce lines of code for example here by eliminating obvious branching. Regarding memory or cpu cyles, no difference could be because of compiler optimization

Quoted 5 lines

For the code block in the probe function I understand, but for the initializers here I don't see the point.

And one might argue that using id->driver_data unconditionally would be better as it would save a call to of_device_get_match_data()...

Agreed.
So, there could be two ways round either use id->driver_data unconditionally or use of_device_get_match_data(). IMO it would be better to use id->driver_data unconditionally and save a call to of_device_get_match_data() What would you suggest to move ahead?

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
   	{ }
   
   };

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

#9 lore raw

Hi Jitendra,

Quoted 85 lines · Jitendra
Quoted 78 lines · Laurent Pinchart
Quoted 72 lines · Jitendra
Quoted 10 lines · Laurent Pinchart
Quoted 9 lines · On Wednesday 19 Oct 2016 17:12:48 Jitendra Sharma wrote:

Remove redundant condition check
Remove not necessary if-else block for checking DT entry because else part will never be picked as in absence of device node, probe will fail in initial stage only.

Remove unused id->driver_data entries
As id->driver_data is not used in driver source. So no need in Keeping these entries in id_table

Quoted 7 lines
Quoted 5 lines

---
Probe was not happening in Patch v1 due to removal of .id_table.As the intention of this patch is not to change any functionality, also changes looks simple enough.So, didn't verified Patch v1 over hardware

You should *ALWAYS* verify patches before sending them out.

Will keep in mind

Quoted 37 lines

I assume you've now properly tested this one ?

Quoted 35 lines

Hence fixing the issues in Patch v1 and posting patch v2

Changes for v2:
- Keep the id_table entries
- Keep the id->driver_data to 0

---

   drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 13 +++++--------
   1 file changed, 5 insertions(+), 8 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 8ed3906..3279059 100644

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +1 -4
@@ -942,10 +942,7 @@ static int adv7511_probe(struct i2c_client *i2c,
 const struct i2c_device_id *id)
 		adv7511->powered = false;
   	adv7511->status = connector_status_disconnected;
 
-	if (dev->of_node)
-		adv7511->type = (enum
 adv7511_type)of_device_get_match_data(dev);
-	else
-		adv7511->type = id->driver_data;
+	adv7511->type = (enum
 adv7511_type)of_device_get_match_data(dev);
   	memset(&link_config, 0, sizeof(link_config));
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0 -0
@@ -1066,11 +1063,11 @@ static int adv7511_remove(struct i2c_client
 *i2c)
   }
 
Quoted 13 lines

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c static int adv7511_remove(struct i2c_client *i2c) · line 1071

Quoted 11 lines
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +4 -4
   static const struct i2c_device_id adv7511_i2c_ids[] = {
-	{ "adv7511", ADV7511 },
-	{ "adv7511w", ADV7511 },
-	{ "adv7513", ADV7511 },
+	{ "adv7511", 0 },
+	{ "adv7511w", 0 },
+	{ "adv7513", 0 },
   #ifdef CONFIG_DRM_I2C_ADV7533
-	{ "adv7533", ADV7533 },
+	{ "adv7533", 0 },
   #endif

What's the purpose of this ? It doesn't save any memory or CPU cycle.

Quoted 4 lines

Idea is to remove unnecessary code, variables and if possible to reduce lines of code for example here by eliminating obvious branching. Regarding memory or cpu cyles, no difference could be because of compiler optimization

Quoted 5 lines

For the code block in the probe function I understand, but for the initializers here I don't see the point.

And one might argue that using id->driver_data unconditionally would be better as it would save a call to of_device_get_match_data()...

Quoted 6 lines

Agreed.
So, there could be two ways round either use id->driver_data unconditionally or use of_device_get_match_data().
IMO it would be better to use id->driver_data unconditionally and save a call to of_device_get_match_data()
What would you suggest to move ahead?

I'd suggest using id->driver_data unconditionally, but I'd like Wolfram's opinion on this (CC'ed).

Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#10 lore raw
Quoted 7 lines
Quoted 4 lines

IMO it would be better to use id->driver_data unconditionally and save a call to of_device_get_match_data()
What would you suggest to move ahead?

I'd suggest using id->driver_data unconditionally, but I'd like Wolfram's opinion on this (CC'ed).

IIUC: I'd suggest to leave it as it is.

There are people working on removing the quirky fallback to i2c_device_id in case of_compatible is not provided. If that gets mainline, you don't have i2c_device_id anymore with DT matching. So all binding methods should be self-contained.

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

#11 lore raw

Thanks for comments.

Quoted 11 lines · Wolfram Sang
Quoted 5 lines
Quoted 3 lines

IMO it would be better to use id->driver_data unconditionally and save a call to of_device_get_match_data()
What would you suggest to move ahead?

I'd suggest using id->driver_data unconditionally, but I'd like Wolfram's opinion on this (CC'ed).

IIUC: I'd suggest to leave it as it is.

There are people working on removing the quirky fallback to i2c_device_id in case of_compatible is not provided. If that gets mainline, you don't have i2c_device_id anymore with DT matching. So all binding methods should be self-contained.

ok
Should we leave as it is, redundant if-else code block also, or fix it as posted in patch v2

Quoted 7 lines

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

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