[PATCH] arch: sh: drivers: dma: dma-api.c: Changed preferred function strscpy over strlcpy issue arch: sh: drivers: dma: dma-sysfs.c: Changed preferred function simple_strtoul over kstrtout issue arch: sh: drivers: dma: dmabrg.c: Fixed pointer declaration code issue arch: sh: drivers: heartbeat.c: Fixed preferred unsigned int over unsigned issue

From: Siddhartha Das
Date: Fri Sep 10 2021 - 13:18:01 EST


Fixed Code style issues and prefer cases

Signed-off-by: Siddhartha Das <siddhartha.das.min19@xxxxxxxxxxx>
---
arch/sh/drivers/dma/dma-api.c | 2 +-
arch/sh/drivers/dma/dma-sysfs.c | 2 +-
arch/sh/drivers/dma/dmabrg.c | 2 +-
arch/sh/drivers/heartbeat.c | 4 ++--
4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c
index ab9170494dcc..89cd4a3b4cca 100644
--- a/arch/sh/drivers/dma/dma-api.c
+++ b/arch/sh/drivers/dma/dma-api.c
@@ -198,7 +198,7 @@ int request_dma(unsigned int chan, const char *dev_id)
if (atomic_xchg(&channel->busy, 1))
return -EBUSY;

- strlcpy(channel->dev_id, dev_id, sizeof(channel->dev_id));
+ strscpy(channel->dev_id, dev_id, sizeof(channel->dev_id));

if (info->ops->request) {
result = info->ops->request(channel);
diff --git a/arch/sh/drivers/dma/dma-sysfs.c b/arch/sh/drivers/dma/dma-sysfs.c
index 8ef318150f84..6d20f2ed3b7a 100644
--- a/arch/sh/drivers/dma/dma-sysfs.c
+++ b/arch/sh/drivers/dma/dma-sysfs.c
@@ -80,7 +80,7 @@ static ssize_t dma_store_config(struct device *dev,
struct dma_channel *channel = to_dma_channel(dev);
unsigned long config;

- config = simple_strtoul(buf, NULL, 0);
+ config = kstrtoul(buf, NULL, 0);
dma_configure_channel(channel->vchan, config);

return count;
diff --git a/arch/sh/drivers/dma/dmabrg.c b/arch/sh/drivers/dma/dmabrg.c
index 5b2c1fd254d7..04c66a8d893f 100644
--- a/arch/sh/drivers/dma/dmabrg.c
+++ b/arch/sh/drivers/dma/dmabrg.c
@@ -122,7 +122,7 @@ static void dmabrg_enable_irq(unsigned int dmairq)
__raw_writel(dcr, DMABRGCR);
}

-int dmabrg_request_irq(unsigned int dmairq, void(*handler)(void*),
+int dmabrg_request_irq(unsigned int dmairq, void(*handler)(void *),
void *data)
{
if ((dmairq > 9) || !handler)
diff --git a/arch/sh/drivers/heartbeat.c b/arch/sh/drivers/heartbeat.c
index 24391b444b28..07f04ed0d517 100644
--- a/arch/sh/drivers/heartbeat.c
+++ b/arch/sh/drivers/heartbeat.c
@@ -30,7 +30,7 @@
static unsigned char default_bit_pos[] = { 0, 1, 2, 3, 4, 5, 6, 7 };

static inline void heartbeat_toggle_bit(struct heartbeat_data *hd,
- unsigned bit, unsigned int inverted)
+ unsigned int bit, unsigned int inverted)
{
unsigned int new;

@@ -59,7 +59,7 @@ static inline void heartbeat_toggle_bit(struct heartbeat_data *hd,
static void heartbeat_timer(struct timer_list *t)
{
struct heartbeat_data *hd = from_timer(hd, t, timer);
- static unsigned bit = 0, up = 1;
+ static unsigned int bit = 0, up = 1;

heartbeat_toggle_bit(hd, bit, hd->flags & HEARTBEAT_INVERTED);

--
2.25.1