mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] driver: clean up comment formatting and spacing
@ 2025-07-11 12:27 Bo Sun
  2025-07-11 12:27 ` [PATCH 2/3] miitool: clarify help text for default behavior and -s option Bo Sun
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Bo Sun @ 2025-07-11 12:27 UTC (permalink / raw)
  To: barebox

- Fixed a missing closing parenthesis in the comment for DEVICE_ID_SINGLE
- Cleaned up indentation and alignment of multi-line comments in struct device
- Removed redundant spaces in function pointer declarations

No functional changes.

Signed-off-by: Bo Sun <bo@mboxify.com>
---
 include/device.h | 18 ++++++++++--------
 include/driver.h |  8 ++++----
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/include/device.h b/include/device.h
index bc3a348e2e..97fa040365 100644
--- a/include/device.h
+++ b/include/device.h
@@ -37,7 +37,7 @@ struct device {
 	/*! This member is used to store device's unique name as
 	 *  obtained by calling dev_id(). Internal field, do not
 	 *  access it directly.
-	  */
+	 */
 	char *unique_name;
 	/*! The id is used to uniquely identify a device in the system. The id
 	 * will show up under /dev/ as the device's name. Usually this is
@@ -58,14 +58,16 @@ struct device {
 		void *priv;
 		void *driver_data;
 	};
-	void *type_data;     /*! In case this device is a specific device, this pointer
-			      * points to the type specific device, i.e. eth_device
-			      */
+	/*! In case this device is a specific device, this pointer
+	 * points to the type specific device, i.e. eth_device
+	 */
+	void *type_data;
+
 	struct driver *driver; /*! The driver for this device */
 
 	struct list_head list;     /* The list of all devices */
-	struct list_head bus_list; /* our bus            */
-	struct list_head children; /* our children            */
+	struct list_head bus_list; /* our bus */
+	struct list_head children; /* our children */
 	struct list_head sibling;
 	struct list_head active;   /* The list of all devices which have a driver */
 
@@ -102,8 +104,8 @@ struct device {
 	 * For devices which take longer to probe this is called
 	 * when the driver should actually detect client devices
 	 */
-	int     (*detect) (struct device *);
-	void	(*rescan) (struct device *);
+	int (*detect)(struct device *);
+	void (*rescan)(struct device *);
 
 	/*
 	 * if a driver probe is deferred, this stores the last error
diff --git a/include/driver.h b/include/driver.h
index dd50a7aa3c..510a32186d 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -36,13 +36,13 @@ struct driver {
 	const char *name;
 
 	struct list_head list;
-	struct list_head bus_list; /* our bus            */
+	struct list_head bus_list; /* our bus */
 
 	/*! Called if an instance of a device is found */
-	int     (*probe) (struct device *);
+	int (*probe)(struct device *);
 
 	/*! Called if an instance of a device is gone. */
-	void     (*remove)(struct device *);
+	void (*remove)(struct device *);
 
 	struct bus_type *bus;
 
@@ -61,7 +61,7 @@ struct driver {
 
 /* dynamically assign the next free id */
 #define DEVICE_ID_DYNAMIC	-2
-/* do not use an id (only one device available */
+/* do not use an id (only one device available) */
 #define DEVICE_ID_SINGLE	-1
 
 /* Register devices and drivers.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/3] miitool: clarify help text for default behavior and -s option
  2025-07-11 12:27 [PATCH 1/3] driver: clean up comment formatting and spacing Bo Sun
@ 2025-07-11 12:27 ` Bo Sun
  2025-07-11 12:53   ` Ahmad Fatoum
  2025-07-11 12:27 ` [PATCH 3/3] of: base: fix of_match_node function documentation Bo Sun
  2025-07-11 12:39 ` [PATCH 1/3] driver: clean up comment formatting and spacing Ahmad Fatoum
  2 siblings, 1 reply; 7+ messages in thread
From: Bo Sun @ 2025-07-11 12:27 UTC (permalink / raw)
  To: barebox

The -s option description was misleading about default behavior.
Clarify that miitool without options shows all PHYs, and -s requires
a device argument.

Signed-off-by: Bo Sun <bo@mboxify.com>
---
 commands/miitool.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/commands/miitool.c b/commands/miitool.c
index 0121fdc542..0c70b51ad3 100644
--- a/commands/miitool.c
+++ b/commands/miitool.c
@@ -344,9 +344,11 @@ BAREBOX_CMD_HELP_TEXT("Media Independent Interface (MII) unit as well as allowin
 BAREBOX_CMD_HELP_TEXT("register dummy PHY devices for raw MDIO access. Most fast ethernet")
 BAREBOX_CMD_HELP_TEXT("adapters use an MII to autonegotiate link speed and duplex setting.")
 BAREBOX_CMD_HELP_TEXT("")
+BAREBOX_CMD_HELP_TEXT("When run without options, shows status of all PHYs.")
+BAREBOX_CMD_HELP_TEXT("")
 BAREBOX_CMD_HELP_TEXT("Options:")
 BAREBOX_CMD_HELP_OPT("-v", "increase verbosity")
-BAREBOX_CMD_HELP_OPT("-s <devpath/devname>", "show PHY status (not providing PHY prints status of all)")
+BAREBOX_CMD_HELP_OPT("-s <devpath/devname>", "show PHY status for specified device")
 BAREBOX_CMD_HELP_OPT("-r <busno>:<adr>", "register a PHY")
 BAREBOX_CMD_HELP_END
 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/3] of: base: fix of_match_node function documentation
  2025-07-11 12:27 [PATCH 1/3] driver: clean up comment formatting and spacing Bo Sun
  2025-07-11 12:27 ` [PATCH 2/3] miitool: clarify help text for default behavior and -s option Bo Sun
