* [PATCH 1/6] usb: musb: jz4740: Suppress useless field in priv structure
@ 2019-12-14 22:11 Paul Cercueil
2019-12-14 22:11 ` [PATCH 2/6] usb: musb: jz4740: Add local dev variable to clean up probe Paul Cercueil
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Paul Cercueil @ 2019-12-14 22:11 UTC (permalink / raw)
To: Bin Liu, Greg Kroah-Hartman; +Cc: od, linux-usb, linux-kernel, Paul Cercueil
The 'dev' field was never read anywhere.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
drivers/usb/musb/jz4740.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c
index 5e885fa26829..16d4120ba145 100644
--- a/drivers/usb/musb/jz4740.c
+++ b/drivers/usb/musb/jz4740.c
@@ -17,7 +17,6 @@
#include "musb_core.h"
struct jz4740_glue {
- struct device *dev;
struct platform_device *musb;
struct clk *clk;
};
@@ -150,7 +149,6 @@ static int jz4740_probe(struct platform_device *pdev)
musb->dev.dma_mask = &musb->dev.coherent_dma_mask;
musb->dev.coherent_dma_mask = DMA_BIT_MASK(32);
- glue->dev = &pdev->dev;
glue->musb = musb;
glue->clk = clk;
--
2.24.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/6] usb: musb: jz4740: Add local dev variable to clean up probe
2019-12-14 22:11 [PATCH 1/6] usb: musb: jz4740: Suppress useless field in priv structure Paul Cercueil
@ 2019-12-14 22:11 ` Paul Cercueil
2019-12-14 22:11 ` [PATCH 3/6] usb: musb: jz4740: Constify jz4740_musb_pdata struct Paul Cercueil
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Paul Cercueil @ 2019-12-14 22:11 UTC (permalink / raw)
To: Bin Liu, Greg Kroah-Hartman; +Cc: od, linux-usb, linux-kernel, Paul Cercueil
Clean up the probe function by using a local 'struct device *dev'
variable, instead of referencing &pdev->dev everytime.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
drivers/usb/musb/jz4740.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c
index 16d4120ba145..b31b028e5ee7 100644
--- a/drivers/usb/musb/jz4740.c
+++ b/drivers/usb/musb/jz4740.c
@@ -116,36 +116,37 @@ static const struct musb_platform_ops jz4740_musb_ops = {
static int jz4740_probe(struct platform_device *pdev)
{
+ struct device *dev = &pdev->dev;
struct musb_hdrc_platform_data *pdata = &jz4740_musb_platform_data;
struct platform_device *musb;
struct jz4740_glue *glue;
struct clk *clk;
int ret;
- glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL);
+ glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL);
if (!glue)
return -ENOMEM;
musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
if (!musb) {
- dev_err(&pdev->dev, "failed to allocate musb device\n");
+ dev_err(dev, "failed to allocate musb device");
return -ENOMEM;
}
- clk = devm_clk_get(&pdev->dev, "udc");
+ clk = devm_clk_get(dev, "udc");
if (IS_ERR(clk)) {
- dev_err(&pdev->dev, "failed to get clock\n");
+ dev_err(dev, "failed to get clock");
ret = PTR_ERR(clk);
goto err_platform_device_put;
}
ret = clk_prepare_enable(clk);
if (ret) {
- dev_err(&pdev->dev, "failed to enable clock\n");
+ dev_err(dev, "failed to enable clock");
goto err_platform_device_put;
}
- musb->dev.parent = &pdev->dev;
+ musb->dev.parent = dev;
musb->dev.dma_mask = &musb->dev.coherent_dma_mask;
musb->dev.coherent_dma_mask = DMA_BIT_MASK(32);
@@ -159,19 +160,19 @@ static int jz4740_probe(struct platform_device *pdev)
ret = platform_device_add_resources(musb, pdev->resource,
pdev->num_resources);
if (ret) {
- dev_err(&pdev->dev, "failed to add resources\n");
+ dev_err(dev, "failed to add resources");
goto err_clk_disable;
}
ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
if (ret) {
- dev_err(&pdev->dev, "failed to add platform_data\n");
+ dev_err(dev, "failed to add platform_data");
goto err_clk_disable;
}
ret = platform_device_add(musb);
if (ret) {
- dev_err(&pdev->dev, "failed to register musb device\n");
+ dev_err(dev, "failed to register musb device");
goto err_clk_disable;
}
--
2.24.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/6] usb: musb: jz4740: Constify jz4740_musb_pdata struct
2019-12-14 22:11 [PATCH 1/6] usb: musb: jz4740: Suppress useless field in priv structure Paul Cercueil
2019-12-14 22:11 ` [PATCH 2/6] usb: musb: jz4740: Add local dev variable to clean up probe Paul Cercueil
@ 2019-12-14 22:11 ` Paul Cercueil
2019-12-14 22:11 ` [PATCH 4/6] usb: musb: jz4740: Rename platform_device field in priv struct Paul Cercueil
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Paul Cercueil @ 2019-12-14 22:11 UTC (permalink / raw)
To: Bin Liu, Greg Kroah-Hartman; +Cc: od, linux-usb, linux-kernel, Paul Cercueil
By moving around the jz4740_musb_pdata structure, we can have the
.platform_ops field initialized, so that we don't have to initialize it
manually in the probe function. Therefore, the struct can be const now.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
drivers/usb/musb/jz4740.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c
index b31b028e5ee7..3410e6b01bac 100644
--- a/drivers/usb/musb/jz4740.c
+++ b/drivers/usb/musb/jz4740.c
@@ -72,11 +72,6 @@ static const struct musb_hdrc_config jz4740_musb_config = {
.fifo_cfg_size = ARRAY_SIZE(jz4740_musb_fifo_cfg),
};
-static struct musb_hdrc_platform_data jz4740_musb_platform_data = {
- .mode = MUSB_PERIPHERAL,
- .config = &jz4740_musb_config,
-};
-
static int jz4740_musb_init(struct musb *musb)
{
struct device *dev = musb->controller->parent;
@@ -114,10 +109,16 @@ static const struct musb_platform_ops jz4740_musb_ops = {
#endif
};
+static const struct musb_hdrc_platform_data jz4740_musb_pdata = {
+ .mode = MUSB_PERIPHERAL,
+ .config = &jz4740_musb_config,
+ .platform_ops = &jz4740_musb_ops,
+};
+
static int jz4740_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
- struct musb_hdrc_platform_data *pdata = &jz4740_musb_platform_data;
+ const struct musb_hdrc_platform_data *pdata = &jz4740_musb_pdata;
struct platform_device *musb;
struct jz4740_glue *glue;
struct clk *clk;
@@ -153,8 +154,6 @@ static int jz4740_probe(struct platform_device *pdev)
glue->musb = musb;
glue->clk = clk;
- pdata->platform_ops = &jz4740_musb_ops;
-
platform_set_drvdata(pdev, glue);
ret = platform_device_add_resources(musb, pdev->resource,
--
2.24.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/6] usb: musb: jz4740: Rename platform_device field in priv struct
2019-12-14 22:11 [PATCH 1/6] usb: musb: jz4740: Suppress useless field in priv structure Paul Cercueil
2019-12-14 22:11 ` [PATCH 2/6] usb: musb: jz4740: Add local dev variable to clean up probe Paul Cercueil
2019-12-14 22:11 ` [PATCH 3/6] usb: musb: jz4740: Constify jz4740_musb_pdata struct Paul Cercueil
@ 2019-12-14 22:11 ` Paul Cercueil
2019-12-14 22:11 ` [PATCH 5/6] usb: musb: jz4740: Comments fix Paul Cercueil
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Paul Cercueil @ 2019-12-14 22:11 UTC (permalink / raw)
To: Bin Liu, Greg Kroah-Hartman; +Cc: od, linux-usb, linux-kernel, Paul Cercueil
Name the platform_device pointer 'pdev' instead of 'musb'. Since the
driver also deal with pointers to 'struct musb', it can be very
confusing to have a pointer named after this struct but with a different
type.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
drivers/usb/musb/jz4740.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c
index 3410e6b01bac..e2baa1b6bad6 100644
--- a/drivers/usb/musb/jz4740.c
+++ b/drivers/usb/musb/jz4740.c
@@ -17,7 +17,7 @@
#include "musb_core.h"
struct jz4740_glue {
- struct platform_device *musb;
+ struct platform_device *pdev;
struct clk *clk;
};
@@ -151,7 +151,7 @@ static int jz4740_probe(struct platform_device *pdev)
musb->dev.dma_mask = &musb->dev.coherent_dma_mask;
musb->dev.coherent_dma_mask = DMA_BIT_MASK(32);
- glue->musb = musb;
+ glue->pdev = musb;
glue->clk = clk;
platform_set_drvdata(pdev, glue);
@@ -188,7 +188,7 @@ static int jz4740_remove(struct platform_device *pdev)
{
struct jz4740_glue *glue = platform_get_drvdata(pdev);
- platform_device_unregister(glue->musb);
+ platform_device_unregister(glue->pdev);
clk_disable_unprepare(glue->clk);
return 0;
--
2.24.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/6] usb: musb: jz4740: Comments fix
2019-12-14 22:11 [PATCH 1/6] usb: musb: jz4740: Suppress useless field in priv structure Paul Cercueil
` (2 preceding siblings ...)
2019-12-14 22:11 ` [PATCH 4/6] usb: musb: jz4740: Rename platform_device field in priv struct Paul Cercueil
@ 2019-12-14 22:11 ` Paul Cercueil
2019-12-14 22:11 ` [PATCH 6/6] usb: musb: jz4740: Whitespace and indentation fixes Paul Cercueil
2019-12-16 17:19 ` [PATCH 1/6] usb: musb: jz4740: Suppress useless field in priv structure Bin Liu
5 siblings, 0 replies; 7+ messages in thread
From: Paul Cercueil @ 2019-12-14 22:11 UTC (permalink / raw)
To: Bin Liu, Greg Kroah-Hartman; +Cc: od, linux-usb, linux-kernel, Paul Cercueil
Add a /* sentinel */ comment to the sentinel entry of the devicetree ID
table, and fix a multi-line comment not having its opening token on a
separate line.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
drivers/usb/musb/jz4740.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c
index e2baa1b6bad6..a8cd2ba2ed06 100644
--- a/drivers/usb/musb/jz4740.c
+++ b/drivers/usb/musb/jz4740.c
@@ -88,7 +88,8 @@ static int jz4740_musb_init(struct musb *musb)
return err;
}
- /* Silicon does not implement ConfigData register.
+ /*
+ * Silicon does not implement ConfigData register.
* Set dyn_fifo to avoid reading EP config from hardware.
*/
musb->dyn_fifo = true;
@@ -197,7 +198,7 @@ static int jz4740_remove(struct platform_device *pdev)
#ifdef CONFIG_OF
static const struct of_device_id jz4740_musb_of_match[] = {
{ .compatible = "ingenic,jz4740-musb" },
- {},
+ { /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, jz4740_musb_of_match);
#endif
--
2.24.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 6/6] usb: musb: jz4740: Whitespace and indentation fixes
2019-12-14 22:11 [PATCH 1/6] usb: musb: jz4740: Suppress useless field in priv structure Paul Cercueil
` (3 preceding siblings ...)
2019-12-14 22:11 ` [PATCH 5/6] usb: musb: jz4740: Comments fix Paul Cercueil
@ 2019-12-14 22:11 ` Paul Cercueil
2019-12-16 17:19 ` [PATCH 1/6] usb: musb: jz4740: Suppress useless field in priv structure Bin Liu
5 siblings, 0 replies; 7+ messages in thread
From: Paul Cercueil @ 2019-12-14 22:11 UTC (permalink / raw)
To: Bin Liu, Greg Kroah-Hartman; +Cc: od, linux-usb, linux-kernel, Paul Cercueil
Fix lines with too much or not enough indentation, and lines which were
indented with spaces instead of tabs.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
drivers/usb/musb/jz4740.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c
index a8cd2ba2ed06..f948eca654f3 100644
--- a/drivers/usb/musb/jz4740.c
+++ b/drivers/usb/musb/jz4740.c
@@ -23,9 +23,9 @@ struct jz4740_glue {
static irqreturn_t jz4740_musb_interrupt(int irq, void *__hci)
{
- unsigned long flags;
- irqreturn_t retval = IRQ_NONE, retval_dma = IRQ_NONE;
- struct musb *musb = __hci;
+ unsigned long flags;
+ irqreturn_t retval = IRQ_NONE, retval_dma = IRQ_NONE;
+ struct musb *musb = __hci;
spin_lock_irqsave(&musb->lock, flags);
@@ -42,7 +42,7 @@ static irqreturn_t jz4740_musb_interrupt(int irq, void *__hci)
* never see them set
*/
musb->int_usb &= MUSB_INTR_SUSPEND | MUSB_INTR_RESUME |
- MUSB_INTR_RESET | MUSB_INTR_SOF;
+ MUSB_INTR_RESET | MUSB_INTR_SOF;
if (musb->int_usb || musb->int_tx || musb->int_rx)
retval = musb_interrupt(musb);
@@ -56,20 +56,20 @@ static irqreturn_t jz4740_musb_interrupt(int irq, void *__hci)
}
static struct musb_fifo_cfg jz4740_musb_fifo_cfg[] = {
-{ .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, },
-{ .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, },
-{ .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 64, },
+ { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, },
+ { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, },
+ { .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 64, },
};
static const struct musb_hdrc_config jz4740_musb_config = {
/* Silicon does not implement USB OTG. */
- .multipoint = 0,
+ .multipoint = 0,
/* Max EPs scanned, driver will decide which EP can be used. */
- .num_eps = 4,
+ .num_eps = 4,
/* RAMbits needed to configure EPs from table */
- .ram_bits = 9,
- .fifo_cfg = jz4740_musb_fifo_cfg,
- .fifo_cfg_size = ARRAY_SIZE(jz4740_musb_fifo_cfg),
+ .ram_bits = 9,
+ .fifo_cfg = jz4740_musb_fifo_cfg,
+ .fifo_cfg_size = ARRAY_SIZE(jz4740_musb_fifo_cfg),
};
static int jz4740_musb_init(struct musb *musb)
@@ -122,7 +122,7 @@ static int jz4740_probe(struct platform_device *pdev)
const struct musb_hdrc_platform_data *pdata = &jz4740_musb_pdata;
struct platform_device *musb;
struct jz4740_glue *glue;
- struct clk *clk;
+ struct clk *clk;
int ret;
glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL);
@@ -187,7 +187,7 @@ static int jz4740_probe(struct platform_device *pdev)
static int jz4740_remove(struct platform_device *pdev)
{
- struct jz4740_glue *glue = platform_get_drvdata(pdev);
+ struct jz4740_glue *glue = platform_get_drvdata(pdev);
platform_device_unregister(glue->pdev);
clk_disable_unprepare(glue->clk);
--
2.24.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/6] usb: musb: jz4740: Suppress useless field in priv structure
2019-12-14 22:11 [PATCH 1/6] usb: musb: jz4740: Suppress useless field in priv structure Paul Cercueil
` (4 preceding siblings ...)
2019-12-14 22:11 ` [PATCH 6/6] usb: musb: jz4740: Whitespace and indentation fixes Paul Cercueil
@ 2019-12-16 17:19 ` Bin Liu
5 siblings, 0 replies; 7+ messages in thread
From: Bin Liu @ 2019-12-16 17:19 UTC (permalink / raw)
To: Paul Cercueil; +Cc: Greg Kroah-Hartman, od, linux-usb, linux-kernel
On Sat, Dec 14, 2019 at 11:11:21PM +0100, Paul Cercueil wrote:
> The 'dev' field was never read anywhere.
>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
The series is queued for -next. Thanks.
-Bin.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-12-16 17:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-14 22:11 [PATCH 1/6] usb: musb: jz4740: Suppress useless field in priv structure Paul Cercueil
2019-12-14 22:11 ` [PATCH 2/6] usb: musb: jz4740: Add local dev variable to clean up probe Paul Cercueil
2019-12-14 22:11 ` [PATCH 3/6] usb: musb: jz4740: Constify jz4740_musb_pdata struct Paul Cercueil
2019-12-14 22:11 ` [PATCH 4/6] usb: musb: jz4740: Rename platform_device field in priv struct Paul Cercueil
2019-12-14 22:11 ` [PATCH 5/6] usb: musb: jz4740: Comments fix Paul Cercueil
2019-12-14 22:11 ` [PATCH 6/6] usb: musb: jz4740: Whitespace and indentation fixes Paul Cercueil
2019-12-16 17:19 ` [PATCH 1/6] usb: musb: jz4740: Suppress useless field in priv structure Bin Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).