clean up hisi_lpc and lib/logic_pio
Subsystems (2)
v3 cover clean up hisi_lpc and lib/logic_pio
1.clean up included headers
2.add and clean up comment in logic_lib
Pei Xiao (2):
bus: hisi_lpc: clean up included headers lib/logic_pio: add and clean up comment in logic_lib
drivers/bus/hisi_lpc.c | 13 +++++++++---- lib/logic_pio.c | 37 ++++++++++++++++++++++++++++--------- 2 files changed, 37 insertions(+), 13 deletions(-)
Signature · 1 line
2.25.1
PATCH v3 1/2 bus: hisi_lpc: clean up included headers
Revise header inclusions to improve code organization and build hygiene:
1. Remove unnecessary headers:
- console.h (no console related functions)
- of.h (OF specific code handled by of_platform.h)
- pci.h (no PCI dependencies)
- slab.h (no memory allocation helpers used)
2. Add required headers:
- bits.h for bit manipulation macros
- err.h for error handling helpers
- ioport.h for I/O resource management
- property.h for device property interfaces
- spinlock.h for locking primitives
- types.h for explicit type definitions
- asm/byteorder.h for endianness handling
---
changes in v3: according to Andy Shevchenko's suggestion. changes in v2: fix build error
--- drivers/bus/hisi_lpc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/bus/hisi_lpc.c +9 -4
@@ -7,17 +7,22 @@*/ #include <linux/acpi.h> -#include <linux/console.h> +#include <linux/bits.h> #include <linux/delay.h> +#include <linux/err.h> #include <linux/io.h> +#include <linux/ioport.h> #include <linux/logic_pio.h> +#include <linux/mod_devicetable.h> #include <linux/module.h> -#include <linux/of.h> #include <linux/of_platform.h> -#include <linux/pci.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/serial_8250.h> -#include <linux/slab.h> +#include <linux/spinlock.h> +#include <linux/types.h> + +#include <asm/byteorder.h> #define DRV_NAME "hisi-lpc"
Signature · 1 line
2.25.1
PATCH v3 2/2 lib/logic_pio: add and clean up comment in logic_lib
In reply to Pei Xiao1.Add comments that we were previously overlooked for find_io_range() and logic_pio_trans_cpuaddr().
2.clean up other comment according to kernel-doc
---
changes in v3: add Return section add cleanup
changes in v2: Returns to Return
--- lib/logic_pio.c | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-)
lib/logic_pio.c +28 -9
@@ -24,11 +24,12 @@ static DEFINE_MUTEX(io_range_mutex);* logic_pio_register_range - register logical PIO range for a host * @new_range: pointer to the IO range to be registered. * -* Returns 0 on success, the error code in case of failure. +* Register a new IO range node in the IO range list. +* +* Return: 0 on success, the error code in case of failure. * If the range already exists, -EEXIST will be returned, which should be * considered a success. * -* Register a new IO range node in the IO range list. */ int logic_pio_register_range (struct logic_pio_hwaddr *new_range) {
@@ -118,9 +119,9 @@ void logic_pio_unregister_range(struct logic_pio_hwaddr *range)* find_io_range_by_fwnode - find logical PIO range for given FW node * @fwnode: FW node handle associated with logical PIO range * -* Returns pointer to node on success, NULL otherwise. -* * Traverse the io_range_list to find the registered node for @fwnode. +* +* Return: pointer to node on success, NULL otherwise. */ struct logic_pio_hwaddr *find_io_range_by_fwnode (const struct fwnode_handle *fwnode) {
@@ -138,7 +139,15 @@ struct logic_pio_hwaddr *find_io_range_by_fwnode(const struct fwnode_handle *fwnreturn found_range; } -/* Return a registered range given an input PIO token */ +/** +* find_io_range - find a registered range by PIO +* @pio: logical PIO value +* +* Traverse the io_range_list to find the registered node for @pio. +* The input PIO should be unique in the whole logical PIO space. +* +* Return: a registered range, NULL otherwise. +*/ static struct logic_pio_hwaddr *find_io_range (unsigned long pio) {struct logic_pio_hwaddr *range, *found_range =NULL ;
@@ -162,10 +171,10 @@ static struct logic_pio_hwaddr *find_io_range(unsigned long pio)* logic_pio_to_hwaddr - translate logical PIO to HW address * @pio: logical PIO value * -* Returns HW address if valid, ~0 otherwise. -* * Translate the input logical PIO to the corresponding hardware address. * The input PIO should be unique in the whole logical PIO space. +* +* Return: HW address if valid, ~0 otherwise. */ resource_size_t logic_pio_to_hwaddr (unsigned long pio) {
@@ -179,12 +188,14 @@ resource_size_t logic_pio_to_hwaddr(unsigned long pio) }/** -* logic_pio_trans_hwaddr - translate HW address to logical PIO +* logic_pio_trans_hwaddr - translate HW address to logical PIO by fwnode * @fwnode: FW node reference for the host * @addr: Host-relative HW address * @size: size to translate * -* Returns Logical PIO value if successful, ~0UL otherwise +* Translate HW address by fwnode to logical PIO +* +* Return: Logical PIO value if successful, ~0UL otherwise */ unsigned long logic_pio_trans_hwaddr (const struct fwnode_handle *fwnode,resource_size_t addr,resource_size_t size)
@@ -204,6 +215,14 @@ unsigned long logic_pio_trans_hwaddr(const struct fwnode_handle *fwnode,return addr - range->hw_start + range->io_start; } +/** +* logic_pio_trans_cpuaddr - translate CPU address to logical PIO +* @addr: Host-relative CPU address +* +* translate CPU address to logical PIO +* +* Return: Logical PIO value if successful, ~0UL otherwise +*/ unsigned long logic_pio_trans_cpuaddr (resource_size_t addr) {struct logic_pio_hwaddr *range;
Signature · 1 line
2.25.1
Quoted 2 lines · Pei Xiao
1.clean up included headers
2.add and clean up comment inlogic_lib
LGTM,
Signature · 2 lines
With Best Regards, Andy Shevchenko