@ 2025-07-11 12:27 ` Bo Sun
  2025-07-11 12:55   ` Ahmad Fatoum
  2025-07-11 12:39 ` [PATCH 1/3] driver: clean up comment formatting and spacing Ahmad Fatoum
  2 siblings, 1 reply; 7+ messages in thread
From: Bo Sun @ 2025-07-11 12:27 UTC (permalink / raw)
  To: barebox

Fix grammar error, correct structure name, and add missing return
value description.

Signed-off-by: Bo Sun <bo@mboxify.com>
---
 drivers/of/base.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 1439e55a0a..903adb3670 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -778,11 +778,13 @@ struct device_node *of_find_node_with_property(struct device_node *from,
 EXPORT_SYMBOL(of_find_node_with_property);
 
 /**
- * of_match_node - Tell if an device_node has a matching of_match structure
+ * of_match_node - Tell if a device_node has a matching of_device_id structure
  *      @matches:       array of of device match structures to search in
  *      @node:          the of device structure to match against
  *
  *      Low level utility function used by device matching.
+ *
+ *      Return: pointer to the best matching of_device_id structure, or NULL
  */
 const struct of_device_id *of_match_node(const struct of_device_id *matches,
 					 const struct device_node *node)



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] driver: clean up comment formatting and spacing
  2025-07-11 12:27 [PATCH 1/3] driver: clean up comment formatting and spacing Bo Sun
  2025-07-11 12:27 ` [PATCH 2/3] miitool: clarify help text for default behavior and -s option Bo Sun
  2025-07-11 12:27 ` [PATCH 3/3] of: base: fix of_match_node function documentation Bo Sun
@ 2025-07-11 12:39 ` Ahmad Fatoum
  2025-07-11 13:43   ` Bo Sun
  2 siblings, 1 reply; 7+ messages in thread
From: Ahmad Fatoum @ 2025-07-11 12:39 UTC (permalink / raw)
  To: Bo Sun, barebox

Hello Bo,

On 7/11/25 14:27, Bo Sun wrote:
> - Fixed a missing closing parenthesis in the comment for DEVICE_ID_SINGLE
> - Cleaned up indentation and alignment of multi-line comments in struct device
> - Removed redundant spaces in function pointer declarations
> 
> No functional changes.
> 
> Signed-off-by: Bo Sun <bo@mboxify.com>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> ---
>  include/device.h | 18 ++++++++++--------
>  include/driver.h |  8 ++++----
>  2 files changed, 14 insertions(+), 12 deletions(-)
> 
> diff --git a/include/device.h b/include/device.h
> index bc3a348e2e..97fa040365 100644
> --- a/include/device.h
> +++ b/include/device.h
> @@ -37,7 +37,7 @@ struct device {
>  	/*! This member is used to store device's unique name as
>  	 *  obtained by calling dev_id(). Internal field, do not
>  	 *  access it directly.
> -	  */
> +	 */

Would you like to use the occasion to switch this over to kerneldoc
style? Kerneldoc is much more common in newer barebox code and would
allow us using the same infrastructure in future.

Cheers,
Ahmad

>  	char *unique_name;
>  	/*! The id is used to uniquely identify a device in the system. The id
>  	 * will show up under /dev/ as the device's name. Usually this is
> @@ -58,14 +58,16 @@ struct device {
>  		void *priv;
>  		void *driver_data;
>  	};
> -	void *type_data;     /*! In case this device is a specific device, this pointer
> -			      * points to the type specific device, i.e. eth_device
> -			      */
> +	/*! In case this device is a specific device, this pointer
> +	 * points to the type specific device, i.e. eth_device
> +	 */
> +	void *type_data;
> +
>  	struct driver *driver; /*! The driver for this device */
>  
>  	struct list_head list;     /* The list of all devices */
> -	struct list_head bus_list; /* our bus            */
> -	struct list_head children; /* our children            */
> +	struct list_head bus_list; /* our bus */
> +	struct list_head children; /* our children */
>  	struct list_head sibling;
>  	struct list_head active;   /* The list of all devices which have a driver */
>  
> @@ -102,8 +104,8 @@ struct device {
>  	 * For devices which take longer to probe this is called
>  	 * when the driver should actually detect client devices
>  	 */
> -	int     (*detect) (struct device *);
> -	void	(*rescan) (struct device *);
> +	int (*detect)(struct device *);
> +	void (*rescan)(struct device *);
>  
>  	/*
>  	 * if a driver probe is deferred, this stores the last error
> diff --git a/include/driver.h b/include/driver.h
> index dd50a7aa3c..510a32186d 100644
> --- a/include/driver.h
> +++ b/include/driver.h
> @@ -36,13 +36,13 @@ struct driver {
>  	const char *name;
>  
>  	struct list_head list;
> -	struct list_head bus_list; /* our bus            */
> +	struct list_head bus_list; /* our bus */
>  
>  	/*! Called if an instance of a device is found */
> -	int     (*probe) (struct device *);
> +	int (*probe)(struct device *);
>  
>  	/*! Called if an instance of a device is gone. */
> -	void     (*remove)(struct device *);
> +	void (*remove)(struct device *);
>  
>  	struct bus_type *bus;
>  
> @@ -61,7 +61,7 @@ struct driver {
>  
>  /* dynamically assign the next free id */
>  #define DEVICE_ID_DYNAMIC	-2
> -/* do not use an id (only one device available */
> +/* do not use an id (only one device available) */
>  #define DEVICE_ID_SINGLE	-1
>  
>  /* Register devices and drivers.
> 
> 

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] miitool: clarify help text for default behavior and -s option
  2025-07-11 12:27 ` [PATCH 2/3] miitool: clarify help text for default behavior and -s option Bo Sun
