drivers/i2c/i2c-core-base.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
---
drivers/i2c/i2c-core-base.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index d43db2c3876e..8e127ff3e32e 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -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.25.1
On 19/06/2022 09:32, root wrote:
> ---
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
> drivers/i2c/i2c-core-base.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
> index d43db2c3876e..8e127ff3e32e 100644
> --- a/drivers/i2c/i2c-core-base.c
> +++ b/drivers/i2c/i2c-core-base.c
> @@ -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);
> 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?
On 19/06/2022 12:08, Wolfram Sang wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe >> 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!
© 2016 - 2026 Red Hat, Inc.