* [PATCH 1/3] amba: Cleanup amba pclk operation
2021-12-10 8:31 [PATCH 0/3] amba: cleanup part2 Kefeng Wang
@ 2021-12-10 8:31 ` Kefeng Wang
2021-12-13 5:37 ` Vinod Koul
2021-12-10 8:31 ` [PATCH 2/3] amba: kill amba_find_match() Kefeng Wang
2021-12-10 8:31 ` [PATCH 3/3] amba: Move EXPORT_SYMBOL() closer to definition Kefeng Wang
2 siblings, 1 reply; 5+ messages in thread
From: Kefeng Wang @ 2021-12-10 8:31 UTC (permalink / raw)
To: Russell King, Vinod Koul, linux-kernel, linux-arm-kernel
Cc: Rob Herring, Kefeng Wang
There is no user about amba_pclk_[un]prepare() besides pl330.c,
directly use clk_[un]prepare(). After this, all the function about
amba pclk operation, enable, disable, [un]prepare could be killed.
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
drivers/dma/pl330.c | 4 ++--
include/linux/amba/bus.h | 20 --------------------
2 files changed, 2 insertions(+), 22 deletions(-)
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 110de8a60058..858400e42ec0 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -2968,7 +2968,7 @@ static int __maybe_unused pl330_suspend(struct device *dev)
struct amba_device *pcdev = to_amba_device(dev);
pm_runtime_force_suspend(dev);
- amba_pclk_unprepare(pcdev);
+ clk_unprepare(pcdev->pclk);
return 0;
}
@@ -2978,7 +2978,7 @@ static int __maybe_unused pl330_resume(struct device *dev)
struct amba_device *pcdev = to_amba_device(dev);
int ret;
- ret = amba_pclk_prepare(pcdev);
+ ret = clk_prepare(pcdev->pclk);
if (ret)
return ret;
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index edfcf7a14dcd..609ee31760ed 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -127,26 +127,6 @@ struct amba_device *amba_find_device(const char *, struct device *, unsigned int
int amba_request_regions(struct amba_device *, const char *);
void amba_release_regions(struct amba_device *);
-static inline int amba_pclk_enable(struct amba_device *dev)
-{
- return clk_enable(dev->pclk);
-}
-
-static inline void amba_pclk_disable(struct amba_device *dev)
-{
- clk_disable(dev->pclk);
-}
-
-static inline int amba_pclk_prepare(struct amba_device *dev)
-{
- return clk_prepare(dev->pclk);
-}
-
-static inline void amba_pclk_unprepare(struct amba_device *dev)
-{
- clk_unprepare(dev->pclk);
-}
-
/* Some drivers don't use the struct amba_device */
#define AMBA_CONFIG_BITS(a) (((a) >> 24) & 0xff)
#define AMBA_REV_BITS(a) (((a) >> 20) & 0x0f)
--
2.26.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/3] amba: Cleanup amba pclk operation
2021-12-10 8:31 ` [PATCH 1/3] amba: Cleanup amba pclk operation Kefeng Wang
@ 2021-12-13 5:37 ` Vinod Koul
0 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2021-12-13 5:37 UTC (permalink / raw)
To: Kefeng Wang; +Cc: Russell King, linux-kernel, linux-arm-kernel, Rob Herring
On 10-12-21, 16:31, Kefeng Wang wrote:
> There is no user about amba_pclk_[un]prepare() besides pl330.c,
> directly use clk_[un]prepare(). After this, all the function about
> amba pclk operation, enable, disable, [un]prepare could be killed.
Acked-By: Vinod Koul <vkoul@kernel.org>
--
~Vinod
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/3] amba: kill amba_find_match()
2021-12-10 8:31 [PATCH 0/3] amba: cleanup part2 Kefeng Wang
2021-12-10 8:31 ` [PATCH 1/3] amba: Cleanup amba pclk operation Kefeng Wang
@ 2021-12-10 8:31 ` Kefeng Wang
2021-12-10 8:31 ` [PATCH 3/3] amba: Move EXPORT_SYMBOL() closer to definition Kefeng Wang
2 siblings, 0 replies; 5+ messages in thread
From: Kefeng Wang @ 2021-12-10 8:31 UTC (permalink / raw)
To: Russell King, Vinod Koul, linux-kernel, linux-arm-kernel
Cc: Rob Herring, Kefeng Wang
There is no one use amba_find_match(), kill it.
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
drivers/amba/bus.c | 61 ----------------------------------------
include/linux/amba/bus.h | 1 -
2 files changed, 62 deletions(-)
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index e1a5eca3ae3c..dd0ef65e5c3a 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -669,66 +669,6 @@ void amba_device_unregister(struct amba_device *dev)
device_unregister(&dev->dev);
}
-
-struct find_data {
- struct amba_device *dev;
- struct device *parent;
- const char *busid;
- unsigned int id;
- unsigned int mask;
-};
-
-static int amba_find_match(struct device *dev, void *data)
-{
- struct find_data *d = data;
- struct amba_device *pcdev = to_amba_device(dev);
- int r;
-
- r = (pcdev->periphid & d->mask) == d->id;
- if (d->parent)
- r &= d->parent == dev->parent;
- if (d->busid)
- r &= strcmp(dev_name(dev), d->busid) == 0;
-
- if (r) {
- get_device(dev);
- d->dev = pcdev;
- }
-
- return r;
-}
-
-/**
- * amba_find_device - locate an AMBA device given a bus id
- * @busid: bus id for device (or NULL)
- * @parent: parent device (or NULL)
- * @id: peripheral ID (or 0)
- * @mask: peripheral ID mask (or 0)
- *
- * Return the AMBA device corresponding to the supplied parameters.
- * If no device matches, returns NULL.
- *
- * NOTE: When a valid device is found, its refcount is
- * incremented, and must be decremented before the returned
- * reference.
- */
-struct amba_device *
-amba_find_device(const char *busid, struct device *parent, unsigned int id,
- unsigned int mask)
-{
- struct find_data data;
-
- data.dev = NULL;
- data.parent = parent;
- data.busid = busid;
- data.id = id;
- data.mask = mask;
-
- bus_for_each_dev(&amba_bustype, NULL, &data, amba_find_match);
-
- return data.dev;
-}
-
/**
* amba_request_regions - request all mem regions associated with device
* @dev: amba_device structure for device
@@ -768,6 +708,5 @@ EXPORT_SYMBOL(amba_driver_register);
EXPORT_SYMBOL(amba_driver_unregister);
EXPORT_SYMBOL(amba_device_register);
EXPORT_SYMBOL(amba_device_unregister);
-EXPORT_SYMBOL(amba_find_device);
EXPORT_SYMBOL(amba_request_regions);
EXPORT_SYMBOL(amba_release_regions);
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index 609ee31760ed..7f5e8be62487 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -123,7 +123,6 @@ void amba_device_put(struct amba_device *);
int amba_device_add(struct amba_device *, struct resource *);
int amba_device_register(struct amba_device *, struct resource *);
void amba_device_unregister(struct amba_device *);
-struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int);
int amba_request_regions(struct amba_device *, const char *);
void amba_release_regions(struct amba_device *);
--
2.26.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/3] amba: Move EXPORT_SYMBOL() closer to definition
2021-12-10 8:31 [PATCH 0/3] amba: cleanup part2 Kefeng Wang
2021-12-10 8:31 ` [PATCH 1/3] amba: Cleanup amba pclk operation Kefeng Wang
2021-12-10 8:31 ` [PATCH 2/3] amba: kill amba_find_match() Kefeng Wang
@ 2021-12-10 8:31 ` Kefeng Wang
2 siblings, 0 replies; 5+ messages in thread
From: Kefeng Wang @ 2021-12-10 8:31 UTC (permalink / raw)
To: Russell King, Vinod Koul, linux-kernel, linux-arm-kernel
Cc: Rob Herring, Kefeng Wang
Some EXPORT_SYMBOL() is at the end of the function, but some is
at the end of file. For reader sanity and be consistent, move all
EXPORT_SYMBOL() declarations just after the end of the function.
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
drivers/amba/bus.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index dd0ef65e5c3a..d3bd14aaabf6 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -370,6 +370,7 @@ int amba_driver_register(struct amba_driver *drv)
return driver_register(&drv->drv);
}
+EXPORT_SYMBOL(amba_driver_register);
/**
* amba_driver_unregister - remove an AMBA device driver
@@ -383,7 +384,7 @@ void amba_driver_unregister(struct amba_driver *drv)
{
driver_unregister(&drv->drv);
}
-
+EXPORT_SYMBOL(amba_driver_unregister);
static void amba_device_release(struct device *dev)
{
@@ -642,6 +643,7 @@ int amba_device_register(struct amba_device *dev, struct resource *parent)
return amba_device_add(dev, parent);
}
+EXPORT_SYMBOL(amba_device_register);
/**
* amba_device_put - put an AMBA device
@@ -668,6 +670,7 @@ void amba_device_unregister(struct amba_device *dev)
{
device_unregister(&dev->dev);
}
+EXPORT_SYMBOL(amba_device_unregister);
/**
* amba_request_regions - request all mem regions associated with device
@@ -689,6 +692,7 @@ int amba_request_regions(struct amba_device *dev, const char *name)
return ret;
}
+EXPORT_SYMBOL(amba_request_regions);
/**
* amba_release_regions - release mem regions associated with device
@@ -703,10 +707,4 @@ void amba_release_regions(struct amba_device *dev)
size = resource_size(&dev->res);
release_mem_region(dev->res.start, size);
}
-
-EXPORT_SYMBOL(amba_driver_register);
-EXPORT_SYMBOL(amba_driver_unregister);
-EXPORT_SYMBOL(amba_device_register);
-EXPORT_SYMBOL(amba_device_unregister);
-EXPORT_SYMBOL(amba_request_regions);
EXPORT_SYMBOL(amba_release_regions);
--
2.26.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 5+ messages in thread