@ 2025-07-11 12:53   ` Ahmad Fatoum
  0 siblings, 0 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2025-07-11 12:53 UTC (permalink / raw)
  To: Bo Sun, barebox



On 7/11/25 14:27, Bo Sun wrote:
> The -s option description was misleading about default behavior.
> Clarify that miitool without options shows all PHYs, and -s requires
> a device argument.
> 
> Signed-off-by: Bo Sun <bo@mboxify.com>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> ---
>  commands/miitool.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/commands/miitool.c b/commands/miitool.c
> index 0121fdc542..0c70b51ad3 100644
> --- a/commands/miitool.c
> +++ b/commands/miitool.c
> @@ -344,9 +344,11 @@ BAREBOX_CMD_HELP_TEXT("Media Independent Interface (MII) unit as well as allowin
>  BAREBOX_CMD_HELP_TEXT("register dummy PHY devices for raw MDIO access. Most fast ethernet")
>  BAREBOX_CMD_HELP_TEXT("adapters use an MII to autonegotiate link speed and duplex setting.")
>  BAREBOX_CMD_HELP_TEXT("")
> +BAREBOX_CMD_HELP_TEXT("When run without options, shows status of all PHYs.")
> +BAREBOX_CMD_HELP_TEXT("")
>  BAREBOX_CMD_HELP_TEXT("Options:")
>  BAREBOX_CMD_HELP_OPT("-v", "increase verbosity")
> -BAREBOX_CMD_HELP_OPT("-s <devpath/devname>", "show PHY status (not providing PHY prints status of all)")
> +BAREBOX_CMD_HELP_OPT("-s <devpath/devname>", "show PHY status for specified device")
>  BAREBOX_CMD_HELP_OPT("-r <busno>:<adr>", "register a PHY")
>  BAREBOX_CMD_HELP_END
>  
> 
> 

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] of: base: fix of_match_node function documentation
  2025-07-11 12:27 ` [PATCH 3/3] of: base: fix of_match_node function documentation Bo Sun
