bus: hisi_lpc: remove unused head file in hisi_lpc.c
Subsystems (2)
PATCH v2 1/3 bus: hisi_lpc: remove unused head file in hisi_lpc.c
In reply to a message not in the archiveFrom: Pei Xiao <[email protected]>
linux/console.h,linux/pci.h,linux/slab.h
are not used, removes it.
---
changes in v2: fix build error in i386
--- drivers/bus/hisi_lpc.c | 3 --- 1 file changed, 3 deletions(-)
drivers/bus/hisi_lpc.c +0 -3
@@ -7,17 +7,14 @@*/ #include <linux/acpi.h> -#include <linux/console.h> #include <linux/delay.h> #include <linux/io.h> #include <linux/logic_pio.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/serial_8250.h> -#include <linux/slab.h> #define DRV_NAME "hisi-lpc"
Signature · 1 line
2.25.1
PATCH v2 3/3 lib: logic_pio: Add detailed comments for find_io_range() and logic_pio_trans_cpuaddr()
In reply to a message not in the archiveFrom: Pei Xiao <[email protected]>
Add comments that we were previously overlooked for find_io_range() and logic_pio_trans_cpuaddr().
---
changes in v2: fix returns differ
--- lib/logic_pio.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
lib/logic_pio.c +17 -1
@@ -141,7 +141,15 @@ struct logic_pio_hwaddr *find_io_range_by_fwnode(const struct fwnode_handle *fwn }EXPORT_SYMBOL (find_io_range_by_fwnode); -/* 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. +* +* Returns a registered range, NULL otherwise. +*/ static struct logic_pio_hwaddr *find_io_range (unsigned long pio) {struct logic_pio_hwaddr *range, *found_range =NULL ;
@@ -209,6 +217,14 @@ unsigned long logic_pio_trans_hwaddr(const struct fwnode_handle *fwnode, }EXPORT_SYMBOL (logic_pio_trans_hwaddr); +/** +* logic_pio_trans_cpuaddr - translate CPU address to logical PIO +* @addr: Host-relative CPU address +* +* translate CPU address to logical PIO +* +* Returns 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
PATCH 2/3 lib: logic_pio: export function symbol in logic_pio
In reply to a message not in the archiveFrom: Pei Xiao <[email protected]>
export some function via EXPORT_SYMBOL, convenient to use in kernel modules in the future if somebody went to use this lib. This is one reason for this library exists.
--- lib/logic_pio.c | 6 ++++++ 1 file changed, 6 insertions(+)
lib/logic_pio.c +6 -0
@@ -99,6 +99,7 @@ int logic_pio_register_range(struct logic_pio_hwaddr *new_range)mutex_unlock (&io_range_mutex);return ret; } +EXPORT_SYMBOL (logic_pio_register_range);/** * logic_pio_unregister_range - unregister a logical PIO range for a host
@@ -113,6 +114,7 @@ void logic_pio_unregister_range(struct logic_pio_hwaddr *range)mutex_unlock (&io_range_mutex);synchronize_rcu (); } +EXPORT_SYMBOL (logic_pio_unregister_range);/** * find_io_range_by_fwnode - find logical PIO range for given FW node
@@ -137,6 +139,7 @@ struct logic_pio_hwaddr *find_io_range_by_fwnode(const struct fwnode_handle *fwnreturn found_range; } +EXPORT_SYMBOL (find_io_range_by_fwnode);/* Return a registered range given an input PIO token */ static struct logic_pio_hwaddr *find_io_range (unsigned long pio)
@@ -177,6 +180,7 @@ resource_size_t logic_pio_to_hwaddr(unsigned long pio)return (resource_size_t )~0 ; } +EXPORT_SYMBOL (logic_pio_to_hwaddr);/** * logic_pio_trans_hwaddr - translate HW address to logical PIO
@@ -203,6 +207,7 @@ unsigned long logic_pio_trans_hwaddr(const struct fwnode_handle *fwnode, }return addr - range->hw_start + range->io_start; } +EXPORT_SYMBOL (logic_pio_trans_hwaddr);unsigned long logic_pio_trans_cpuaddr (resource_size_t addr) {
@@ -227,6 +232,7 @@ unsigned long logic_pio_trans_cpuaddr(resource_size_t addr)return ~0UL ; } +EXPORT_SYMBOL (logic_pio_trans_cpuaddr);#if defined(CONFIG_INDIRECT_PIO ) && defined(PCI_IOBASE )#define BUILD_LOGIC_IO (bwl, type) \
Signature · 1 line
2.25.1
Re: [PATCH 2/3 V1] lib: logic_pio: export function symbol in logic_pio
Quoted 3 lines · On Tue, Apr 22, 2025 at 07:31:59PM +0800, [email protected] wrote:
From: Pei Xiao <[email protected]>
export some function via
EXPORT_SYMBOL, convenient to use in
Export
Quoted 2 lines
kernel modules in the future if somebody went to use this lib. This is one reason for this library exists.
Can we use namespace from day 1, please?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 2/3 V1] lib: logic_pio: export function symbol in logic_pio
In reply to [email protected]Quoted 5 lines · On Tue, Apr 22, 2025 at 07:31:59PM +0800, [email protected] wrote:
From: Pei Xiao <[email protected]>
export some function via
EXPORT_SYMBOL, convenient to use in kernel modules in the future if somebody went to use this lib. This is one reason for this library exists.
Btw, why V1?!
Really, stop sending new patches until you assure that the format is correct.
With standard tools this can be simply achieved by running:
git format-patch --cover-letter -v3 --thread ...
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 4 lines · On Tue, Apr 22, 2025 at 07:31:22PM +0800, [email protected] wrote:
From: Pei Xiao <[email protected]>
linux/console.h,linux/pci.h,linux/slab.h
are not used, removes it.
There are more unused and many are missed.
My diff looks like this:
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"
...
Quoted 12 lines
#include <
linux/acpi.h>(quoted diff) +0
-3-#include <linux/console.h> #include <linux/delay.h> #include <linux/io.h> #include <linux/logic_pio.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/serial_8250.h> -#include <linux/slab.h>
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 3/3 V2] lib: logic_pio: Add detailed comments for find_io_range() and logic_pio_trans_cpuaddr()
In reply to [email protected]Quoted 4 lines · On Tue, Apr 22, 2025 at 07:32:19PM +0800, [email protected] wrote:
From: Pei Xiao <[email protected]>
Add comments that we were previously overlooked for
find_io_range()andlogic_pio_trans_cpuaddr().
You effectively ignored part of my comment. Please, run kernel-doc validator and see the result. There are missing "Return:" sections. That's what it will tell you.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 2/3 V1] lib: logic_pio: export function symbol in logic_pio
In reply to [email protected]Quoted 7 lines · On 22/04/2025 12:31, [email protected] wrote:
From: Pei Xiao<[email protected]>
export some function via
EXPORT_SYMBOL, convenient to use in kernel modules in the future if somebody went to use this lib. This is one reason for this library exists.Signed-off-by Pei Xiao<[email protected]>
No, we don't export just because someone might need this is future.
And, FWIW, EXPORT_SYMBOL_GPL is preferred.
Quoted 26 lines · Andy Shevchenko
Quoted 4 lines · On Tue, Apr 22, 2025 at 07:31:22PM +0800, [email protected] wrote:
From: Pei Xiao <[email protected]>
linux/console.h,linux/pci.h,linux/slab.h
are not used, removes it.There are more unused and many are missed.
My diff looks like this:drivers/bus/hisi_lpc.c +4
-2@@ -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>
drivers/bus/hisi_lpc.c line 25
Quoted 10 lines
drivers/bus/hisi_lpc.c +5
-2#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>
Thanks for you help.
I have send v3 : https://lore.kernel.org/lkml/[email protected]/
You are such a helpful and technically skilled expert!
Thanks again!
Pei.
Quoted 18 lines
drivers/bus/hisi_lpc.c +0
-0#define DRV_NAME "hisi-lpc"Quoted 13 lines
#include <
linux/acpi.h>drivers/bus/hisi_lpc.c +0
-3-#include <linux/console.h> #include <linux/delay.h> #include <linux/io.h> #include <linux/logic_pio.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/serial_8250.h> -#include <linux/slab.h>
Re: [PATCH 2/3 V1] lib: logic_pio: export function symbol in logic_pio
In reply to John GarryQuoted 11 lines · John Garry
Quoted 7 lines · On 22/04/2025 12:31, [email protected] wrote:
From: Pei Xiao<[email protected]>
export some function via
EXPORT_SYMBOL, convenient to use in kernel modules in the future if somebody went to use this lib. This is one reason for this library exists.Signed-off-by Pei Xiao<[email protected]>No, we don't export just because someone might need this is future.
Now modify it,Might it be convenient for future people?
People in the future might be able to save some effort here.
Quoted 1 line
And, FWIW,
EXPORT_SYMBOL_GPLis preferred.
Re: [PATCH 2/3 V1] lib: logic_pio: export function symbol in logic_pio
Quoted 9 lines · Pei Xiao
Quoted 7 lines · John Garry
Quoted 6 lines · On 22/04/2025 12:31, [email protected] wrote:
From: Pei Xiao<[email protected]>
export some function via
EXPORT_SYMBOL, convenient to use in kernel modules in the future if somebody went to use this lib. This is one reason for this library exists.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Pei Xiao<[email protected]>No, we don't export just because someone might need this is future.
Now modify it,Might it be convenient for future people?
People in the future might be able to save some effort here.
No, absolutely not. The reason we don't is because it enables more out-of-tree rubbish.
Quoted 2 lines
Quoted 2 lines
And, FWIW,
EXPORT_SYMBOL_GPLis preferred.