Skip to contentSkip to conversation

auxdisplay: charlcd: Drop unneeded terminator entry

PATCH In review Andy Shevchenko 3 participants 3 messages Jul 15, 2021 Auxiliary display drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 auxdisplay: charlcd: Drop unneeded terminator entry

Besides 0 not being, strictly speaking, a pointer it's redundant after the actual terminator NULL entry. Drop the former for good.

---
 drivers/auxdisplay/charlcd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/auxdisplay/charlcd.c +1 -2
index 24fd6f369ebe..e9bc5fb4da28 100644
@@ -638,8 +638,7 @@ static int panel_notify_sys(struct notifier_block *this, unsigned long code,
 
 static struct notifier_block panel_notifier = {
 	panel_notify_sys,
-	NULL,
-	0
+	NULL
 };
 
 int charlcd_register(struct charlcd *lcd)
Signature · 1 line
2.30.2
#1 lore raw

Hi Andy,

Quoted 2 lines · Andy Shevchenko

Besides 0 not being, strictly speaking, a pointer it's redundant after the actual terminator NULL entry. Drop the former for good.

It seems to me that there is confusion caused by the absence of the field names:

Quoted 2 lines

static struct notifier_block panel_notifier = {
panel_notify_sys,

=> this is notifier_fn_t notifier_call

drivers/auxdisplay/charlcd.c static int panel_notify_sys(struct notifier_block *this, unsigned long code, · line 641

Quoted 1 line
drivers/auxdisplay/charlcd.c +0 -1
-	NULL,

=> this is struct notifier_block __rcu *next

drivers/auxdisplay/charlcd.c static int panel_notify_sys(struct notifier_block *this, unsigned long code, · line 642

Quoted 1 line
drivers/auxdisplay/charlcd.c +0 -1
-	0

=> this is int priority

drivers/auxdisplay/charlcd.c static int panel_notify_sys(struct notifier_block *this, unsigned long code, · line 641

Quoted 1 line
drivers/auxdisplay/charlcd.c +1 -0
+	NULL

So all values look OK, however they're terribly confusing. wouldn't you prefer to propose a patch to name them instead ? This would be safer, especially if the structure evolves in the future.

Thanks!
Willy

#2 lore raw
Quoted 6 lines · Willy Tarreau
Quoted 2 lines · Andy Shevchenko

Besides 0 not being, strictly speaking, a pointer it's redundant after the actual terminator NULL entry. Drop the former for good.

It seems to me that there is confusion caused by the absence of the field names

My gosh, you are right!
v2 on its way, thanks for review!

Signature · 2 lines
With Best Regards,
Andy Shevchenko