@ 2025-07-11 12:55   ` Ahmad Fatoum
  0 siblings, 0 replies; 7+ messages in thread
From: Ahmad Fatoum @ 2025-07-11 12:55 UTC (permalink / raw)
  To: Bo Sun, barebox

On 7/11/25 14:27, Bo Sun wrote:
> Fix grammar error, correct structure name, and add missing return
> value description.
> 
> Signed-off-by: Bo Sun <bo@mboxify.com>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

Thanks,
Ahmad

> ---
>  drivers/of/base.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 1439e55a0a..903adb3670 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -778,11 +778,13 @@ struct device_node *of_find_node_with_property(struct device_node *from,
>  EXPORT_SYMBOL(of_find_node_with_property);
>  
>  /**
> - * of_match_node - Tell if an device_node has a matching of_match structure
> + * of_match_node - Tell if a device_node has a matching of_device_id structure
>   *      @matches:       array of of device match structures to search in
>   *      @node:          the of device structure to match against
>   *
>   *      Low level utility function used by device matching.
> + *
> + *      Return: pointer to the best matching of_device_id structure, or NULL
>   */
>  const struct of_device_id *of_match_node(const struct of_device_id *matches,
>  					 const struct device_node *node)
> 
> 

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] driver: clean up comment formatting and spacing
  2025-07-11 12:39 ` [PATCH 1/3] driver: clean up comment formatting and spacing Ahmad Fatoum
