Skip to contentSkip to conversation

Print some info into ring-buffer during loading

PATCH In review root 3 participants 4 messages Jun 19, 2022

Subsystems (2)
lore
Share & tools
lore

root

author
#0 lore raw

PATCH 1/1 Print some info into ring-buffer during loading

---
 drivers/i2c/i2c-core-base.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/i2c/i2c-core-base.c +11 -3
index d43db2c3876e..8e127ff3e32e 100644
@@ -469,6 +469,8 @@ static int i2c_device_probe(struct device *dev)
 	struct i2c_driver	*driver;
 	int status;
 
+	pr_info("I have changed i2c device driver\n");
+
 	if (!client)
 		return 0;
 
@@ -1829,6 +1831,7 @@ int i2c_for_each_dev(void *data, int (*fn)(struct device *dev, void *data))
 	int res;
 
 	mutex_lock(&core_lock);
+	pr_info("i2c_for_each_dev: before bus_for_each_dev\n");
 	res = bus_for_each_dev(&i2c_bus_type, NULL, data, fn);
 	mutex_unlock(&core_lock);
 
@@ -1838,8 +1841,10 @@ EXPORT_SYMBOL_GPL(i2c_for_each_dev);
 
 static int __process_new_driver(struct device *dev, void *data)
 {
+	pr_info("Enter process_new_driver\n");
 	if (dev->type != &i2c_adapter_type)
 		return 0;
+	pr_info("__process_new_driver, before i2c_do_add_adapter\n");
 	return i2c_do_add_adapter(data, to_i2c_adapter(dev));
 }
 
@@ -1860,13 +1865,16 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
 	driver->driver.owner = owner;
 	driver->driver.bus = &i2c_bus_type;
 	INIT_LIST_HEAD(&driver->clients);
-
+	pr_info("i2c driver name is [%s] before driver_register\n", driver->driver.name);
 	/* When registration returns, the driver core
 	 * will have called probe() for all matching-but-unbound devices.
 	 */
 	res = driver_register(&driver->driver);
-	if (res)
+	if (res){
+		pr_info("i2c driver name is [%s], res is [%d]\n", driver->driver.name, res);
 		return res;
+	}
+	pr_info("i2c driver name is [%s], after driver_register\n", driver->driver.name);
 
 	pr_debug("driver [%s] registered\n", driver->driver.name);
 
@@ -1933,7 +1941,7 @@ EXPORT_SYMBOL(i2c_clients_command);
 static int __init i2c_init(void)
 {
 	int retval;
-
+	pr_info("Jason-Lee: Entering i2c_init\n");
 	retval = of_alias_get_highest_id("i2c");
 
 	down_write(&__i2c_board_lock);
Signature · 1 line
2.25.1
#1 lore raw
Quoted 1 line · root

---

Hey Jessen Li/Jason-Lee,
(I hope one of those is your name, sorry if it isn't - just feels weird addressing a username like "root" haha.

Maybe you already know this, but adding pr_info()s is not generally a useful change. You should check out kernel newbies [0] - I think they direct people towards starting kernel development in drivers/staging where there is a lot of low hanging fruit for new developers.

Also, it might be of use to you to check out the guidelines for writing commit messages before you go any further [1].

Hope that helps & good luck!
Conor.

[0] https://kernelnewbies.org/FirstKernelPatch
[1] https://www.kernel.org/doc/html/latest/process/submitting-patches.html#the-canonical-patch-format

Quoted 63 lines
 drivers/i2c/i2c-core-base.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/i2c/i2c-core-base.c +11 -3
index d43db2c3876e..8e127ff3e32e 100644
@@ -469,6 +469,8 @@ static int i2c_device_probe(struct device *dev)
 	struct i2c_driver	*driver;
 	int status;
 
+	pr_info("I have changed i2c device driver\n");
+
 	if (!client)
 		return 0;
 
@@ -1829,6 +1831,7 @@ int i2c_for_each_dev(void *data, int (*fn)(struct device *dev, void *data))
 	int res;
 
 	mutex_lock(&core_lock);
+	pr_info("i2c_for_each_dev: before bus_for_each_dev\n");
 	res = bus_for_each_dev(&i2c_bus_type, NULL, data, fn);
 	mutex_unlock(&core_lock);
 
@@ -1838,8 +1841,10 @@ EXPORT_SYMBOL_GPL(i2c_for_each_dev);
 
 static int __process_new_driver(struct device *dev, void *data)
 {
+	pr_info("Enter process_new_driver\n");
 	if (dev->type != &i2c_adapter_type)
 		return 0;
+	pr_info("__process_new_driver, before i2c_do_add_adapter\n");
 	return i2c_do_add_adapter(data, to_i2c_adapter(dev));
 }
 
@@ -1860,13 +1865,16 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
 	driver->driver.owner = owner;
 	driver->driver.bus = &i2c_bus_type;
 	INIT_LIST_HEAD(&driver->clients);
-
+	pr_info("i2c driver name is [%s] before driver_register\n", driver->driver.name);
 	/* When registration returns, the driver core
 	 * will have called probe() for all matching-but-unbound devices.
 	 */
 	res = driver_register(&driver->driver);
-	if (res)
+	if (res){
+		pr_info("i2c driver name is [%s], res is [%d]\n", driver->driver.name, res);
 		return res;
+	}
+	pr_info("i2c driver name is [%s], after driver_register\n", driver->driver.name);
 
 	pr_debug("driver [%s] registered\n", driver->driver.name);
 
@@ -1933,7 +1941,7 @@ EXPORT_SYMBOL(i2c_clients_command);
 static int __init i2c_init(void)
 {
 	int retval;
-
+	pr_info("Jason-Lee: Entering i2c_init\n");
 	retval = of_alias_get_highest_id("i2c");
 
 	down_write(&__i2c_board_lock);
#2 lore raw
Quoted 4 lines

Hey Jessen Li/Jason-Lee,
(I hope one of those is your name, sorry if it isn't - just feels weird addressing a username like "root" haha.

I'd think sending this patch out was unintentional?

#3 lore raw
Quoted 6 lines · Wolfram Sang

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 3 lines

Hey Jessen Li/Jason-Lee,
(I hope one of those is your name, sorry if it isn't - just feels weird addressing a username like "root" haha.

I'd think sending this patch out was unintentional?

Quite possibly, but no harm in trying to help was the way I saw it!