@ 2025-07-11 13:43   ` Bo Sun
  0 siblings, 0 replies; 7+ messages in thread
From: Bo Sun @ 2025-07-11 13:43 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On 2025-07-11 20:39, Ahmad Fatoum wrote:
> Hello Bo,
> 
> On 7/11/25 14:27, Bo Sun wrote:
>> - Fixed a missing closing parenthesis in the comment for 
>> DEVICE_ID_SINGLE
>> - Cleaned up indentation and alignment of multi-line comments in 
>> struct device
>> - Removed redundant spaces in function pointer declarations
>> 
>> No functional changes.
>> 
>> Signed-off-by: Bo Sun <bo@mboxify.com>
> 
> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> 
>> ---
>>  include/device.h | 18 ++++++++++--------
>>  include/driver.h |  8 ++++----
>>  2 files changed, 14 insertions(+), 12 deletions(-)
>> 
>> diff --git a/include/device.h b/include/device.h
>> index bc3a348e2e..97fa040365 100644
>> --- a/include/device.h
>> +++ b/include/device.h
>> @@ -37,7 +37,7 @@ struct device {
>>  	/*! This member is used to store device's unique name as
>>  	 *  obtained by calling dev_id(). Internal field, do not
>>  	 *  access it directly.
>> -	  */
>> +	 */
> 
> Would you like to use the occasion to switch this over to kerneldoc
> style? Kerneldoc is much more common in newer barebox code and would
> allow us using the same infrastructure in future.

Sure, will do.

Thanks,
Bo

> 
> Cheers,
> Ahmad
> 
>>  	char *unique_name;
>>  	/*! The id is used to uniquely identify a device in the system. The 
>> id
>>  	 * will show up under /dev/ as the device's name. Usually this is
>> @@ -58,14 +58,16 @@ struct device {
>>  		void *priv;
>>  		void *driver_data;
>>  	};
>> -	void *type_data;     /*! In case this device is a specific device, 
>> this pointer
>> -			      * points to the type specific device, i.e. eth_device
>> -			      */
>> +	/*! In case this device is a specific device, this pointer
>> +	 * points to the type specific device, i.e. eth_device
>> +	 */
>> +	void *type_data;
>> +
>>  	struct driver *driver; /*! The driver for this device */
>> 
>>  	struct list_head list;     /* The list of all devices */
>> -	struct list_head bus_list; /* our bus            */
>> -	struct list_head children; /* our children            */
>> +	struct list_head bus_list; /* our bus */
>> +	struct list_head children; /* our children */
>>  	struct list_head sibling;
>>  	struct list_head active;   /* The list of all devices which have a 
>> driver */
>> 
>> @@ -102,8 +104,8 @@ struct device {
>>  	 * For devices which take longer to probe this is called
>>  	 * when the driver should actually detect client devices
>>  	 */
>> -	int     (*detect) (struct device *);
>> -	void	(*rescan) (struct device *);
>> +	int (*detect)(struct device *);
>> +	void (*rescan)(struct device *);
>> 
>>  	/*
>>  	 * if a driver probe is deferred, this stores the last error
>> diff --git a/include/driver.h b/include/driver.h
>> index dd50a7aa3c..510a32186d 100644
>> --- a/include/driver.h
>> +++ b/include/driver.h
>> @@ -36,13 +36,13 @@ struct driver {
>>  	const char *name;
>> 
>>  	struct list_head list;
>> -	struct list_head bus_list; /* our bus            */
>> +	struct list_head bus_list; /* our bus */
>> 
>>  	/*! Called if an instance of a device is found */
>> -	int     (*probe) (struct device *);
>> +	int (*probe)(struct device *);
>> 
>>  	/*! Called if an instance of a device is gone. */
>> -	void     (*remove)(struct device *);
>> +	void (*remove)(struct device *);
>> 
>>  	struct bus_type *bus;
>> 
>> @@ -61,7 +61,7 @@ struct driver {
>> 
>>  /* dynamically assign the next free id */
>>  #define DEVICE_ID_DYNAMIC	-2
>> -/* do not use an id (only one device available */
>> +/* do not use an id (only one device available) */
>>  #define DEVICE_ID_SINGLE	-1
>> 
>>  /* Register devices and drivers.
>> 
>> 



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-07-11 13:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-11 12:27 [PATCH 1/3] driver: clean up comment formatting and spacing Bo Sun
2025-07-11 12:27 ` [PATCH 2/3] miitool: clarify help text for default behavior and -s option Bo Sun
2025-07-11 12:53   ` Ahmad Fatoum
2025-07-11 12:27 ` [PATCH 3/3] of: base: fix of_match_node function documentation Bo Sun
2025-07-11 12:55   ` Ahmad Fatoum
2025-07-11 12:39 ` [PATCH 1/3] driver: clean up comment formatting and spacing Ahmad Fatoum
2025-07-11 13:43   ` Bo Sun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox