[PATCH] iptables-compat: homogenize error message

2018-05-27 Thread Arushi Singhal
There is a difference between error messages in iptables and
iptables-compat:

#sudo iptables-compat -D INPUT 4
iptables: No chain/target/match by that name.

#sudo iptables -D INPUT 4
iptables: Index of deletion too big.

Now, will show same error message.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 iptables/nft.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/iptables/nft.c b/iptables/nft.c
index e33d00f..40646f4 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -2603,7 +2603,7 @@ const char *nft_strerror(int err)
{ nft_rule_add, E2BIG, "Index of insertion too big" },
{ nft_rule_check, ENOENT, "Bad rule (does a matching rule exist in 
that chain?)" },
{ nft_rule_replace, ENOENT, "Index of replacement too big" },
-   { nft_rule_delete_num, E2BIG, "Index of deletion too big" },
+   { nft_rule_delete_num, ENOENT, "Index of deletion too big" },
 /* { TC_READ_COUNTER, E2BIG, "Index of counter too big" },
{ TC_ZERO_COUNTER, E2BIG, "Index of counter too big" }, */
{ nft_rule_add, ELOOP, "Loop found in table" },
-- 
2.7.4



[PATCH] iptables-compat: homogenize error message

2018-05-27 Thread Arushi Singhal
There is a difference between error messages in iptables and
iptables-compat:

#sudo iptables-compat -D INPUT 4
iptables: No chain/target/match by that name.

#sudo iptables -D INPUT 4
iptables: Index of deletion too big.

Now, will show same error message.

Signed-off-by: Arushi Singhal 
---
 iptables/nft.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/iptables/nft.c b/iptables/nft.c
index e33d00f..40646f4 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -2603,7 +2603,7 @@ const char *nft_strerror(int err)
{ nft_rule_add, E2BIG, "Index of insertion too big" },
{ nft_rule_check, ENOENT, "Bad rule (does a matching rule exist in 
that chain?)" },
{ nft_rule_replace, ENOENT, "Index of replacement too big" },
-   { nft_rule_delete_num, E2BIG, "Index of deletion too big" },
+   { nft_rule_delete_num, ENOENT, "Index of deletion too big" },
 /* { TC_READ_COUNTER, E2BIG, "Index of counter too big" },
{ TC_ZERO_COUNTER, E2BIG, "Index of counter too big" }, */
{ nft_rule_add, ELOOP, "Loop found in table" },
-- 
2.7.4



[PATCH] net: netfilter: Merge assignment with return

2018-03-28 Thread Arushi Singhal
Merge assignment with return statement to directly return the value.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 net/netfilter/nf_conntrack_netlink.c | 5 ++---
 net/netfilter/xt_hashlimit.c | 3 +--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/net/netfilter/nf_conntrack_netlink.c 
b/net/netfilter/nf_conntrack_netlink.c
index dd177eb..bfa8b7f 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1497,9 +1497,8 @@ ctnetlink_setup_nat(struct nf_conn *ct, const struct 
nlattr * const cda[])
if (ret < 0)
return ret;
 
-   ret = ctnetlink_parse_nat_setup(ct, NF_NAT_MANIP_SRC,
-   cda[CTA_NAT_SRC]);
-   return ret;
+   return ctnetlink_parse_nat_setup(ct, NF_NAT_MANIP_SRC,
+cda[CTA_NAT_SRC]);
 #else
if (!cda[CTA_NAT_DST] && !cda[CTA_NAT_SRC])
return 0;
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 66f5aca..9e8ba2e 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -534,8 +534,7 @@ static u64 user2rate_bytes(u32 user)
u64 r;
 
r = user ? U32_MAX / user : U32_MAX;
-   r = (r - 1) << XT_HASHLIMIT_BYTE_SHIFT;
-   return r;
+   return (r - 1) << XT_HASHLIMIT_BYTE_SHIFT;
 }
 
 static void rateinfo_recalc(struct dsthash_ent *dh, unsigned long now,
-- 
2.7.4



[PATCH] net: netfilter: Merge assignment with return

2018-03-28 Thread Arushi Singhal
Merge assignment with return statement to directly return the value.

Signed-off-by: Arushi Singhal 
---
 net/netfilter/nf_conntrack_netlink.c | 5 ++---
 net/netfilter/xt_hashlimit.c | 3 +--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/net/netfilter/nf_conntrack_netlink.c 
b/net/netfilter/nf_conntrack_netlink.c
index dd177eb..bfa8b7f 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1497,9 +1497,8 @@ ctnetlink_setup_nat(struct nf_conn *ct, const struct 
nlattr * const cda[])
if (ret < 0)
return ret;
 
-   ret = ctnetlink_parse_nat_setup(ct, NF_NAT_MANIP_SRC,
-   cda[CTA_NAT_SRC]);
-   return ret;
+   return ctnetlink_parse_nat_setup(ct, NF_NAT_MANIP_SRC,
+cda[CTA_NAT_SRC]);
 #else
if (!cda[CTA_NAT_DST] && !cda[CTA_NAT_SRC])
return 0;
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 66f5aca..9e8ba2e 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -534,8 +534,7 @@ static u64 user2rate_bytes(u32 user)
u64 r;
 
r = user ? U32_MAX / user : U32_MAX;
-   r = (r - 1) << XT_HASHLIMIT_BYTE_SHIFT;
-   return r;
+   return (r - 1) << XT_HASHLIMIT_BYTE_SHIFT;
 }
 
 static void rateinfo_recalc(struct dsthash_ent *dh, unsigned long now,
-- 
2.7.4



[PATCH v2] gpu: drm: nouveau: Use list_for_each_entry_from_reverse

2018-03-27 Thread Arushi Singhal
It's better to use "list_for_each_entry_from_reverse" for iterating list
than "for loop" as it makes the code more clear to read.
This patch replace "for loop" with "list_for_each_entry_from_reverse"
and "start" variable with "cstate" which helps in refactoring
the code and also "cstate" variable is more commonly used in the other
functions.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
changes in v2:
"start" variable is removed, before "cstate" variable was removed
but "cstate" is more common so preferred "cstate" over "start".

 drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
index 81c3567..ba6a868 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
@@ -109,18 +109,17 @@ nvkm_cstate_valid(struct nvkm_clk *clk, struct 
nvkm_cstate *cstate,
 
 static struct nvkm_cstate *
 nvkm_cstate_find_best(struct nvkm_clk *clk, struct nvkm_pstate *pstate,
- struct nvkm_cstate *start)
+ struct nvkm_cstate *cstate)
 {
struct nvkm_device *device = clk->subdev.device;
struct nvkm_volt *volt = device->volt;
-   struct nvkm_cstate *cstate;
int max_volt;
 
-   if (!pstate || !start)
+   if (!pstate || !cstate)
return NULL;
 
if (!volt)
-   return start;
+   return cstate;
 
max_volt = volt->max_uv;
if (volt->max0_id != 0xff)
@@ -133,8 +132,7 @@ nvkm_cstate_find_best(struct nvkm_clk *clk, struct 
nvkm_pstate *pstate,
max_volt = min(max_volt,
   nvkm_volt_map(volt, volt->max2_id, clk->temp));
 
-   for (cstate = start; >head != >list;
-cstate = list_prev_entry(cstate, head)) {
+   list_for_each_entry_from_reverse(cstate, >list, head) {
if (nvkm_cstate_valid(clk, cstate, max_volt, clk->temp))
break;
}
-- 
2.7.4



[PATCH v2] gpu: drm: nouveau: Use list_for_each_entry_from_reverse

2018-03-27 Thread Arushi Singhal
It's better to use "list_for_each_entry_from_reverse" for iterating list
than "for loop" as it makes the code more clear to read.
This patch replace "for loop" with "list_for_each_entry_from_reverse"
and "start" variable with "cstate" which helps in refactoring
the code and also "cstate" variable is more commonly used in the other
functions.

Signed-off-by: Arushi Singhal 
---
changes in v2:
"start" variable is removed, before "cstate" variable was removed
but "cstate" is more common so preferred "cstate" over "start".

 drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
index 81c3567..ba6a868 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
@@ -109,18 +109,17 @@ nvkm_cstate_valid(struct nvkm_clk *clk, struct 
nvkm_cstate *cstate,
 
 static struct nvkm_cstate *
 nvkm_cstate_find_best(struct nvkm_clk *clk, struct nvkm_pstate *pstate,
- struct nvkm_cstate *start)
+ struct nvkm_cstate *cstate)
 {
struct nvkm_device *device = clk->subdev.device;
struct nvkm_volt *volt = device->volt;
-   struct nvkm_cstate *cstate;
int max_volt;
 
-   if (!pstate || !start)
+   if (!pstate || !cstate)
return NULL;
 
if (!volt)
-   return start;
+   return cstate;
 
max_volt = volt->max_uv;
if (volt->max0_id != 0xff)
@@ -133,8 +132,7 @@ nvkm_cstate_find_best(struct nvkm_clk *clk, struct 
nvkm_pstate *pstate,
max_volt = min(max_volt,
   nvkm_volt_map(volt, volt->max2_id, clk->temp));
 
-   for (cstate = start; >head != >list;
-cstate = list_prev_entry(cstate, head)) {
+   list_for_each_entry_from_reverse(cstate, >list, head) {
if (nvkm_cstate_valid(clk, cstate, max_volt, clk->temp))
break;
}
-- 
2.7.4



[PATCH] gpu: drm: nouveau: Use list_for_each_entry_from_reverse

2018-03-27 Thread Arushi Singhal
It's better to use "list_for_each_entry_from_reverse" for iterating list
than "for loop" as it makes the code more clear to read.
This patch replace "for loop" with "list_for_each_entry_from_reverse"
and remove "cstate" variable as it is redundant in the code.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
index 81c3567..5e56f74 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
@@ -113,7 +113,6 @@ nvkm_cstate_find_best(struct nvkm_clk *clk, struct 
nvkm_pstate *pstate,
 {
struct nvkm_device *device = clk->subdev.device;
struct nvkm_volt *volt = device->volt;
-   struct nvkm_cstate *cstate;
int max_volt;
 
if (!pstate || !start)
@@ -133,13 +132,12 @@ nvkm_cstate_find_best(struct nvkm_clk *clk, struct 
nvkm_pstate *pstate,
max_volt = min(max_volt,
   nvkm_volt_map(volt, volt->max2_id, clk->temp));
 
-   for (cstate = start; >head != >list;
-cstate = list_prev_entry(cstate, head)) {
-   if (nvkm_cstate_valid(clk, cstate, max_volt, clk->temp))
+   list_for_each_entry_from_reverse(start, >list, head) {
+   if (nvkm_cstate_valid(clk, start, max_volt, clk->temp))
break;
}
 
-   return cstate;
+   return start;
 }
 
 static struct nvkm_cstate *
-- 
2.7.4



[PATCH] gpu: drm: nouveau: Use list_for_each_entry_from_reverse

2018-03-27 Thread Arushi Singhal
It's better to use "list_for_each_entry_from_reverse" for iterating list
than "for loop" as it makes the code more clear to read.
This patch replace "for loop" with "list_for_each_entry_from_reverse"
and remove "cstate" variable as it is redundant in the code.

Signed-off-by: Arushi Singhal 
---
 drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
index 81c3567..5e56f74 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
@@ -113,7 +113,6 @@ nvkm_cstate_find_best(struct nvkm_clk *clk, struct 
nvkm_pstate *pstate,
 {
struct nvkm_device *device = clk->subdev.device;
struct nvkm_volt *volt = device->volt;
-   struct nvkm_cstate *cstate;
int max_volt;
 
if (!pstate || !start)
@@ -133,13 +132,12 @@ nvkm_cstate_find_best(struct nvkm_clk *clk, struct 
nvkm_pstate *pstate,
max_volt = min(max_volt,
   nvkm_volt_map(volt, volt->max2_id, clk->temp));
 
-   for (cstate = start; >head != >list;
-cstate = list_prev_entry(cstate, head)) {
-   if (nvkm_cstate_valid(clk, cstate, max_volt, clk->temp))
+   list_for_each_entry_from_reverse(start, >list, head) {
+   if (nvkm_cstate_valid(clk, start, max_volt, clk->temp))
break;
}
 
-   return cstate;
+   return start;
 }
 
 static struct nvkm_cstate *
-- 
2.7.4



[PATCH v2 1/2] gpu: drm/lease:: Use list_{next/prev}_entry instead of list_entry

2018-03-25 Thread Arushi Singhal
It's better to use list_entry instead of list_{next/prev}_entry
as it makes the code more clear to read.
This patch replace list_entry with list_{next/prev}_entry.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/gpu/drm/drm_lease.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
index 1402c0e..4dcfb5f 100644
--- a/drivers/gpu/drm/drm_lease.c
+++ b/drivers/gpu/drm/drm_lease.c
@@ -340,7 +340,7 @@ static void _drm_lease_revoke(struct drm_master *top)
break;
 
/* Over */
-   master = list_entry(master->lessee_list.next, struct 
drm_master, lessee_list);
+   master = list_next_entry(master, lessee_list);
}
}
 }
-- 
2.7.4



[PATCH v2 1/2] gpu: drm/lease:: Use list_{next/prev}_entry instead of list_entry

2018-03-25 Thread Arushi Singhal
It's better to use list_entry instead of list_{next/prev}_entry
as it makes the code more clear to read.
This patch replace list_entry with list_{next/prev}_entry.

Signed-off-by: Arushi Singhal 
---
 drivers/gpu/drm/drm_lease.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
index 1402c0e..4dcfb5f 100644
--- a/drivers/gpu/drm/drm_lease.c
+++ b/drivers/gpu/drm/drm_lease.c
@@ -340,7 +340,7 @@ static void _drm_lease_revoke(struct drm_master *top)
break;
 
/* Over */
-   master = list_entry(master->lessee_list.next, struct 
drm_master, lessee_list);
+   master = list_next_entry(master, lessee_list);
}
}
 }
-- 
2.7.4



[PATCH v2 2/2] gpu: drm: nouveau: Use list_{next/prev}_entry instead of list_entry

2018-03-25 Thread Arushi Singhal
It's better to use list_entry instead of list_{next/prev}_entry
as it makes the code more clear to read.
This patch replace list_entry with list_{next/prev}_entry.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
index e4c8d31..81c3567 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
@@ -134,7 +134,7 @@ nvkm_cstate_find_best(struct nvkm_clk *clk, struct 
nvkm_pstate *pstate,
   nvkm_volt_map(volt, volt->max2_id, clk->temp));
 
for (cstate = start; >head != >list;
-cstate = list_entry(cstate->head.prev, typeof(*cstate), head)) {
+cstate = list_prev_entry(cstate, head)) {
if (nvkm_cstate_valid(clk, cstate, max_volt, clk->temp))
break;
}
-- 
2.7.4



[PATCH v2 2/2] gpu: drm: nouveau: Use list_{next/prev}_entry instead of list_entry

2018-03-25 Thread Arushi Singhal
It's better to use list_entry instead of list_{next/prev}_entry
as it makes the code more clear to read.
This patch replace list_entry with list_{next/prev}_entry.

Signed-off-by: Arushi Singhal 
---
 drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
index e4c8d31..81c3567 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
@@ -134,7 +134,7 @@ nvkm_cstate_find_best(struct nvkm_clk *clk, struct 
nvkm_pstate *pstate,
   nvkm_volt_map(volt, volt->max2_id, clk->temp));
 
for (cstate = start; >head != >list;
-cstate = list_entry(cstate->head.prev, typeof(*cstate), head)) {
+cstate = list_prev_entry(cstate, head)) {
if (nvkm_cstate_valid(clk, cstate, max_volt, clk->temp))
break;
}
-- 
2.7.4



[PATCH v2 0/2] drm: Replace list_entry

2018-03-25 Thread Arushi Singhal
Replace list_entry with list_{next/prev}_entry.

Arushi Singhal (2):
  gpu: drm/lease:: Use list_{next/prev}_entry instead of list_entry
  gpu: drm: nouveau: Use list_{next/prev}_entry instead of list_entry

 drivers/gpu/drm/drm_lease.c| 2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
changes in v2
*All the maintainers are added.
*More accurate coccinelle script is used
for this patch than the one used in previous version.
2.7.4



[PATCH v2 0/2] drm: Replace list_entry

2018-03-25 Thread Arushi Singhal
Replace list_entry with list_{next/prev}_entry.

Arushi Singhal (2):
  gpu: drm/lease:: Use list_{next/prev}_entry instead of list_entry
  gpu: drm: nouveau: Use list_{next/prev}_entry instead of list_entry

 drivers/gpu/drm/drm_lease.c| 2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
changes in v2
*All the maintainers are added.
*More accurate coccinelle script is used
for this patch than the one used in previous version.
2.7.4



[PATCH] mtd: Use DIV_ROUND_UP()

2018-03-25 Thread Arushi Singhal
The kernel.h macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) / (d)) but is perhaps more readable.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/mtd/ftl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index a048429..61d5cf8 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -425,8 +425,8 @@ static int prepare_xfer(partition_t *part, int i)
 }
 
 /* Write the BAM stub */
-nbam = (part->BlocksPerUnit * sizeof(uint32_t) +
-   le32_to_cpu(part->header.BAMOffset) + SECTOR_SIZE - 1) / 
SECTOR_SIZE;
+nbam = DIV_ROUND_UP(part->BlocksPerUnit * sizeof(uint32_t) +
+   le32_to_cpu(part->header.BAMOffset), SECTOR_SIZE);
 
 offset = xfer->Offset + le32_to_cpu(part->header.BAMOffset);
 ctl = cpu_to_le32(BLOCK_CONTROL);
-- 
2.7.4



[PATCH] mtd: Use DIV_ROUND_UP()

2018-03-25 Thread Arushi Singhal
The kernel.h macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) / (d)) but is perhaps more readable.

Signed-off-by: Arushi Singhal 
---
 drivers/mtd/ftl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index a048429..61d5cf8 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -425,8 +425,8 @@ static int prepare_xfer(partition_t *part, int i)
 }
 
 /* Write the BAM stub */
-nbam = (part->BlocksPerUnit * sizeof(uint32_t) +
-   le32_to_cpu(part->header.BAMOffset) + SECTOR_SIZE - 1) / 
SECTOR_SIZE;
+nbam = DIV_ROUND_UP(part->BlocksPerUnit * sizeof(uint32_t) +
+   le32_to_cpu(part->header.BAMOffset), SECTOR_SIZE);
 
 offset = xfer->Offset + le32_to_cpu(part->header.BAMOffset);
 ctl = cpu_to_le32(BLOCK_CONTROL);
-- 
2.7.4



[PATCH v2] mtd: chips: Replace printk() with pr_*()

2018-03-24 Thread Arushi Singhal
Using pr_() is more concise than printk(KERN_).
This patch:
* Replace printks having a log level with the appropriate
pr_*() macros.
* Indent the code where possible.
* Remove periods from messages.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
changes:
Before printk() is changes to dev_*macro(), but it was not good idea
because mtd->dev is only initialized after mtd_device_register() is called.

 drivers/mtd/chips/cfi_cmdset_0001.c | 130 +++-
 1 file changed, 68 insertions(+), 62 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c 
b/drivers/mtd/chips/cfi_cmdset_0001.c
index 5e1b68c..3313dbb 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -182,7 +182,7 @@ static void fixup_convert_atmel_pri(struct mtd_info *mtd)
memcpy(_pri, extp, sizeof(atmel_pri));
memset((char *)extp + 5, 0, sizeof(*extp) - 5);
 
-   printk(KERN_ERR "atmel Features: %02x\n", atmel_pri.Features);
+   pr_err("atmel Features: %02x\n", atmel_pri.Features);
 
if (atmel_pri.Features & 0x01) /* chip erase supported */
features |= (1<<0);
@@ -224,8 +224,7 @@ static void fixup_intel_strataflash(struct mtd_info *mtd)
struct cfi_private *cfi = map->fldrv_priv;
struct cfi_pri_intelext *extp = cfi->cmdset_priv;
 
-   printk(KERN_WARNING "cfi_cmdset_0001: Suspend "
-   "erase on write disabled.\n");
+   pr_warn("cfi_cmdset_0001: Suspend erase on write disabled\n");
extp->SuspendCmdSupport &= ~1;
 }
 #endif
@@ -239,7 +238,7 @@ static void fixup_no_write_suspend(struct mtd_info *mtd)
 
if (cfip && (cfip->FeatureSupport&4)) {
cfip->FeatureSupport &= ~4;
-   printk(KERN_WARNING "cfi_cmdset_0001: write suspend 
disabled\n");
+   pr_warn("cfi_cmdset_0001: write suspend disabled\n");
}
 }
 #endif
@@ -282,13 +281,13 @@ static void fixup_LH28F640BF(struct mtd_info *mtd)
/* Reset the Partition Configuration Register on LH28F640BF
 * to a single partition (PCR = 0x000): PCR is embedded into A0-A15. */
if (is_LH28F640BF(cfi)) {
-   printk(KERN_INFO "Reset Partition Config. Register: 1 Partition 
of 4 planes\n");
+   pr_info("Reset Partition Config. Register: 1 Partition of 4 
planes\n");
map_write(map, CMD(0x60), 0);
map_write(map, CMD(0x04), 0);
 
/* We have set one single partition thus
 * Simultaneous Operations are not allowed */
-   printk(KERN_INFO "cfi_cmdset_0001: Simultaneous Operations 
disabled\n");
+   pr_info("cfi_cmdset_0001: Simultaneous Operations disabled\n");
extp->FeatureSupport &= ~512;
}
 }
@@ -307,7 +306,7 @@ static void fixup_use_write_buffers(struct mtd_info *mtd)
struct map_info *map = mtd->priv;
struct cfi_private *cfi = map->fldrv_priv;
if (cfi->cfiq->BufWriteTimeoutTyp) {
-   printk(KERN_INFO "Using buffer write method\n" );
+   pr_info("Using buffer write method\n");
mtd->_write = cfi_intelext_write_buffers;
mtd->_writev = cfi_intelext_writev;
}
@@ -323,7 +322,7 @@ static void fixup_unlock_powerup_lock(struct mtd_info *mtd)
struct cfi_pri_intelext *cfip = cfi->cmdset_priv;
 
if (cfip->FeatureSupport&32) {
-   printk(KERN_INFO "Using auto-unlock on power-up/resume\n" );
+   pr_info("Using auto-unlock on power-up/resume\n");
mtd->flags |= MTD_POWERUP_LOCK;
}
 }
@@ -392,9 +391,8 @@ read_pri_intelext(struct map_info *map, __u16 adr)
 
if (extp->MajorVersion != '1' ||
(extp->MinorVersion < '0' || extp->MinorVersion > '5')) {
-   printk(KERN_ERR "  Unknown Intel/Sharp Extended Query "
-  "version %c.%c.\n",  extp->MajorVersion,
-  extp->MinorVersion);
+   pr_err("Unknown Intel/Sharp Extended Query version %c.%c\n",
+  extp->MajorVersion, extp->MinorVersion);
kfree(extp);
return NULL;
}
@@ -452,9 +450,8 @@ read_pri_intelext(struct map_info *map, __u16 adr)
extp_size = sizeof(*extp) + extra_size;
kfree(extp);
if (extp_size > 4096) {
-   printk(KERN_ERR
-   "%s: cfi_pri_intelext is too fat\n",
-   __func__);
+   pr_err(&quo

[PATCH v2] mtd: chips: Replace printk() with pr_*()

2018-03-24 Thread Arushi Singhal
Using pr_() is more concise than printk(KERN_).
This patch:
* Replace printks having a log level with the appropriate
pr_*() macros.
* Indent the code where possible.
* Remove periods from messages.

Signed-off-by: Arushi Singhal 
---
changes:
Before printk() is changes to dev_*macro(), but it was not good idea
because mtd->dev is only initialized after mtd_device_register() is called.

 drivers/mtd/chips/cfi_cmdset_0001.c | 130 +++-
 1 file changed, 68 insertions(+), 62 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c 
b/drivers/mtd/chips/cfi_cmdset_0001.c
index 5e1b68c..3313dbb 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -182,7 +182,7 @@ static void fixup_convert_atmel_pri(struct mtd_info *mtd)
memcpy(_pri, extp, sizeof(atmel_pri));
memset((char *)extp + 5, 0, sizeof(*extp) - 5);
 
-   printk(KERN_ERR "atmel Features: %02x\n", atmel_pri.Features);
+   pr_err("atmel Features: %02x\n", atmel_pri.Features);
 
if (atmel_pri.Features & 0x01) /* chip erase supported */
features |= (1<<0);
@@ -224,8 +224,7 @@ static void fixup_intel_strataflash(struct mtd_info *mtd)
struct cfi_private *cfi = map->fldrv_priv;
struct cfi_pri_intelext *extp = cfi->cmdset_priv;
 
-   printk(KERN_WARNING "cfi_cmdset_0001: Suspend "
-   "erase on write disabled.\n");
+   pr_warn("cfi_cmdset_0001: Suspend erase on write disabled\n");
extp->SuspendCmdSupport &= ~1;
 }
 #endif
@@ -239,7 +238,7 @@ static void fixup_no_write_suspend(struct mtd_info *mtd)
 
if (cfip && (cfip->FeatureSupport&4)) {
cfip->FeatureSupport &= ~4;
-   printk(KERN_WARNING "cfi_cmdset_0001: write suspend 
disabled\n");
+   pr_warn("cfi_cmdset_0001: write suspend disabled\n");
}
 }
 #endif
@@ -282,13 +281,13 @@ static void fixup_LH28F640BF(struct mtd_info *mtd)
/* Reset the Partition Configuration Register on LH28F640BF
 * to a single partition (PCR = 0x000): PCR is embedded into A0-A15. */
if (is_LH28F640BF(cfi)) {
-   printk(KERN_INFO "Reset Partition Config. Register: 1 Partition 
of 4 planes\n");
+   pr_info("Reset Partition Config. Register: 1 Partition of 4 
planes\n");
map_write(map, CMD(0x60), 0);
map_write(map, CMD(0x04), 0);
 
/* We have set one single partition thus
 * Simultaneous Operations are not allowed */
-   printk(KERN_INFO "cfi_cmdset_0001: Simultaneous Operations 
disabled\n");
+   pr_info("cfi_cmdset_0001: Simultaneous Operations disabled\n");
extp->FeatureSupport &= ~512;
}
 }
@@ -307,7 +306,7 @@ static void fixup_use_write_buffers(struct mtd_info *mtd)
struct map_info *map = mtd->priv;
struct cfi_private *cfi = map->fldrv_priv;
if (cfi->cfiq->BufWriteTimeoutTyp) {
-   printk(KERN_INFO "Using buffer write method\n" );
+   pr_info("Using buffer write method\n");
mtd->_write = cfi_intelext_write_buffers;
mtd->_writev = cfi_intelext_writev;
}
@@ -323,7 +322,7 @@ static void fixup_unlock_powerup_lock(struct mtd_info *mtd)
struct cfi_pri_intelext *cfip = cfi->cmdset_priv;
 
if (cfip->FeatureSupport&32) {
-   printk(KERN_INFO "Using auto-unlock on power-up/resume\n" );
+   pr_info("Using auto-unlock on power-up/resume\n");
mtd->flags |= MTD_POWERUP_LOCK;
}
 }
@@ -392,9 +391,8 @@ read_pri_intelext(struct map_info *map, __u16 adr)
 
if (extp->MajorVersion != '1' ||
(extp->MinorVersion < '0' || extp->MinorVersion > '5')) {
-   printk(KERN_ERR "  Unknown Intel/Sharp Extended Query "
-  "version %c.%c.\n",  extp->MajorVersion,
-  extp->MinorVersion);
+   pr_err("Unknown Intel/Sharp Extended Query version %c.%c\n",
+  extp->MajorVersion, extp->MinorVersion);
kfree(extp);
return NULL;
}
@@ -452,9 +450,8 @@ read_pri_intelext(struct map_info *map, __u16 adr)
extp_size = sizeof(*extp) + extra_size;
kfree(extp);
if (extp_size > 4096) {
-   printk(KERN_ERR
-   "%s: cfi_pri_intelext is too fat\n",
-   __func__);
+   pr_err("%s: cfi_pri_intelext is too

[PATCH] mtd: devices: check mtd_device_register() return code

2018-03-24 Thread Arushi Singhal
stfsm_probe() misses error handling of mtd_device_register().

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/mtd/devices/st_spi_fsm.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c
index 7bc29d7..4a99a6a 100644
--- a/drivers/mtd/devices/st_spi_fsm.c
+++ b/drivers/mtd/devices/st_spi_fsm.c
@@ -2125,7 +2125,13 @@ static int stfsm_probe(struct platform_device *pdev)
(long long)fsm->mtd.size, (long long)(fsm->mtd.size >> 20),
fsm->mtd.erasesize, (fsm->mtd.erasesize >> 10));
 
-   return mtd_device_register(>mtd, NULL, 0);
+   ret = mtd_device_register(>mtd, NULL, 0);
+   if (ret) {
+   pr_err("Failed to register device\n");
+   goto err_clk_unprepare;
+   }
+
+   return 0;
 
 err_clk_unprepare:
clk_disable_unprepare(fsm->clk);
-- 
2.7.4



[PATCH] mtd: devices: check mtd_device_register() return code

2018-03-24 Thread Arushi Singhal
stfsm_probe() misses error handling of mtd_device_register().

Signed-off-by: Arushi Singhal 
---
 drivers/mtd/devices/st_spi_fsm.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c
index 7bc29d7..4a99a6a 100644
--- a/drivers/mtd/devices/st_spi_fsm.c
+++ b/drivers/mtd/devices/st_spi_fsm.c
@@ -2125,7 +2125,13 @@ static int stfsm_probe(struct platform_device *pdev)
(long long)fsm->mtd.size, (long long)(fsm->mtd.size >> 20),
fsm->mtd.erasesize, (fsm->mtd.erasesize >> 10));
 
-   return mtd_device_register(>mtd, NULL, 0);
+   ret = mtd_device_register(>mtd, NULL, 0);
+   if (ret) {
+   pr_err("Failed to register device\n");
+   goto err_clk_unprepare;
+   }
+
+   return 0;
 
 err_clk_unprepare:
clk_disable_unprepare(fsm->clk);
-- 
2.7.4



[PATCH] mtd: nand: do not initialise statics to 0 or NULL

2018-03-24 Thread Arushi Singhal
This patch fixes the checkpatch.pl error to ams-delta.c.
ERROR: do not initialise statics to 0 or NULL

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/mtd/nand/ams-delta.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 6e7f6e0..8e89452 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -35,7 +35,7 @@
 /*
  * MTD structure for E3 (Delta)
  */
-static struct mtd_info *ams_delta_mtd = NULL;
+static struct mtd_info *ams_delta_mtd;
 
 /*
  * Define partitions for flash devices
-- 
2.7.4



[PATCH] mtd: nand: do not initialise statics to 0 or NULL

2018-03-24 Thread Arushi Singhal
This patch fixes the checkpatch.pl error to ams-delta.c.
ERROR: do not initialise statics to 0 or NULL

Signed-off-by: Arushi Singhal 
---
 drivers/mtd/nand/ams-delta.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 6e7f6e0..8e89452 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -35,7 +35,7 @@
 /*
  * MTD structure for E3 (Delta)
  */
-static struct mtd_info *ams_delta_mtd = NULL;
+static struct mtd_info *ams_delta_mtd;
 
 /*
  * Define partitions for flash devices
-- 
2.7.4



[PATCH] mtd: switch to mtd_device_register()

2018-03-24 Thread Arushi Singhal
Use mtd_device_register() instead of mtd_device_parse_register() to
eliminate two unused parameters.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/mtd/devices/sst25l.c| 5 ++---
 drivers/mtd/lpddr/lpddr2_nvm.c  | 2 +-
 drivers/mtd/maps/impa7.c| 5 ++---
 drivers/mtd/maps/intel_vr_nor.c | 2 +-
 drivers/mtd/maps/latch-addr-flash.c | 5 ++---
 drivers/mtd/maps/rbtx4939-flash.c   | 4 ++--
 drivers/mtd/nand/cmx270_nand.c  | 4 ++--
 drivers/mtd/nand/cs553x_nand.c  | 3 +--
 drivers/mtd/nand/davinci_nand.c | 4 ++--
 drivers/mtd/nand/jz4740_nand.c  | 5 ++---
 drivers/mtd/nand/mtk_nand.c | 2 +-
 drivers/mtd/nand/s3c2410.c  | 4 ++--
 drivers/mtd/nand/txx9ndfmc.c| 2 +-
 drivers/mtd/onenand/generic.c   | 5 ++---
 drivers/mtd/onenand/samsung.c   | 5 ++---
 drivers/mtd/spi-nor/intel-spi.c | 2 +-
 16 files changed, 26 insertions(+), 33 deletions(-)

diff --git a/drivers/mtd/devices/sst25l.c b/drivers/mtd/devices/sst25l.c
index 5b84d71..bc14aca 100644
--- a/drivers/mtd/devices/sst25l.c
+++ b/drivers/mtd/devices/sst25l.c
@@ -397,9 +397,8 @@ static int sst25l_probe(struct spi_device *spi)
  flash->mtd.numeraseregions);
 
 
-   ret = mtd_device_parse_register(>mtd, NULL, NULL,
-   data ? data->parts : NULL,
-   data ? data->nr_parts : 0);
+   ret = mtd_device_register(>mtd, data ? data->parts : NULL,
+ data ? data->nr_parts : 0);
if (ret)
return -ENODEV;
 
diff --git a/drivers/mtd/lpddr/lpddr2_nvm.c b/drivers/mtd/lpddr/lpddr2_nvm.c
index 2342277..3a60316 100644
--- a/drivers/mtd/lpddr/lpddr2_nvm.c
+++ b/drivers/mtd/lpddr/lpddr2_nvm.c
@@ -482,7 +482,7 @@ static int lpddr2_nvm_probe(struct platform_device *pdev)
return -EINVAL;
}
/* Parse partitions and register the MTD device */
-   return mtd_device_parse_register(mtd, NULL, NULL, NULL, 0);
+   return mtd_device_register(mtd, NULL, 0);
 }
 
 /*
diff --git a/drivers/mtd/maps/impa7.c b/drivers/mtd/maps/impa7.c
index a0b8fa7..815e2db 100644
--- a/drivers/mtd/maps/impa7.c
+++ b/drivers/mtd/maps/impa7.c
@@ -88,9 +88,8 @@ static int __init init_impa7(void)
if (impa7_mtd[i]) {
impa7_mtd[i]->owner = THIS_MODULE;
devicesfound++;
-   mtd_device_parse_register(impa7_mtd[i], NULL, NULL,
- partitions,
- ARRAY_SIZE(partitions));
+   mtd_device_register(impa7_mtd[i], partitions,
+   ARRAY_SIZE(partitions));
} else {
iounmap((void __iomem *)impa7_map[i].virt);
}
diff --git a/drivers/mtd/maps/intel_vr_nor.c b/drivers/mtd/maps/intel_vr_nor.c
index dd5d685..69503ae 100644
--- a/drivers/mtd/maps/intel_vr_nor.c
+++ b/drivers/mtd/maps/intel_vr_nor.c
@@ -71,7 +71,7 @@ static int vr_nor_init_partitions(struct vr_nor_mtd *p)
 {
/* register the flash bank */
/* partition the flash bank */
-   return mtd_device_parse_register(p->info, NULL, NULL, NULL, 0);
+   return mtd_device_register(p->info, NULL, 0);
 }
 
 static void vr_nor_destroy_mtd_setup(struct vr_nor_mtd *p)
diff --git a/drivers/mtd/maps/latch-addr-flash.c 
b/drivers/mtd/maps/latch-addr-flash.c
index 6dc97aa..51db24b 100644
--- a/drivers/mtd/maps/latch-addr-flash.c
+++ b/drivers/mtd/maps/latch-addr-flash.c
@@ -197,9 +197,8 @@ static int latch_addr_flash_probe(struct platform_device 
*dev)
}
info->mtd->dev.parent = >dev;
 
-   mtd_device_parse_register(info->mtd, NULL, NULL,
- latch_addr_data->parts,
- latch_addr_data->nr_parts);
+   mtd_device_register(info->mtd, latch_addr_data->parts,
+   latch_addr_data->nr_parts);
return 0;
 
 iounmap:
diff --git a/drivers/mtd/maps/rbtx4939-flash.c 
b/drivers/mtd/maps/rbtx4939-flash.c
index 3a06ecf..7a91533 100644
--- a/drivers/mtd/maps/rbtx4939-flash.c
+++ b/drivers/mtd/maps/rbtx4939-flash.c
@@ -97,8 +97,8 @@ static int rbtx4939_flash_probe(struct platform_device *dev)
goto err_out;
}
info->mtd->dev.parent = >dev;
-   err = mtd_device_parse_register(info->mtd, NULL, NULL, pdata->parts,
-   pdata->nr_parts);
+   err = mtd_device_register(info->mtd, pdata->parts,
+ pdata->nr_parts);
 
if (err)
goto err_out;
diff --git a/drivers/mtd/nand/cmx270_nand.c b/drivers/mtd/nand/cmx270_nand.c
index b01c980..05d73920 100644
--- a/drivers/mtd/nand/cmx270_nand.c
+

[PATCH] mtd: switch to mtd_device_register()

2018-03-24 Thread Arushi Singhal
Use mtd_device_register() instead of mtd_device_parse_register() to
eliminate two unused parameters.

Signed-off-by: Arushi Singhal 
---
 drivers/mtd/devices/sst25l.c| 5 ++---
 drivers/mtd/lpddr/lpddr2_nvm.c  | 2 +-
 drivers/mtd/maps/impa7.c| 5 ++---
 drivers/mtd/maps/intel_vr_nor.c | 2 +-
 drivers/mtd/maps/latch-addr-flash.c | 5 ++---
 drivers/mtd/maps/rbtx4939-flash.c   | 4 ++--
 drivers/mtd/nand/cmx270_nand.c  | 4 ++--
 drivers/mtd/nand/cs553x_nand.c  | 3 +--
 drivers/mtd/nand/davinci_nand.c | 4 ++--
 drivers/mtd/nand/jz4740_nand.c  | 5 ++---
 drivers/mtd/nand/mtk_nand.c | 2 +-
 drivers/mtd/nand/s3c2410.c  | 4 ++--
 drivers/mtd/nand/txx9ndfmc.c| 2 +-
 drivers/mtd/onenand/generic.c   | 5 ++---
 drivers/mtd/onenand/samsung.c   | 5 ++---
 drivers/mtd/spi-nor/intel-spi.c | 2 +-
 16 files changed, 26 insertions(+), 33 deletions(-)

diff --git a/drivers/mtd/devices/sst25l.c b/drivers/mtd/devices/sst25l.c
index 5b84d71..bc14aca 100644
--- a/drivers/mtd/devices/sst25l.c
+++ b/drivers/mtd/devices/sst25l.c
@@ -397,9 +397,8 @@ static int sst25l_probe(struct spi_device *spi)
  flash->mtd.numeraseregions);
 
 
-   ret = mtd_device_parse_register(>mtd, NULL, NULL,
-   data ? data->parts : NULL,
-   data ? data->nr_parts : 0);
+   ret = mtd_device_register(>mtd, data ? data->parts : NULL,
+ data ? data->nr_parts : 0);
if (ret)
return -ENODEV;
 
diff --git a/drivers/mtd/lpddr/lpddr2_nvm.c b/drivers/mtd/lpddr/lpddr2_nvm.c
index 2342277..3a60316 100644
--- a/drivers/mtd/lpddr/lpddr2_nvm.c
+++ b/drivers/mtd/lpddr/lpddr2_nvm.c
@@ -482,7 +482,7 @@ static int lpddr2_nvm_probe(struct platform_device *pdev)
return -EINVAL;
}
/* Parse partitions and register the MTD device */
-   return mtd_device_parse_register(mtd, NULL, NULL, NULL, 0);
+   return mtd_device_register(mtd, NULL, 0);
 }
 
 /*
diff --git a/drivers/mtd/maps/impa7.c b/drivers/mtd/maps/impa7.c
index a0b8fa7..815e2db 100644
--- a/drivers/mtd/maps/impa7.c
+++ b/drivers/mtd/maps/impa7.c
@@ -88,9 +88,8 @@ static int __init init_impa7(void)
if (impa7_mtd[i]) {
impa7_mtd[i]->owner = THIS_MODULE;
devicesfound++;
-   mtd_device_parse_register(impa7_mtd[i], NULL, NULL,
- partitions,
- ARRAY_SIZE(partitions));
+   mtd_device_register(impa7_mtd[i], partitions,
+   ARRAY_SIZE(partitions));
} else {
iounmap((void __iomem *)impa7_map[i].virt);
}
diff --git a/drivers/mtd/maps/intel_vr_nor.c b/drivers/mtd/maps/intel_vr_nor.c
index dd5d685..69503ae 100644
--- a/drivers/mtd/maps/intel_vr_nor.c
+++ b/drivers/mtd/maps/intel_vr_nor.c
@@ -71,7 +71,7 @@ static int vr_nor_init_partitions(struct vr_nor_mtd *p)
 {
/* register the flash bank */
/* partition the flash bank */
-   return mtd_device_parse_register(p->info, NULL, NULL, NULL, 0);
+   return mtd_device_register(p->info, NULL, 0);
 }
 
 static void vr_nor_destroy_mtd_setup(struct vr_nor_mtd *p)
diff --git a/drivers/mtd/maps/latch-addr-flash.c 
b/drivers/mtd/maps/latch-addr-flash.c
index 6dc97aa..51db24b 100644
--- a/drivers/mtd/maps/latch-addr-flash.c
+++ b/drivers/mtd/maps/latch-addr-flash.c
@@ -197,9 +197,8 @@ static int latch_addr_flash_probe(struct platform_device 
*dev)
}
info->mtd->dev.parent = >dev;
 
-   mtd_device_parse_register(info->mtd, NULL, NULL,
- latch_addr_data->parts,
- latch_addr_data->nr_parts);
+   mtd_device_register(info->mtd, latch_addr_data->parts,
+   latch_addr_data->nr_parts);
return 0;
 
 iounmap:
diff --git a/drivers/mtd/maps/rbtx4939-flash.c 
b/drivers/mtd/maps/rbtx4939-flash.c
index 3a06ecf..7a91533 100644
--- a/drivers/mtd/maps/rbtx4939-flash.c
+++ b/drivers/mtd/maps/rbtx4939-flash.c
@@ -97,8 +97,8 @@ static int rbtx4939_flash_probe(struct platform_device *dev)
goto err_out;
}
info->mtd->dev.parent = >dev;
-   err = mtd_device_parse_register(info->mtd, NULL, NULL, pdata->parts,
-   pdata->nr_parts);
+   err = mtd_device_register(info->mtd, pdata->parts,
+ pdata->nr_parts);
 
if (err)
goto err_out;
diff --git a/drivers/mtd/nand/cmx270_nand.c b/drivers/mtd/nand/cmx270_nand.c
index b01c980..05d73920 100644
--- a/drivers/mtd/nand/cmx270_nand.c
+++ b/drivers/mtd/nand/cmx270_nand.c
@@ 

[PATCH] mtd: devices: check mtd_device_register() return code

2018-03-20 Thread Arushi Singhal
stfsm_probe() misses error handling of mtd_device_register().

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/mtd/devices/st_spi_fsm.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c
index 7bc29d7..e1aa4f8 100644
--- a/drivers/mtd/devices/st_spi_fsm.c
+++ b/drivers/mtd/devices/st_spi_fsm.c
@@ -2125,7 +2125,13 @@ static int stfsm_probe(struct platform_device *pdev)
(long long)fsm->mtd.size, (long long)(fsm->mtd.size >> 20),
fsm->mtd.erasesize, (fsm->mtd.erasesize >> 10));
 
-   return mtd_device_register(>mtd, NULL, 0);
+   ret = mtd_device_register(>mtd, NULL, 0);
+   if (ret) {
+   pr_err("Failed to register device\n");
+   return ret;
+   }
+
+   return 0;
 
 err_clk_unprepare:
clk_disable_unprepare(fsm->clk);
-- 
2.7.4



[PATCH] mtd: devices: check mtd_device_register() return code

2018-03-20 Thread Arushi Singhal
stfsm_probe() misses error handling of mtd_device_register().

Signed-off-by: Arushi Singhal 
---
 drivers/mtd/devices/st_spi_fsm.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c
index 7bc29d7..e1aa4f8 100644
--- a/drivers/mtd/devices/st_spi_fsm.c
+++ b/drivers/mtd/devices/st_spi_fsm.c
@@ -2125,7 +2125,13 @@ static int stfsm_probe(struct platform_device *pdev)
(long long)fsm->mtd.size, (long long)(fsm->mtd.size >> 20),
fsm->mtd.erasesize, (fsm->mtd.erasesize >> 10));
 
-   return mtd_device_register(>mtd, NULL, 0);
+   ret = mtd_device_register(>mtd, NULL, 0);
+   if (ret) {
+   pr_err("Failed to register device\n");
+   return ret;
+   }
+
+   return 0;
 
 err_clk_unprepare:
clk_disable_unprepare(fsm->clk);
-- 
2.7.4



[PATCH v2 2/2] mtd: nand: Remove print after allocation failure

2018-03-20 Thread Arushi Singhal
The prints after [k|v][m|z|c]alloc() etc. functions are not needed, because
in case of failure, allocator will print their internal error prints
anyway.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
Reviewed-by: Miquel Raynal <miquel.ray...@bootlin.com>
---
 drivers/mtd/nand/ams-delta.c |  1 -
 drivers/mtd/nand/atmel/nand-controller.c | 13 +++-
 drivers/mtd/nand/marvell_nand.c  |  8 ++--
 drivers/mtd/nand/nandsim.c   | 35 
 drivers/mtd/nand/ndfc.c  |  4 +---
 drivers/mtd/nand/sunxi_nand.c|  4 +---
 6 files changed, 15 insertions(+), 50 deletions(-)

diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 9de6572..6e7f6e0 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -185,7 +185,6 @@ static int ams_delta_init(struct platform_device *pdev)
/* Allocate memory for MTD device structure and private data */
this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
if (!this) {
-   printk (KERN_WARNING "Unable to allocate E3 NAND MTD device 
structure.\n");
err = -ENOMEM;
goto out;
}
diff --git a/drivers/mtd/nand/atmel/nand-controller.c 
b/drivers/mtd/nand/atmel/nand-controller.c
index b2f00b3..b973d42 100644
--- a/drivers/mtd/nand/atmel/nand-controller.c
+++ b/drivers/mtd/nand/atmel/nand-controller.c
@@ -1615,10 +1615,8 @@ static int atmel_nand_register(struct atmel_nand *nand)
mtd->name = devm_kasprintf(nc->dev, GFP_KERNEL,
   "%s:nand.%d", dev_name(nc->dev),
   nand->cs[0].id);
-   if (!mtd->name) {
-   dev_err(nc->dev, "Failed to allocate mtd->name\n");
+   if (!mtd->name)
return -ENOMEM;
-   }
}
 
ret = nand_scan_tail(mtd);
@@ -1657,10 +1655,8 @@ static struct atmel_nand *atmel_nand_create(struct 
atmel_nand_controller *nc,
nand = devm_kzalloc(nc->dev,
sizeof(*nand) + (numcs * sizeof(*nand->cs)),
GFP_KERNEL);
-   if (!nand) {
-   dev_err(nc->dev, "Failed to allocate NAND object\n");
+   if (!nand)
return ERR_PTR(-ENOMEM);
-   }
 
nand->numcs = numcs;
 
@@ -2217,11 +2213,8 @@ atmel_hsmc_nand_controller_init(struct 
atmel_hsmc_nand_controller *nc)
nc->sram.virt = gen_pool_dma_alloc(nc->sram.pool,
ATMEL_NFC_SRAM_SIZE,
>sram.dma);
-   if (!nc->sram.virt) {
-   dev_err(nc->base.dev,
-   "Could not allocate memory from the NFC SRAM pool\n");
+   if (!nc->sram.virt)
return -ENOMEM;
-   }
 
return 0;
 }
diff --git a/drivers/mtd/nand/marvell_nand.c b/drivers/mtd/nand/marvell_nand.c
index 2196f2a..9dd2673 100644
--- a/drivers/mtd/nand/marvell_nand.c
+++ b/drivers/mtd/nand/marvell_nand.c
@@ -2307,10 +2307,8 @@ static int marvell_nand_chip_init(struct device *dev, 
struct marvell_nfc *nfc,
(nsels *
 sizeof(struct marvell_nand_chip_sel)),
GFP_KERNEL);
-   if (!marvell_nand) {
-   dev_err(dev, "could not allocate chip structure\n");
+   if (!marvell_nand)
return -ENOMEM;
-   }
 
marvell_nand->nsels = nsels;
marvell_nand->selected_die = -1;
@@ -2506,10 +2504,8 @@ static int marvell_nand_chip_init(struct device *dev, 
struct marvell_nfc *nfc,
mtd->name = devm_kasprintf(nfc->dev, GFP_KERNEL,
   "%s:nand.%d", dev_name(nfc->dev),
   marvell_nand->sels[0].cs);
-   if (!mtd->name) {
-   dev_err(nfc->dev, "Failed to allocate mtd->name\n");
+   if (!mtd->name)
return -ENOMEM;
-   }
}
 
ret = nand_scan_tail(mtd);
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index 44322a3..b6a5c09 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -569,13 +569,11 @@ static int __init alloc_device(struct nandsim *ns)
ns->pages_written = vzalloc(BITS_TO_LONGS(ns->geom.pgnum) *
sizeof(unsigned long));
if (!ns->pages_written) {
-   NS_ERR("alloc_device: unable to allocate pages written 
array\n");
err = -ENOMEM;
  

[PATCH v2 1/2] mtd: maps: Remove print after allocation failure

2018-03-20 Thread Arushi Singhal
The prints after [k|v][m|z|c]alloc() functions are not needed, because
in case of failure, allocator will print their internal error prints
anyway.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
changes in v2
* Prefered
if (!map) {
map = kmalloc();
if (!map)
err;
}

than

if (!map)
map = kmalloc();
if (!map)
err

 drivers/mtd/maps/amd76xrom.c  | 6 ++
 drivers/mtd/maps/ck804xrom.c  | 8 +++-
 drivers/mtd/maps/esb2rom.c| 7 +++
 drivers/mtd/maps/ichxrom.c| 6 ++
 drivers/mtd/maps/sun_uflash.c | 4 +---
 drivers/mtd/maps/vmu-flash.c  | 3 ---
 6 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/drivers/mtd/maps/amd76xrom.c b/drivers/mtd/maps/amd76xrom.c
index 26de0a1..406a8d3 100644
--- a/drivers/mtd/maps/amd76xrom.c
+++ b/drivers/mtd/maps/amd76xrom.c
@@ -188,10 +188,8 @@ static int amd76xrom_init_one(struct pci_dev *pdev,
 
if (!map) {
map = kmalloc(sizeof(*map), GFP_KERNEL);
-   }
-   if (!map) {
-   printk(KERN_ERR MOD_NAME ": kmalloc failed");
-   goto out;
+   if (!map)
+   goto out;
}
memset(map, 0, sizeof(*map));
INIT_LIST_HEAD(>list);
diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c
index 584962e..7377623 100644
--- a/drivers/mtd/maps/ck804xrom.c
+++ b/drivers/mtd/maps/ck804xrom.c
@@ -216,12 +216,10 @@ static int __init ck804xrom_init_one(struct pci_dev *pdev,
unsigned long offset;
int i;
 
-   if (!map)
-   map = kmalloc(sizeof(*map), GFP_KERNEL);
-
if (!map) {
-   printk(KERN_ERR MOD_NAME ": kmalloc failed");
-   goto out;
+   map = kmalloc(sizeof(*map), GFP_KERNEL);
+   if (!map)
+   goto out;
}
memset(map, 0, sizeof(*map));
INIT_LIST_HEAD(>list);
diff --git a/drivers/mtd/maps/esb2rom.c b/drivers/mtd/maps/esb2rom.c
index da9f6d7..2c63ecd 100644
--- a/drivers/mtd/maps/esb2rom.c
+++ b/drivers/mtd/maps/esb2rom.c
@@ -276,11 +276,10 @@ static int __init esb2rom_init_one(struct pci_dev *pdev,
unsigned long offset;
int i;
 
-   if (!map)
-   map = kmalloc(sizeof(*map), GFP_KERNEL);
if (!map) {
-   printk(KERN_ERR MOD_NAME ": kmalloc failed");
-   goto out;
+   map = kmalloc(sizeof(*map), GFP_KERNEL);
+   if (!map)
+   goto out;
}
memset(map, 0, sizeof(*map));
INIT_LIST_HEAD(>list);
diff --git a/drivers/mtd/maps/ichxrom.c b/drivers/mtd/maps/ichxrom.c
index 1888c5b..cacef9d 100644
--- a/drivers/mtd/maps/ichxrom.c
+++ b/drivers/mtd/maps/ichxrom.c
@@ -212,10 +212,8 @@ static int __init ichxrom_init_one(struct pci_dev *pdev,
 
if (!map) {
map = kmalloc(sizeof(*map), GFP_KERNEL);
-   }
-   if (!map) {
-   printk(KERN_ERR MOD_NAME ": kmalloc failed");
-   goto out;
+   if (!map)
+   goto out;
}
memset(map, 0, sizeof(*map));
INIT_LIST_HEAD(>list);
diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c
index 1e73bba..80a253c 100644
--- a/drivers/mtd/maps/sun_uflash.c
+++ b/drivers/mtd/maps/sun_uflash.c
@@ -62,10 +62,8 @@ int uflash_devinit(struct platform_device *op, struct 
device_node *dp)
}
 
up = kzalloc(sizeof(struct uflash_dev), GFP_KERNEL);
-   if (!up) {
-   printk(KERN_ERR PFX "Cannot allocate struct uflash_dev\n");
+   if (!up)
return -ENOMEM;
-   }
 
/* copy defaults and tweak parameters */
memcpy(>map, _map_templ, sizeof(uflash_map_templ));
diff --git a/drivers/mtd/maps/vmu-flash.c b/drivers/mtd/maps/vmu-flash.c
index 6b223cf..a76a5ff 100644
--- a/drivers/mtd/maps/vmu-flash.c
+++ b/drivers/mtd/maps/vmu-flash.c
@@ -130,9 +130,6 @@ static int maple_vmu_read_block(unsigned int num, unsigned 
char *buf,
if (!pcache->buffer) {
pcache->buffer = kmalloc(card->blocklen, GFP_KERNEL);
if (!pcache->buffer) {
-   dev_err(>dev, "VMU at (%d, %d) - read fails due"
-   " to lack of memory\n", mdev->port,
-   mdev->unit);
error = -ENOMEM;
goto outB;
}
-- 
2.7.4



[PATCH v2 1/2] mtd: maps: Remove print after allocation failure

2018-03-20 Thread Arushi Singhal
The prints after [k|v][m|z|c]alloc() functions are not needed, because
in case of failure, allocator will print their internal error prints
anyway.

Signed-off-by: Arushi Singhal 
---
changes in v2
* Prefered
if (!map) {
map = kmalloc();
if (!map)
err;
}

than

if (!map)
map = kmalloc();
if (!map)
err

 drivers/mtd/maps/amd76xrom.c  | 6 ++
 drivers/mtd/maps/ck804xrom.c  | 8 +++-
 drivers/mtd/maps/esb2rom.c| 7 +++
 drivers/mtd/maps/ichxrom.c| 6 ++
 drivers/mtd/maps/sun_uflash.c | 4 +---
 drivers/mtd/maps/vmu-flash.c  | 3 ---
 6 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/drivers/mtd/maps/amd76xrom.c b/drivers/mtd/maps/amd76xrom.c
index 26de0a1..406a8d3 100644
--- a/drivers/mtd/maps/amd76xrom.c
+++ b/drivers/mtd/maps/amd76xrom.c
@@ -188,10 +188,8 @@ static int amd76xrom_init_one(struct pci_dev *pdev,
 
if (!map) {
map = kmalloc(sizeof(*map), GFP_KERNEL);
-   }
-   if (!map) {
-   printk(KERN_ERR MOD_NAME ": kmalloc failed");
-   goto out;
+   if (!map)
+   goto out;
}
memset(map, 0, sizeof(*map));
INIT_LIST_HEAD(>list);
diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c
index 584962e..7377623 100644
--- a/drivers/mtd/maps/ck804xrom.c
+++ b/drivers/mtd/maps/ck804xrom.c
@@ -216,12 +216,10 @@ static int __init ck804xrom_init_one(struct pci_dev *pdev,
unsigned long offset;
int i;
 
-   if (!map)
-   map = kmalloc(sizeof(*map), GFP_KERNEL);
-
if (!map) {
-   printk(KERN_ERR MOD_NAME ": kmalloc failed");
-   goto out;
+   map = kmalloc(sizeof(*map), GFP_KERNEL);
+   if (!map)
+   goto out;
}
memset(map, 0, sizeof(*map));
INIT_LIST_HEAD(>list);
diff --git a/drivers/mtd/maps/esb2rom.c b/drivers/mtd/maps/esb2rom.c
index da9f6d7..2c63ecd 100644
--- a/drivers/mtd/maps/esb2rom.c
+++ b/drivers/mtd/maps/esb2rom.c
@@ -276,11 +276,10 @@ static int __init esb2rom_init_one(struct pci_dev *pdev,
unsigned long offset;
int i;
 
-   if (!map)
-   map = kmalloc(sizeof(*map), GFP_KERNEL);
if (!map) {
-   printk(KERN_ERR MOD_NAME ": kmalloc failed");
-   goto out;
+   map = kmalloc(sizeof(*map), GFP_KERNEL);
+   if (!map)
+   goto out;
}
memset(map, 0, sizeof(*map));
INIT_LIST_HEAD(>list);
diff --git a/drivers/mtd/maps/ichxrom.c b/drivers/mtd/maps/ichxrom.c
index 1888c5b..cacef9d 100644
--- a/drivers/mtd/maps/ichxrom.c
+++ b/drivers/mtd/maps/ichxrom.c
@@ -212,10 +212,8 @@ static int __init ichxrom_init_one(struct pci_dev *pdev,
 
if (!map) {
map = kmalloc(sizeof(*map), GFP_KERNEL);
-   }
-   if (!map) {
-   printk(KERN_ERR MOD_NAME ": kmalloc failed");
-   goto out;
+   if (!map)
+   goto out;
}
memset(map, 0, sizeof(*map));
INIT_LIST_HEAD(>list);
diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c
index 1e73bba..80a253c 100644
--- a/drivers/mtd/maps/sun_uflash.c
+++ b/drivers/mtd/maps/sun_uflash.c
@@ -62,10 +62,8 @@ int uflash_devinit(struct platform_device *op, struct 
device_node *dp)
}
 
up = kzalloc(sizeof(struct uflash_dev), GFP_KERNEL);
-   if (!up) {
-   printk(KERN_ERR PFX "Cannot allocate struct uflash_dev\n");
+   if (!up)
return -ENOMEM;
-   }
 
/* copy defaults and tweak parameters */
memcpy(>map, _map_templ, sizeof(uflash_map_templ));
diff --git a/drivers/mtd/maps/vmu-flash.c b/drivers/mtd/maps/vmu-flash.c
index 6b223cf..a76a5ff 100644
--- a/drivers/mtd/maps/vmu-flash.c
+++ b/drivers/mtd/maps/vmu-flash.c
@@ -130,9 +130,6 @@ static int maple_vmu_read_block(unsigned int num, unsigned 
char *buf,
if (!pcache->buffer) {
pcache->buffer = kmalloc(card->blocklen, GFP_KERNEL);
if (!pcache->buffer) {
-   dev_err(>dev, "VMU at (%d, %d) - read fails due"
-   " to lack of memory\n", mdev->port,
-   mdev->unit);
error = -ENOMEM;
goto outB;
}
-- 
2.7.4



[PATCH v2 2/2] mtd: nand: Remove print after allocation failure

2018-03-20 Thread Arushi Singhal
The prints after [k|v][m|z|c]alloc() etc. functions are not needed, because
in case of failure, allocator will print their internal error prints
anyway.

Signed-off-by: Arushi Singhal 
Reviewed-by: Miquel Raynal 
---
 drivers/mtd/nand/ams-delta.c |  1 -
 drivers/mtd/nand/atmel/nand-controller.c | 13 +++-
 drivers/mtd/nand/marvell_nand.c  |  8 ++--
 drivers/mtd/nand/nandsim.c   | 35 
 drivers/mtd/nand/ndfc.c  |  4 +---
 drivers/mtd/nand/sunxi_nand.c|  4 +---
 6 files changed, 15 insertions(+), 50 deletions(-)

diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 9de6572..6e7f6e0 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -185,7 +185,6 @@ static int ams_delta_init(struct platform_device *pdev)
/* Allocate memory for MTD device structure and private data */
this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
if (!this) {
-   printk (KERN_WARNING "Unable to allocate E3 NAND MTD device 
structure.\n");
err = -ENOMEM;
goto out;
}
diff --git a/drivers/mtd/nand/atmel/nand-controller.c 
b/drivers/mtd/nand/atmel/nand-controller.c
index b2f00b3..b973d42 100644
--- a/drivers/mtd/nand/atmel/nand-controller.c
+++ b/drivers/mtd/nand/atmel/nand-controller.c
@@ -1615,10 +1615,8 @@ static int atmel_nand_register(struct atmel_nand *nand)
mtd->name = devm_kasprintf(nc->dev, GFP_KERNEL,
   "%s:nand.%d", dev_name(nc->dev),
   nand->cs[0].id);
-   if (!mtd->name) {
-   dev_err(nc->dev, "Failed to allocate mtd->name\n");
+   if (!mtd->name)
return -ENOMEM;
-   }
}
 
ret = nand_scan_tail(mtd);
@@ -1657,10 +1655,8 @@ static struct atmel_nand *atmel_nand_create(struct 
atmel_nand_controller *nc,
nand = devm_kzalloc(nc->dev,
sizeof(*nand) + (numcs * sizeof(*nand->cs)),
GFP_KERNEL);
-   if (!nand) {
-   dev_err(nc->dev, "Failed to allocate NAND object\n");
+   if (!nand)
return ERR_PTR(-ENOMEM);
-   }
 
nand->numcs = numcs;
 
@@ -2217,11 +2213,8 @@ atmel_hsmc_nand_controller_init(struct 
atmel_hsmc_nand_controller *nc)
nc->sram.virt = gen_pool_dma_alloc(nc->sram.pool,
ATMEL_NFC_SRAM_SIZE,
>sram.dma);
-   if (!nc->sram.virt) {
-   dev_err(nc->base.dev,
-   "Could not allocate memory from the NFC SRAM pool\n");
+   if (!nc->sram.virt)
return -ENOMEM;
-   }
 
return 0;
 }
diff --git a/drivers/mtd/nand/marvell_nand.c b/drivers/mtd/nand/marvell_nand.c
index 2196f2a..9dd2673 100644
--- a/drivers/mtd/nand/marvell_nand.c
+++ b/drivers/mtd/nand/marvell_nand.c
@@ -2307,10 +2307,8 @@ static int marvell_nand_chip_init(struct device *dev, 
struct marvell_nfc *nfc,
(nsels *
 sizeof(struct marvell_nand_chip_sel)),
GFP_KERNEL);
-   if (!marvell_nand) {
-   dev_err(dev, "could not allocate chip structure\n");
+   if (!marvell_nand)
return -ENOMEM;
-   }
 
marvell_nand->nsels = nsels;
marvell_nand->selected_die = -1;
@@ -2506,10 +2504,8 @@ static int marvell_nand_chip_init(struct device *dev, 
struct marvell_nfc *nfc,
mtd->name = devm_kasprintf(nfc->dev, GFP_KERNEL,
   "%s:nand.%d", dev_name(nfc->dev),
   marvell_nand->sels[0].cs);
-   if (!mtd->name) {
-   dev_err(nfc->dev, "Failed to allocate mtd->name\n");
+   if (!mtd->name)
return -ENOMEM;
-   }
}
 
ret = nand_scan_tail(mtd);
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index 44322a3..b6a5c09 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -569,13 +569,11 @@ static int __init alloc_device(struct nandsim *ns)
ns->pages_written = vzalloc(BITS_TO_LONGS(ns->geom.pgnum) *
sizeof(unsigned long));
if (!ns->pages_written) {
-   NS_ERR("alloc_device: unable to allocate pages written 
array\n");
err = -ENOMEM;
goto err_close;
}
ns->file_buf = kmallo

[PATCH v2] mtd: chips: Replace printk() with more standardize output format

2018-03-20 Thread Arushi Singhal
printk() is the raw way to print output and should be avoided.

For drivers with defined "struct device object", dev_*macro() is
prefer to standardize the output format within the subsystem.

If no "struct device object" is defined prefer pr_*macro() over
printk().

This patch Replace printk having a log level with the appropriate output
format according to the order of preference.

Change string explicitly mentioning function name to "%s...", __func__.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
changes in v2
*if "struct device object" is defined prefered dev_*macro() over
pr_*macro().

 drivers/mtd/chips/cfi_cmdset_0001.c | 127 +++-
 1 file changed, 66 insertions(+), 61 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c 
b/drivers/mtd/chips/cfi_cmdset_0001.c
index 5e1b68c..18f24ce 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -182,7 +182,7 @@ static void fixup_convert_atmel_pri(struct mtd_info *mtd)
memcpy(_pri, extp, sizeof(atmel_pri));
memset((char *)extp + 5, 0, sizeof(*extp) - 5);
 
-   printk(KERN_ERR "atmel Features: %02x\n", atmel_pri.Features);
+   dev_err(>dev, "atmel Features: %02x\n", atmel_pri.Features);
 
if (atmel_pri.Features & 0x01) /* chip erase supported */
features |= (1<<0);
@@ -224,8 +224,7 @@ static void fixup_intel_strataflash(struct mtd_info *mtd)
struct cfi_private *cfi = map->fldrv_priv;
struct cfi_pri_intelext *extp = cfi->cmdset_priv;
 
-   printk(KERN_WARNING "cfi_cmdset_0001: Suspend "
-   "erase on write disabled.\n");
+   dev_warn(>dev, "cfi_cmdset_0001: Suspend erase on write 
disabled\n");
extp->SuspendCmdSupport &= ~1;
 }
 #endif
@@ -239,7 +238,7 @@ static void fixup_no_write_suspend(struct mtd_info *mtd)
 
if (cfip && (cfip->FeatureSupport&4)) {
cfip->FeatureSupport &= ~4;
-   printk(KERN_WARNING "cfi_cmdset_0001: write suspend 
disabled\n");
+   dev_warn(>dev, "cfi_cmdset_0001: write suspend 
disabled\n");
}
 }
 #endif
@@ -282,13 +281,13 @@ static void fixup_LH28F640BF(struct mtd_info *mtd)
/* Reset the Partition Configuration Register on LH28F640BF
 * to a single partition (PCR = 0x000): PCR is embedded into A0-A15. */
if (is_LH28F640BF(cfi)) {
-   printk(KERN_INFO "Reset Partition Config. Register: 1 Partition 
of 4 planes\n");
+   dev_info(>dev, "Reset Partition Config. Register: 1 
Partition of 4 planes\n");
map_write(map, CMD(0x60), 0);
map_write(map, CMD(0x04), 0);
 
/* We have set one single partition thus
 * Simultaneous Operations are not allowed */
-   printk(KERN_INFO "cfi_cmdset_0001: Simultaneous Operations 
disabled\n");
+   dev_info(>dev, "cfi_cmdset_0001: Simultaneous Operations 
disabled\n");
extp->FeatureSupport &= ~512;
}
 }
@@ -307,7 +306,7 @@ static void fixup_use_write_buffers(struct mtd_info *mtd)
struct map_info *map = mtd->priv;
struct cfi_private *cfi = map->fldrv_priv;
if (cfi->cfiq->BufWriteTimeoutTyp) {
-   printk(KERN_INFO "Using buffer write method\n" );
+   dev_info(>dev, "Using buffer write method\n");
mtd->_write = cfi_intelext_write_buffers;
mtd->_writev = cfi_intelext_writev;
}
@@ -323,7 +322,7 @@ static void fixup_unlock_powerup_lock(struct mtd_info *mtd)
struct cfi_pri_intelext *cfip = cfi->cmdset_priv;
 
if (cfip->FeatureSupport&32) {
-   printk(KERN_INFO "Using auto-unlock on power-up/resume\n" );
+   dev_info(>dev, "Using auto-unlock on power-up/resume\n");
mtd->flags |= MTD_POWERUP_LOCK;
}
 }
@@ -392,9 +391,8 @@ read_pri_intelext(struct map_info *map, __u16 adr)
 
if (extp->MajorVersion != '1' ||
(extp->MinorVersion < '0' || extp->MinorVersion > '5')) {
-   printk(KERN_ERR "  Unknown Intel/Sharp Extended Query "
-  "version %c.%c.\n",  extp->MajorVersion,
-  extp->MinorVersion);
+   pr_err("Unknown Intel/Sharp Extended Query version %c.%c\n",
+  extp->MajorVersion, extp->MinorVersion);
kfree(extp);
return NULL;
}
@@ -452,9 +450,8 @@ read_pri_intelext(struct map_info *map, __u16 adr)
extp_size = sizeo

[PATCH v2] mtd: chips: Replace printk() with more standardize output format

2018-03-20 Thread Arushi Singhal
printk() is the raw way to print output and should be avoided.

For drivers with defined "struct device object", dev_*macro() is
prefer to standardize the output format within the subsystem.

If no "struct device object" is defined prefer pr_*macro() over
printk().

This patch Replace printk having a log level with the appropriate output
format according to the order of preference.

Change string explicitly mentioning function name to "%s...", __func__.

Signed-off-by: Arushi Singhal 
---
changes in v2
*if "struct device object" is defined prefered dev_*macro() over
pr_*macro().

 drivers/mtd/chips/cfi_cmdset_0001.c | 127 +++-
 1 file changed, 66 insertions(+), 61 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c 
b/drivers/mtd/chips/cfi_cmdset_0001.c
index 5e1b68c..18f24ce 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -182,7 +182,7 @@ static void fixup_convert_atmel_pri(struct mtd_info *mtd)
memcpy(_pri, extp, sizeof(atmel_pri));
memset((char *)extp + 5, 0, sizeof(*extp) - 5);
 
-   printk(KERN_ERR "atmel Features: %02x\n", atmel_pri.Features);
+   dev_err(>dev, "atmel Features: %02x\n", atmel_pri.Features);
 
if (atmel_pri.Features & 0x01) /* chip erase supported */
features |= (1<<0);
@@ -224,8 +224,7 @@ static void fixup_intel_strataflash(struct mtd_info *mtd)
struct cfi_private *cfi = map->fldrv_priv;
struct cfi_pri_intelext *extp = cfi->cmdset_priv;
 
-   printk(KERN_WARNING "cfi_cmdset_0001: Suspend "
-   "erase on write disabled.\n");
+   dev_warn(>dev, "cfi_cmdset_0001: Suspend erase on write 
disabled\n");
extp->SuspendCmdSupport &= ~1;
 }
 #endif
@@ -239,7 +238,7 @@ static void fixup_no_write_suspend(struct mtd_info *mtd)
 
if (cfip && (cfip->FeatureSupport&4)) {
cfip->FeatureSupport &= ~4;
-   printk(KERN_WARNING "cfi_cmdset_0001: write suspend 
disabled\n");
+   dev_warn(>dev, "cfi_cmdset_0001: write suspend 
disabled\n");
}
 }
 #endif
@@ -282,13 +281,13 @@ static void fixup_LH28F640BF(struct mtd_info *mtd)
/* Reset the Partition Configuration Register on LH28F640BF
 * to a single partition (PCR = 0x000): PCR is embedded into A0-A15. */
if (is_LH28F640BF(cfi)) {
-   printk(KERN_INFO "Reset Partition Config. Register: 1 Partition 
of 4 planes\n");
+   dev_info(>dev, "Reset Partition Config. Register: 1 
Partition of 4 planes\n");
map_write(map, CMD(0x60), 0);
map_write(map, CMD(0x04), 0);
 
/* We have set one single partition thus
 * Simultaneous Operations are not allowed */
-   printk(KERN_INFO "cfi_cmdset_0001: Simultaneous Operations 
disabled\n");
+   dev_info(>dev, "cfi_cmdset_0001: Simultaneous Operations 
disabled\n");
extp->FeatureSupport &= ~512;
}
 }
@@ -307,7 +306,7 @@ static void fixup_use_write_buffers(struct mtd_info *mtd)
struct map_info *map = mtd->priv;
struct cfi_private *cfi = map->fldrv_priv;
if (cfi->cfiq->BufWriteTimeoutTyp) {
-   printk(KERN_INFO "Using buffer write method\n" );
+   dev_info(>dev, "Using buffer write method\n");
mtd->_write = cfi_intelext_write_buffers;
mtd->_writev = cfi_intelext_writev;
}
@@ -323,7 +322,7 @@ static void fixup_unlock_powerup_lock(struct mtd_info *mtd)
struct cfi_pri_intelext *cfip = cfi->cmdset_priv;
 
if (cfip->FeatureSupport&32) {
-   printk(KERN_INFO "Using auto-unlock on power-up/resume\n" );
+   dev_info(>dev, "Using auto-unlock on power-up/resume\n");
mtd->flags |= MTD_POWERUP_LOCK;
}
 }
@@ -392,9 +391,8 @@ read_pri_intelext(struct map_info *map, __u16 adr)
 
if (extp->MajorVersion != '1' ||
(extp->MinorVersion < '0' || extp->MinorVersion > '5')) {
-   printk(KERN_ERR "  Unknown Intel/Sharp Extended Query "
-  "version %c.%c.\n",  extp->MajorVersion,
-  extp->MinorVersion);
+   pr_err("Unknown Intel/Sharp Extended Query version %c.%c\n",
+  extp->MajorVersion, extp->MinorVersion);
kfree(extp);
return NULL;
}
@@ -452,9 +450,8 @@ read_pri_intelext(struct map_info *map, __u16 adr)
extp_size = sizeof(*extp) + extra_size;
kfree(ext

[PATCH v2] mtd: Replace printk() with more standardize output format

2018-03-19 Thread Arushi Singhal
printk() is the raw way to print output and should be avoided.

For drivers with defined "struct device object", dev_*macro() is
prefer to standardize the output format within the subsystem.

If no "struct device object" is defined prefer pr_*macro() over
printk().

This patch Replace printk having a log level with the appropriate output
format according to the order of preference.

Change string explicitly mentioning function name to "%s...", __func__.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
changes in v2
*Change string explicitly mentioning function name to "%s...", __func__.
*merge quoted string split across lines.
*Cc'ed outreachy mailing list

 drivers/mtd/ftl.c | 108 --
 1 file changed, 47 insertions(+), 61 deletions(-)

diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index 664d206..a048429 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -177,18 +177,18 @@ static int scan_header(partition_t *part)
 }
 
 if (offset == max_offset) {
-   printk(KERN_NOTICE "ftl_cs: FTL header not found.\n");
+   pr_notice("ftl_cs: FTL header not found.\n");
return -ENOENT;
 }
 if (header.BlockSize != 9 ||
(header.EraseUnitSize < 10) || (header.EraseUnitSize > 31) ||
(header.NumTransferUnits >= le16_to_cpu(header.NumEraseUnits))) {
-   printk(KERN_NOTICE "ftl_cs: FTL header corrupt!\n");
+   pr_notice("ftl_cs: FTL header corrupt!\n");
return -1;
 }
 if ((1 << header.EraseUnitSize) != part->mbd.mtd->erasesize) {
-   printk(KERN_NOTICE "ftl: FTL EraseUnitSize %x != MTD erasesize %x\n",
-  1 << header.EraseUnitSize,part->mbd.mtd->erasesize);
+   pr_notice("ftl: FTL EraseUnitSize %x != MTD erasesize %x\n",
+ 1 << header.EraseUnitSize, part->mbd.mtd->erasesize);
return -1;
 }
 part->header = header;
@@ -240,8 +240,7 @@ static int build_maps(partition_t *part)
xvalid++;
} else {
if (xtrans == part->header.NumTransferUnits) {
-   printk(KERN_NOTICE "ftl_cs: format error: too many "
-  "transfer units!\n");
+   pr_notice("ftl_cs: format error: too many transfer units!\n");
goto out_XferInfo;
}
if (hdr_ok && (le16_to_cpu(header.LogicalEUN) == 0x)) {
@@ -261,8 +260,7 @@ static int build_maps(partition_t *part)
 header = part->header;
 if ((xtrans != header.NumTransferUnits) ||
(xvalid+xtrans != le16_to_cpu(header.NumEraseUnits))) {
-   printk(KERN_NOTICE "ftl_cs: format error: erase units "
-  "don't add up!\n");
+   pr_notice("ftl_cs: format error: erase units don't add up!\n");
goto out_XferInfo;
 }
 
@@ -384,8 +382,7 @@ static void ftl_erase_callback(struct erase_info *erase)
if (part->XferInfo[i].Offset == erase->addr) break;
 
 if (i == part->header.NumTransferUnits) {
-   printk(KERN_NOTICE "ftl_cs: internal error: "
-  "erase lookup failed!\n");
+   pr_notice("ftl_cs: internal error: erase lookup failed!\n");
return;
 }
 
@@ -394,8 +391,7 @@ static void ftl_erase_callback(struct erase_info *erase)
xfer->state = XFER_ERASED;
 else {
xfer->state = XFER_FAILED;
-   printk(KERN_NOTICE "ftl_cs: erase failed: state = %d\n",
-  erase->state);
+   pr_notice("ftl_cs: erase failed: state = %d\n", erase->state);
 }
 
 kfree(erase);
@@ -492,7 +488,7 @@ static int copy_erase_unit(partition_t *part, uint16_t 
srcunit,
part->bam_index = 0x;
 
if (ret) {
-   printk( KERN_WARNING "ftl: Failed to read BAM cache in 
copy_erase_unit()!\n");
+   pr_warn("ftl: Failed to read BAM cache in %s()!\n", __func__);
return ret;
}
 }
@@ -506,7 +502,7 @@ static int copy_erase_unit(partition_t *part, uint16_t 
srcunit,
 (u_char *));
 
 if (ret) {
-   printk( KERN_WARNING "ftl: Failed to write back to BAM cache in 
copy_erase_unit()!\n");
+   pr_warn("ftl: Failed to write back to BAM cache in %s()!\n", __func__);
return ret;
 }
 
@@ -525,7 +521,7 @@ static int copy_erase_unit(partition_t *part, uint16_t 
srcunit,
ret = mtd_read(part->mbd.mtd, src, SECTOR_SIZE, ,
(u_char *)buf);
if (ret) {
-   printk(KERN_WARNING "ftl: Error reading old xfer unit in 
copy_erase_unit\n");
+   pr_warn("ftl: Error reading old xfer unit in %s\n", __func__);

[PATCH v2] mtd: Replace printk() with more standardize output format

2018-03-19 Thread Arushi Singhal
printk() is the raw way to print output and should be avoided.

For drivers with defined "struct device object", dev_*macro() is
prefer to standardize the output format within the subsystem.

If no "struct device object" is defined prefer pr_*macro() over
printk().

This patch Replace printk having a log level with the appropriate output
format according to the order of preference.

Change string explicitly mentioning function name to "%s...", __func__.

Signed-off-by: Arushi Singhal 
---
changes in v2
*Change string explicitly mentioning function name to "%s...", __func__.
*merge quoted string split across lines.
*Cc'ed outreachy mailing list

 drivers/mtd/ftl.c | 108 --
 1 file changed, 47 insertions(+), 61 deletions(-)

diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index 664d206..a048429 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -177,18 +177,18 @@ static int scan_header(partition_t *part)
 }
 
 if (offset == max_offset) {
-   printk(KERN_NOTICE "ftl_cs: FTL header not found.\n");
+   pr_notice("ftl_cs: FTL header not found.\n");
return -ENOENT;
 }
 if (header.BlockSize != 9 ||
(header.EraseUnitSize < 10) || (header.EraseUnitSize > 31) ||
(header.NumTransferUnits >= le16_to_cpu(header.NumEraseUnits))) {
-   printk(KERN_NOTICE "ftl_cs: FTL header corrupt!\n");
+   pr_notice("ftl_cs: FTL header corrupt!\n");
return -1;
 }
 if ((1 << header.EraseUnitSize) != part->mbd.mtd->erasesize) {
-   printk(KERN_NOTICE "ftl: FTL EraseUnitSize %x != MTD erasesize %x\n",
-  1 << header.EraseUnitSize,part->mbd.mtd->erasesize);
+   pr_notice("ftl: FTL EraseUnitSize %x != MTD erasesize %x\n",
+ 1 << header.EraseUnitSize, part->mbd.mtd->erasesize);
return -1;
 }
 part->header = header;
@@ -240,8 +240,7 @@ static int build_maps(partition_t *part)
xvalid++;
} else {
if (xtrans == part->header.NumTransferUnits) {
-   printk(KERN_NOTICE "ftl_cs: format error: too many "
-  "transfer units!\n");
+   pr_notice("ftl_cs: format error: too many transfer units!\n");
goto out_XferInfo;
}
if (hdr_ok && (le16_to_cpu(header.LogicalEUN) == 0x)) {
@@ -261,8 +260,7 @@ static int build_maps(partition_t *part)
 header = part->header;
 if ((xtrans != header.NumTransferUnits) ||
(xvalid+xtrans != le16_to_cpu(header.NumEraseUnits))) {
-   printk(KERN_NOTICE "ftl_cs: format error: erase units "
-  "don't add up!\n");
+   pr_notice("ftl_cs: format error: erase units don't add up!\n");
goto out_XferInfo;
 }
 
@@ -384,8 +382,7 @@ static void ftl_erase_callback(struct erase_info *erase)
if (part->XferInfo[i].Offset == erase->addr) break;
 
 if (i == part->header.NumTransferUnits) {
-   printk(KERN_NOTICE "ftl_cs: internal error: "
-  "erase lookup failed!\n");
+   pr_notice("ftl_cs: internal error: erase lookup failed!\n");
return;
 }
 
@@ -394,8 +391,7 @@ static void ftl_erase_callback(struct erase_info *erase)
xfer->state = XFER_ERASED;
 else {
xfer->state = XFER_FAILED;
-   printk(KERN_NOTICE "ftl_cs: erase failed: state = %d\n",
-  erase->state);
+   pr_notice("ftl_cs: erase failed: state = %d\n", erase->state);
 }
 
 kfree(erase);
@@ -492,7 +488,7 @@ static int copy_erase_unit(partition_t *part, uint16_t 
srcunit,
part->bam_index = 0x;
 
if (ret) {
-   printk( KERN_WARNING "ftl: Failed to read BAM cache in 
copy_erase_unit()!\n");
+   pr_warn("ftl: Failed to read BAM cache in %s()!\n", __func__);
return ret;
}
 }
@@ -506,7 +502,7 @@ static int copy_erase_unit(partition_t *part, uint16_t 
srcunit,
 (u_char *));
 
 if (ret) {
-   printk( KERN_WARNING "ftl: Failed to write back to BAM cache in 
copy_erase_unit()!\n");
+   pr_warn("ftl: Failed to write back to BAM cache in %s()!\n", __func__);
return ret;
 }
 
@@ -525,7 +521,7 @@ static int copy_erase_unit(partition_t *part, uint16_t 
srcunit,
ret = mtd_read(part->mbd.mtd, src, SECTOR_SIZE, ,
(u_char *)buf);
if (ret) {
-   printk(KERN_WARNING "ftl: Error reading old xfer unit in 
copy_erase_unit\n");
+   pr_warn("ftl: Error reading old xfer unit in %s\n", __func__);
return ret;
 }
 
@@ -533,7 +

[PATCH] gpu: drm: Use list_{next/prev}_entry instead of list_entry

2018-03-18 Thread Arushi Singhal
This patch replace list_entry with list_{next/prev}_entry as it makes
the code more clear to read.
Done using coccinelle:

@@
expression e1;
identifier e3;
type t;
@@
(
- list_entry(e1->e3.next,t,e3)
+ list_next_entry(e1,e3)
|
- list_entry(e1->e3.prev,t,e3)
+ list_prev_entry(e1,e3)
)

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/gpu/drm/drm_lease.c| 2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
index 1402c0e..4dcfb5f 100644
--- a/drivers/gpu/drm/drm_lease.c
+++ b/drivers/gpu/drm/drm_lease.c
@@ -340,7 +340,7 @@ static void _drm_lease_revoke(struct drm_master *top)
break;
 
/* Over */
-   master = list_entry(master->lessee_list.next, struct 
drm_master, lessee_list);
+   master = list_next_entry(master, lessee_list);
}
}
 }
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
index e4c8d31..81c3567 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
@@ -134,7 +134,7 @@ nvkm_cstate_find_best(struct nvkm_clk *clk, struct 
nvkm_pstate *pstate,
   nvkm_volt_map(volt, volt->max2_id, clk->temp));
 
for (cstate = start; >head != >list;
-cstate = list_entry(cstate->head.prev, typeof(*cstate), head)) {
+cstate = list_prev_entry(cstate, head)) {
if (nvkm_cstate_valid(clk, cstate, max_volt, clk->temp))
break;
}
-- 
2.7.4



[PATCH] gpu: drm: Use list_{next/prev}_entry instead of list_entry

2018-03-18 Thread Arushi Singhal
This patch replace list_entry with list_{next/prev}_entry as it makes
the code more clear to read.
Done using coccinelle:

@@
expression e1;
identifier e3;
type t;
@@
(
- list_entry(e1->e3.next,t,e3)
+ list_next_entry(e1,e3)
|
- list_entry(e1->e3.prev,t,e3)
+ list_prev_entry(e1,e3)
)

Signed-off-by: Arushi Singhal 
---
 drivers/gpu/drm/drm_lease.c| 2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
index 1402c0e..4dcfb5f 100644
--- a/drivers/gpu/drm/drm_lease.c
+++ b/drivers/gpu/drm/drm_lease.c
@@ -340,7 +340,7 @@ static void _drm_lease_revoke(struct drm_master *top)
break;
 
/* Over */
-   master = list_entry(master->lessee_list.next, struct 
drm_master, lessee_list);
+   master = list_next_entry(master, lessee_list);
}
}
 }
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
index e4c8d31..81c3567 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
@@ -134,7 +134,7 @@ nvkm_cstate_find_best(struct nvkm_clk *clk, struct 
nvkm_pstate *pstate,
   nvkm_volt_map(volt, volt->max2_id, clk->temp));
 
for (cstate = start; >head != >list;
-cstate = list_entry(cstate->head.prev, typeof(*cstate), head)) {
+cstate = list_prev_entry(cstate, head)) {
if (nvkm_cstate_valid(clk, cstate, max_volt, clk->temp))
break;
}
-- 
2.7.4



[PATCH] gpu: drm: Use list_first_entry instead of list_entry

2018-03-18 Thread Arushi Singhal
This patch replaces list_entry with list_first_entry as it makes the
code more clear.
Done using coccinelle:

@@
expression e;
@@
(
- list_entry(e->next,
+ list_first_entry(e,
  ...)
|
- list_entry(e->prev,
+ list_last_entry(e,
  ...)
)

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c | 4 ++--
 drivers/gpu/drm/omapdrm/dss/display.c  | 4 ++--
 drivers/gpu/drm/radeon/radeon_sa.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
index 3144400..646f593 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
@@ -158,7 +158,7 @@ static void amdgpu_sa_bo_try_free(struct amdgpu_sa_manager 
*sa_manager)
if (sa_manager->hole->next == _manager->olist)
return;
 
-   sa_bo = list_entry(sa_manager->hole->next, struct amdgpu_sa_bo, olist);
+   sa_bo = list_first_entry(sa_manager->hole, struct amdgpu_sa_bo, olist);
list_for_each_entry_safe_from(sa_bo, tmp, _manager->olist, olist) {
if (sa_bo->fence == NULL ||
!dma_fence_is_signaled(sa_bo->fence)) {
@@ -183,7 +183,7 @@ static inline unsigned amdgpu_sa_bo_hole_eoffset(struct 
amdgpu_sa_manager *sa_ma
struct list_head *hole = sa_manager->hole;
 
if (hole->next != _manager->olist) {
-   return list_entry(hole->next, struct amdgpu_sa_bo, 
olist)->soffset;
+   return list_first_entry(hole, struct amdgpu_sa_bo, 
olist)->soffset;
}
return sa_manager->size;
 }
diff --git a/drivers/gpu/drm/omapdrm/dss/display.c 
b/drivers/gpu/drm/omapdrm/dss/display.c
index 0c9480b..fb9ecae 100644
--- a/drivers/gpu/drm/omapdrm/dss/display.c
+++ b/drivers/gpu/drm/omapdrm/dss/display.c
@@ -158,8 +158,8 @@ struct omap_dss_device *omap_dss_get_next_device(struct 
omap_dss_device *from)
goto out;
}
 
-   dssdev = list_entry(l->next, struct omap_dss_device,
-   panel_list);
+   dssdev = list_first_entry(l, struct omap_dss_device,
+ panel_list);
omap_dss_get_device(dssdev);
goto out;
}
diff --git a/drivers/gpu/drm/radeon/radeon_sa.c 
b/drivers/gpu/drm/radeon/radeon_sa.c
index 197b157..66c0482 100644
--- a/drivers/gpu/drm/radeon/radeon_sa.c
+++ b/drivers/gpu/drm/radeon/radeon_sa.c
@@ -158,7 +158,7 @@ static void radeon_sa_bo_try_free(struct radeon_sa_manager 
*sa_manager)
if (sa_manager->hole->next == _manager->olist)
return;
 
-   sa_bo = list_entry(sa_manager->hole->next, struct radeon_sa_bo, olist);
+   sa_bo = list_first_entry(sa_manager->hole, struct radeon_sa_bo, olist);
list_for_each_entry_safe_from(sa_bo, tmp, _manager->olist, olist) {
if (sa_bo->fence == NULL || 
!radeon_fence_signaled(sa_bo->fence)) {
return;
@@ -182,7 +182,7 @@ static inline unsigned radeon_sa_bo_hole_eoffset(struct 
radeon_sa_manager *sa_ma
struct list_head *hole = sa_manager->hole;
 
if (hole->next != _manager->olist) {
-   return list_entry(hole->next, struct radeon_sa_bo, 
olist)->soffset;
+   return list_first_entry(hole, struct radeon_sa_bo, 
olist)->soffset;
}
return sa_manager->size;
 }
-- 
2.7.4



[PATCH] gpu: drm: Use list_first_entry instead of list_entry

2018-03-18 Thread Arushi Singhal
This patch replaces list_entry with list_first_entry as it makes the
code more clear.
Done using coccinelle:

@@
expression e;
@@
(
- list_entry(e->next,
+ list_first_entry(e,
  ...)
|
- list_entry(e->prev,
+ list_last_entry(e,
  ...)
)

Signed-off-by: Arushi Singhal 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c | 4 ++--
 drivers/gpu/drm/omapdrm/dss/display.c  | 4 ++--
 drivers/gpu/drm/radeon/radeon_sa.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
index 3144400..646f593 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
@@ -158,7 +158,7 @@ static void amdgpu_sa_bo_try_free(struct amdgpu_sa_manager 
*sa_manager)
if (sa_manager->hole->next == _manager->olist)
return;
 
-   sa_bo = list_entry(sa_manager->hole->next, struct amdgpu_sa_bo, olist);
+   sa_bo = list_first_entry(sa_manager->hole, struct amdgpu_sa_bo, olist);
list_for_each_entry_safe_from(sa_bo, tmp, _manager->olist, olist) {
if (sa_bo->fence == NULL ||
!dma_fence_is_signaled(sa_bo->fence)) {
@@ -183,7 +183,7 @@ static inline unsigned amdgpu_sa_bo_hole_eoffset(struct 
amdgpu_sa_manager *sa_ma
struct list_head *hole = sa_manager->hole;
 
if (hole->next != _manager->olist) {
-   return list_entry(hole->next, struct amdgpu_sa_bo, 
olist)->soffset;
+   return list_first_entry(hole, struct amdgpu_sa_bo, 
olist)->soffset;
}
return sa_manager->size;
 }
diff --git a/drivers/gpu/drm/omapdrm/dss/display.c 
b/drivers/gpu/drm/omapdrm/dss/display.c
index 0c9480b..fb9ecae 100644
--- a/drivers/gpu/drm/omapdrm/dss/display.c
+++ b/drivers/gpu/drm/omapdrm/dss/display.c
@@ -158,8 +158,8 @@ struct omap_dss_device *omap_dss_get_next_device(struct 
omap_dss_device *from)
goto out;
}
 
-   dssdev = list_entry(l->next, struct omap_dss_device,
-   panel_list);
+   dssdev = list_first_entry(l, struct omap_dss_device,
+ panel_list);
omap_dss_get_device(dssdev);
goto out;
}
diff --git a/drivers/gpu/drm/radeon/radeon_sa.c 
b/drivers/gpu/drm/radeon/radeon_sa.c
index 197b157..66c0482 100644
--- a/drivers/gpu/drm/radeon/radeon_sa.c
+++ b/drivers/gpu/drm/radeon/radeon_sa.c
@@ -158,7 +158,7 @@ static void radeon_sa_bo_try_free(struct radeon_sa_manager 
*sa_manager)
if (sa_manager->hole->next == _manager->olist)
return;
 
-   sa_bo = list_entry(sa_manager->hole->next, struct radeon_sa_bo, olist);
+   sa_bo = list_first_entry(sa_manager->hole, struct radeon_sa_bo, olist);
list_for_each_entry_safe_from(sa_bo, tmp, _manager->olist, olist) {
if (sa_bo->fence == NULL || 
!radeon_fence_signaled(sa_bo->fence)) {
return;
@@ -182,7 +182,7 @@ static inline unsigned radeon_sa_bo_hole_eoffset(struct 
radeon_sa_manager *sa_ma
struct list_head *hole = sa_manager->hole;
 
if (hole->next != _manager->olist) {
-   return list_entry(hole->next, struct radeon_sa_bo, 
olist)->soffset;
+   return list_first_entry(hole, struct radeon_sa_bo, 
olist)->soffset;
}
return sa_manager->size;
 }
-- 
2.7.4



[PATCH] mtd: Replace typedef with struct

2018-03-18 Thread Arushi Singhal
Using typedef for a structure type is not suggested in Linux kernel
coding style guidelines. Hence, occurrence of typedefs has been
removed.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/mtd/ssfdc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/ssfdc.c b/drivers/mtd/ssfdc.c
index 95f0bf9..8bae672 100644
--- a/drivers/mtd/ssfdc.c
+++ b/drivers/mtd/ssfdc.c
@@ -54,15 +54,15 @@ SumSector   2,000   4,000   8,000   16,000  32,000  64,000  
128,000 256,000
 SectorSize 512 512 512 512 512 512 512 512
 **/
 
-typedef struct {
+struct chs_entry {
unsigned long size;
unsigned short cyl;
unsigned char head;
unsigned char sec;
-} chs_entry_t;
+};
 
 /* Must be ordered by size */
-static const chs_entry_t chs_table[] = {
+static const struct chs_entry chs_table[] = {
{ MiB(  1), 125,  4,  4 },
{ MiB(  2), 125,  4,  8 },
{ MiB(  4), 250,  4,  8 },
-- 
2.7.4



[PATCH] mtd: Replace typedef with struct

2018-03-18 Thread Arushi Singhal
Using typedef for a structure type is not suggested in Linux kernel
coding style guidelines. Hence, occurrence of typedefs has been
removed.

Signed-off-by: Arushi Singhal 
---
 drivers/mtd/ssfdc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/ssfdc.c b/drivers/mtd/ssfdc.c
index 95f0bf9..8bae672 100644
--- a/drivers/mtd/ssfdc.c
+++ b/drivers/mtd/ssfdc.c
@@ -54,15 +54,15 @@ SumSector   2,000   4,000   8,000   16,000  32,000  64,000  
128,000 256,000
 SectorSize 512 512 512 512 512 512 512 512
 **/
 
-typedef struct {
+struct chs_entry {
unsigned long size;
unsigned short cyl;
unsigned char head;
unsigned char sec;
-} chs_entry_t;
+};
 
 /* Must be ordered by size */
-static const chs_entry_t chs_table[] = {
+static const struct chs_entry chs_table[] = {
{ MiB(  1), 125,  4,  4 },
{ MiB(  2), 125,  4,  8 },
{ MiB(  4), 250,  4,  8 },
-- 
2.7.4



[PATCH v2 1/2] mtd: maps: Remove print after allocation failure

2018-03-18 Thread Arushi Singhal
The prints after [k|v][m|z|c]alloc() functions are not needed, because
in case of failure, allocator will print their internal error prints
anyway.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
changes in v2
* done changes in all the other files.

 drivers/mtd/maps/amd76xrom.c  | 6 ++
 drivers/mtd/maps/ck804xrom.c  | 4 +---
 drivers/mtd/maps/esb2rom.c| 4 +---
 drivers/mtd/maps/ichxrom.c| 6 ++
 drivers/mtd/maps/sun_uflash.c | 4 +---
 drivers/mtd/maps/vmu-flash.c  | 3 ---
 6 files changed, 7 insertions(+), 20 deletions(-)

diff --git a/drivers/mtd/maps/amd76xrom.c b/drivers/mtd/maps/amd76xrom.c
index 26de0a1..406a8d3 100644
--- a/drivers/mtd/maps/amd76xrom.c
+++ b/drivers/mtd/maps/amd76xrom.c
@@ -188,10 +188,8 @@ static int amd76xrom_init_one(struct pci_dev *pdev,
 
if (!map) {
map = kmalloc(sizeof(*map), GFP_KERNEL);
-   }
-   if (!map) {
-   printk(KERN_ERR MOD_NAME ": kmalloc failed");
-   goto out;
+   if (!map)
+   goto out;
}
memset(map, 0, sizeof(*map));
INIT_LIST_HEAD(>list);
diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c
index 584962e..2529d1b 100644
--- a/drivers/mtd/maps/ck804xrom.c
+++ b/drivers/mtd/maps/ck804xrom.c
@@ -219,10 +219,8 @@ static int __init ck804xrom_init_one(struct pci_dev *pdev,
if (!map)
map = kmalloc(sizeof(*map), GFP_KERNEL);
 
-   if (!map) {
-   printk(KERN_ERR MOD_NAME ": kmalloc failed");
+   if (!map)
goto out;
-   }
memset(map, 0, sizeof(*map));
INIT_LIST_HEAD(>list);
map->map.name = map->map_name;
diff --git a/drivers/mtd/maps/esb2rom.c b/drivers/mtd/maps/esb2rom.c
index da9f6d7..e50f1a4 100644
--- a/drivers/mtd/maps/esb2rom.c
+++ b/drivers/mtd/maps/esb2rom.c
@@ -278,10 +278,8 @@ static int __init esb2rom_init_one(struct pci_dev *pdev,
 
if (!map)
map = kmalloc(sizeof(*map), GFP_KERNEL);
-   if (!map) {
-   printk(KERN_ERR MOD_NAME ": kmalloc failed");
+   if (!map)
goto out;
-   }
memset(map, 0, sizeof(*map));
INIT_LIST_HEAD(>list);
map->map.name = map->map_name;
diff --git a/drivers/mtd/maps/ichxrom.c b/drivers/mtd/maps/ichxrom.c
index 1888c5b..cacef9d 100644
--- a/drivers/mtd/maps/ichxrom.c
+++ b/drivers/mtd/maps/ichxrom.c
@@ -212,10 +212,8 @@ static int __init ichxrom_init_one(struct pci_dev *pdev,
 
if (!map) {
map = kmalloc(sizeof(*map), GFP_KERNEL);
-   }
-   if (!map) {
-   printk(KERN_ERR MOD_NAME ": kmalloc failed");
-   goto out;
+   if (!map)
+   goto out;
}
memset(map, 0, sizeof(*map));
INIT_LIST_HEAD(>list);
diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c
index 1e73bba..80a253c 100644
--- a/drivers/mtd/maps/sun_uflash.c
+++ b/drivers/mtd/maps/sun_uflash.c
@@ -62,10 +62,8 @@ int uflash_devinit(struct platform_device *op, struct 
device_node *dp)
}
 
up = kzalloc(sizeof(struct uflash_dev), GFP_KERNEL);
-   if (!up) {
-   printk(KERN_ERR PFX "Cannot allocate struct uflash_dev\n");
+   if (!up)
return -ENOMEM;
-   }
 
/* copy defaults and tweak parameters */
memcpy(>map, _map_templ, sizeof(uflash_map_templ));
diff --git a/drivers/mtd/maps/vmu-flash.c b/drivers/mtd/maps/vmu-flash.c
index 6b223cf..a76a5ff 100644
--- a/drivers/mtd/maps/vmu-flash.c
+++ b/drivers/mtd/maps/vmu-flash.c
@@ -130,9 +130,6 @@ static int maple_vmu_read_block(unsigned int num, unsigned 
char *buf,
if (!pcache->buffer) {
pcache->buffer = kmalloc(card->blocklen, GFP_KERNEL);
if (!pcache->buffer) {
-   dev_err(>dev, "VMU at (%d, %d) - read fails due"
-   " to lack of memory\n", mdev->port,
-   mdev->unit);
error = -ENOMEM;
goto outB;
}
-- 
2.7.4



[PATCH v2 1/2] mtd: maps: Remove print after allocation failure

2018-03-18 Thread Arushi Singhal
The prints after [k|v][m|z|c]alloc() functions are not needed, because
in case of failure, allocator will print their internal error prints
anyway.

Signed-off-by: Arushi Singhal 
---
changes in v2
* done changes in all the other files.

 drivers/mtd/maps/amd76xrom.c  | 6 ++
 drivers/mtd/maps/ck804xrom.c  | 4 +---
 drivers/mtd/maps/esb2rom.c| 4 +---
 drivers/mtd/maps/ichxrom.c| 6 ++
 drivers/mtd/maps/sun_uflash.c | 4 +---
 drivers/mtd/maps/vmu-flash.c  | 3 ---
 6 files changed, 7 insertions(+), 20 deletions(-)

diff --git a/drivers/mtd/maps/amd76xrom.c b/drivers/mtd/maps/amd76xrom.c
index 26de0a1..406a8d3 100644
--- a/drivers/mtd/maps/amd76xrom.c
+++ b/drivers/mtd/maps/amd76xrom.c
@@ -188,10 +188,8 @@ static int amd76xrom_init_one(struct pci_dev *pdev,
 
if (!map) {
map = kmalloc(sizeof(*map), GFP_KERNEL);
-   }
-   if (!map) {
-   printk(KERN_ERR MOD_NAME ": kmalloc failed");
-   goto out;
+   if (!map)
+   goto out;
}
memset(map, 0, sizeof(*map));
INIT_LIST_HEAD(>list);
diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c
index 584962e..2529d1b 100644
--- a/drivers/mtd/maps/ck804xrom.c
+++ b/drivers/mtd/maps/ck804xrom.c
@@ -219,10 +219,8 @@ static int __init ck804xrom_init_one(struct pci_dev *pdev,
if (!map)
map = kmalloc(sizeof(*map), GFP_KERNEL);
 
-   if (!map) {
-   printk(KERN_ERR MOD_NAME ": kmalloc failed");
+   if (!map)
goto out;
-   }
memset(map, 0, sizeof(*map));
INIT_LIST_HEAD(>list);
map->map.name = map->map_name;
diff --git a/drivers/mtd/maps/esb2rom.c b/drivers/mtd/maps/esb2rom.c
index da9f6d7..e50f1a4 100644
--- a/drivers/mtd/maps/esb2rom.c
+++ b/drivers/mtd/maps/esb2rom.c
@@ -278,10 +278,8 @@ static int __init esb2rom_init_one(struct pci_dev *pdev,
 
if (!map)
map = kmalloc(sizeof(*map), GFP_KERNEL);
-   if (!map) {
-   printk(KERN_ERR MOD_NAME ": kmalloc failed");
+   if (!map)
goto out;
-   }
memset(map, 0, sizeof(*map));
INIT_LIST_HEAD(>list);
map->map.name = map->map_name;
diff --git a/drivers/mtd/maps/ichxrom.c b/drivers/mtd/maps/ichxrom.c
index 1888c5b..cacef9d 100644
--- a/drivers/mtd/maps/ichxrom.c
+++ b/drivers/mtd/maps/ichxrom.c
@@ -212,10 +212,8 @@ static int __init ichxrom_init_one(struct pci_dev *pdev,
 
if (!map) {
map = kmalloc(sizeof(*map), GFP_KERNEL);
-   }
-   if (!map) {
-   printk(KERN_ERR MOD_NAME ": kmalloc failed");
-   goto out;
+   if (!map)
+   goto out;
}
memset(map, 0, sizeof(*map));
INIT_LIST_HEAD(>list);
diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c
index 1e73bba..80a253c 100644
--- a/drivers/mtd/maps/sun_uflash.c
+++ b/drivers/mtd/maps/sun_uflash.c
@@ -62,10 +62,8 @@ int uflash_devinit(struct platform_device *op, struct 
device_node *dp)
}
 
up = kzalloc(sizeof(struct uflash_dev), GFP_KERNEL);
-   if (!up) {
-   printk(KERN_ERR PFX "Cannot allocate struct uflash_dev\n");
+   if (!up)
return -ENOMEM;
-   }
 
/* copy defaults and tweak parameters */
memcpy(>map, _map_templ, sizeof(uflash_map_templ));
diff --git a/drivers/mtd/maps/vmu-flash.c b/drivers/mtd/maps/vmu-flash.c
index 6b223cf..a76a5ff 100644
--- a/drivers/mtd/maps/vmu-flash.c
+++ b/drivers/mtd/maps/vmu-flash.c
@@ -130,9 +130,6 @@ static int maple_vmu_read_block(unsigned int num, unsigned 
char *buf,
if (!pcache->buffer) {
pcache->buffer = kmalloc(card->blocklen, GFP_KERNEL);
if (!pcache->buffer) {
-   dev_err(>dev, "VMU at (%d, %d) - read fails due"
-   " to lack of memory\n", mdev->port,
-   mdev->unit);
error = -ENOMEM;
goto outB;
}
-- 
2.7.4



[PATCH v2 2/2] mtd: nand: Remove print after allocation failure

2018-03-18 Thread Arushi Singhal
The prints after [k|v][m|z|c]alloc() etc. functions are not needed, because
in case of failure, allocator will print their internal error prints
anyway.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
changes in v2
*done the similar changes in other files.

 drivers/mtd/nand/ams-delta.c |  1 -
 drivers/mtd/nand/atmel/nand-controller.c | 13 +++-
 drivers/mtd/nand/marvell_nand.c  |  8 ++--
 drivers/mtd/nand/nandsim.c   | 35 
 drivers/mtd/nand/ndfc.c  |  4 +---
 drivers/mtd/nand/sunxi_nand.c|  4 +---
 6 files changed, 15 insertions(+), 50 deletions(-)

diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 9de6572..6e7f6e0 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -185,7 +185,6 @@ static int ams_delta_init(struct platform_device *pdev)
/* Allocate memory for MTD device structure and private data */
this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
if (!this) {
-   printk (KERN_WARNING "Unable to allocate E3 NAND MTD device 
structure.\n");
err = -ENOMEM;
goto out;
}
diff --git a/drivers/mtd/nand/atmel/nand-controller.c 
b/drivers/mtd/nand/atmel/nand-controller.c
index b2f00b3..b973d42 100644
--- a/drivers/mtd/nand/atmel/nand-controller.c
+++ b/drivers/mtd/nand/atmel/nand-controller.c
@@ -1615,10 +1615,8 @@ static int atmel_nand_register(struct atmel_nand *nand)
mtd->name = devm_kasprintf(nc->dev, GFP_KERNEL,
   "%s:nand.%d", dev_name(nc->dev),
   nand->cs[0].id);
-   if (!mtd->name) {
-   dev_err(nc->dev, "Failed to allocate mtd->name\n");
+   if (!mtd->name)
return -ENOMEM;
-   }
}
 
ret = nand_scan_tail(mtd);
@@ -1657,10 +1655,8 @@ static struct atmel_nand *atmel_nand_create(struct 
atmel_nand_controller *nc,
nand = devm_kzalloc(nc->dev,
sizeof(*nand) + (numcs * sizeof(*nand->cs)),
GFP_KERNEL);
-   if (!nand) {
-   dev_err(nc->dev, "Failed to allocate NAND object\n");
+   if (!nand)
return ERR_PTR(-ENOMEM);
-   }
 
nand->numcs = numcs;
 
@@ -2217,11 +2213,8 @@ atmel_hsmc_nand_controller_init(struct 
atmel_hsmc_nand_controller *nc)
nc->sram.virt = gen_pool_dma_alloc(nc->sram.pool,
ATMEL_NFC_SRAM_SIZE,
>sram.dma);
-   if (!nc->sram.virt) {
-   dev_err(nc->base.dev,
-   "Could not allocate memory from the NFC SRAM pool\n");
+   if (!nc->sram.virt)
return -ENOMEM;
-   }
 
return 0;
 }
diff --git a/drivers/mtd/nand/marvell_nand.c b/drivers/mtd/nand/marvell_nand.c
index 2196f2a..9dd2673 100644
--- a/drivers/mtd/nand/marvell_nand.c
+++ b/drivers/mtd/nand/marvell_nand.c
@@ -2307,10 +2307,8 @@ static int marvell_nand_chip_init(struct device *dev, 
struct marvell_nfc *nfc,
(nsels *
 sizeof(struct marvell_nand_chip_sel)),
GFP_KERNEL);
-   if (!marvell_nand) {
-   dev_err(dev, "could not allocate chip structure\n");
+   if (!marvell_nand)
return -ENOMEM;
-   }
 
marvell_nand->nsels = nsels;
marvell_nand->selected_die = -1;
@@ -2506,10 +2504,8 @@ static int marvell_nand_chip_init(struct device *dev, 
struct marvell_nfc *nfc,
mtd->name = devm_kasprintf(nfc->dev, GFP_KERNEL,
   "%s:nand.%d", dev_name(nfc->dev),
   marvell_nand->sels[0].cs);
-   if (!mtd->name) {
-   dev_err(nfc->dev, "Failed to allocate mtd->name\n");
+   if (!mtd->name)
return -ENOMEM;
-   }
}
 
ret = nand_scan_tail(mtd);
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index 44322a3..b6a5c09 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -569,13 +569,11 @@ static int __init alloc_device(struct nandsim *ns)
ns->pages_written = vzalloc(BITS_TO_LONGS(ns->geom.pgnum) *
sizeof(unsigned long));
if (!ns->pages_written) {
-   NS_ERR("alloc_device: unable to allocate pages written 
array\n");
err = -ENOMEM;
goto

[PATCH v2 2/2] mtd: nand: Remove print after allocation failure

2018-03-18 Thread Arushi Singhal
The prints after [k|v][m|z|c]alloc() etc. functions are not needed, because
in case of failure, allocator will print their internal error prints
anyway.

Signed-off-by: Arushi Singhal 
---
changes in v2
*done the similar changes in other files.

 drivers/mtd/nand/ams-delta.c |  1 -
 drivers/mtd/nand/atmel/nand-controller.c | 13 +++-
 drivers/mtd/nand/marvell_nand.c  |  8 ++--
 drivers/mtd/nand/nandsim.c   | 35 
 drivers/mtd/nand/ndfc.c  |  4 +---
 drivers/mtd/nand/sunxi_nand.c|  4 +---
 6 files changed, 15 insertions(+), 50 deletions(-)

diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 9de6572..6e7f6e0 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -185,7 +185,6 @@ static int ams_delta_init(struct platform_device *pdev)
/* Allocate memory for MTD device structure and private data */
this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
if (!this) {
-   printk (KERN_WARNING "Unable to allocate E3 NAND MTD device 
structure.\n");
err = -ENOMEM;
goto out;
}
diff --git a/drivers/mtd/nand/atmel/nand-controller.c 
b/drivers/mtd/nand/atmel/nand-controller.c
index b2f00b3..b973d42 100644
--- a/drivers/mtd/nand/atmel/nand-controller.c
+++ b/drivers/mtd/nand/atmel/nand-controller.c
@@ -1615,10 +1615,8 @@ static int atmel_nand_register(struct atmel_nand *nand)
mtd->name = devm_kasprintf(nc->dev, GFP_KERNEL,
   "%s:nand.%d", dev_name(nc->dev),
   nand->cs[0].id);
-   if (!mtd->name) {
-   dev_err(nc->dev, "Failed to allocate mtd->name\n");
+   if (!mtd->name)
return -ENOMEM;
-   }
}
 
ret = nand_scan_tail(mtd);
@@ -1657,10 +1655,8 @@ static struct atmel_nand *atmel_nand_create(struct 
atmel_nand_controller *nc,
nand = devm_kzalloc(nc->dev,
sizeof(*nand) + (numcs * sizeof(*nand->cs)),
GFP_KERNEL);
-   if (!nand) {
-   dev_err(nc->dev, "Failed to allocate NAND object\n");
+   if (!nand)
return ERR_PTR(-ENOMEM);
-   }
 
nand->numcs = numcs;
 
@@ -2217,11 +2213,8 @@ atmel_hsmc_nand_controller_init(struct 
atmel_hsmc_nand_controller *nc)
nc->sram.virt = gen_pool_dma_alloc(nc->sram.pool,
ATMEL_NFC_SRAM_SIZE,
>sram.dma);
-   if (!nc->sram.virt) {
-   dev_err(nc->base.dev,
-   "Could not allocate memory from the NFC SRAM pool\n");
+   if (!nc->sram.virt)
return -ENOMEM;
-   }
 
return 0;
 }
diff --git a/drivers/mtd/nand/marvell_nand.c b/drivers/mtd/nand/marvell_nand.c
index 2196f2a..9dd2673 100644
--- a/drivers/mtd/nand/marvell_nand.c
+++ b/drivers/mtd/nand/marvell_nand.c
@@ -2307,10 +2307,8 @@ static int marvell_nand_chip_init(struct device *dev, 
struct marvell_nfc *nfc,
(nsels *
 sizeof(struct marvell_nand_chip_sel)),
GFP_KERNEL);
-   if (!marvell_nand) {
-   dev_err(dev, "could not allocate chip structure\n");
+   if (!marvell_nand)
return -ENOMEM;
-   }
 
marvell_nand->nsels = nsels;
marvell_nand->selected_die = -1;
@@ -2506,10 +2504,8 @@ static int marvell_nand_chip_init(struct device *dev, 
struct marvell_nfc *nfc,
mtd->name = devm_kasprintf(nfc->dev, GFP_KERNEL,
   "%s:nand.%d", dev_name(nfc->dev),
   marvell_nand->sels[0].cs);
-   if (!mtd->name) {
-   dev_err(nfc->dev, "Failed to allocate mtd->name\n");
+   if (!mtd->name)
return -ENOMEM;
-   }
}
 
ret = nand_scan_tail(mtd);
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index 44322a3..b6a5c09 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -569,13 +569,11 @@ static int __init alloc_device(struct nandsim *ns)
ns->pages_written = vzalloc(BITS_TO_LONGS(ns->geom.pgnum) *
sizeof(unsigned long));
if (!ns->pages_written) {
-   NS_ERR("alloc_device: unable to allocate pages written 
array\n");
err = -ENOMEM;
goto err_close;
}

[PATCH 3/3] mtd: Remove print after allocation failure

2018-03-14 Thread Arushi Singhal
The prints after [k|v][m|z|c]alloc() functions are not needed, because
in case of failure, allocator will print their internal error prints
anyway.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/mtd/inftlmount.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/mtd/inftlmount.c b/drivers/mtd/inftlmount.c
index 8d6bb189..6b94646 100644
--- a/drivers/mtd/inftlmount.c
+++ b/drivers/mtd/inftlmount.c
@@ -562,12 +562,8 @@ int INFTL_mount(struct INFTLrecord *s)
 
/* Temporary buffer to store ANAC numbers. */
ANACtable = kcalloc(s->nb_blocks, sizeof(u8), GFP_KERNEL);
-   if (!ANACtable) {
-   printk(KERN_WARNING "INFTL: allocation of ANACtable "
-   "failed (%zd bytes)\n",
-   s->nb_blocks * sizeof(u8));
+   if (!ANACtable)
return -ENOMEM;
-   }
 
/*
 * First pass is to explore each physical unit, and construct the
-- 
2.7.4



[PATCH 3/3] mtd: Remove print after allocation failure

2018-03-14 Thread Arushi Singhal
The prints after [k|v][m|z|c]alloc() functions are not needed, because
in case of failure, allocator will print their internal error prints
anyway.

Signed-off-by: Arushi Singhal 
---
 drivers/mtd/inftlmount.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/mtd/inftlmount.c b/drivers/mtd/inftlmount.c
index 8d6bb189..6b94646 100644
--- a/drivers/mtd/inftlmount.c
+++ b/drivers/mtd/inftlmount.c
@@ -562,12 +562,8 @@ int INFTL_mount(struct INFTLrecord *s)
 
/* Temporary buffer to store ANAC numbers. */
ANACtable = kcalloc(s->nb_blocks, sizeof(u8), GFP_KERNEL);
-   if (!ANACtable) {
-   printk(KERN_WARNING "INFTL: allocation of ANACtable "
-   "failed (%zd bytes)\n",
-   s->nb_blocks * sizeof(u8));
+   if (!ANACtable)
return -ENOMEM;
-   }
 
/*
 * First pass is to explore each physical unit, and construct the
-- 
2.7.4



[PATCH 1/3] mtd: nand: Remove print after allocation failure

2018-03-14 Thread Arushi Singhal
The prints after [k|v][m|z|c]alloc() functions are not needed, because
in case of failure, allocator will print their internal error prints
anyway.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/mtd/nand/ams-delta.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 9de6572..6e7f6e0 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -185,7 +185,6 @@ static int ams_delta_init(struct platform_device *pdev)
/* Allocate memory for MTD device structure and private data */
this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
if (!this) {
-   printk (KERN_WARNING "Unable to allocate E3 NAND MTD device 
structure.\n");
err = -ENOMEM;
goto out;
}
-- 
2.7.4



[PATCH 1/3] mtd: nand: Remove print after allocation failure

2018-03-14 Thread Arushi Singhal
The prints after [k|v][m|z|c]alloc() functions are not needed, because
in case of failure, allocator will print their internal error prints
anyway.

Signed-off-by: Arushi Singhal 
---
 drivers/mtd/nand/ams-delta.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 9de6572..6e7f6e0 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -185,7 +185,6 @@ static int ams_delta_init(struct platform_device *pdev)
/* Allocate memory for MTD device structure and private data */
this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
if (!this) {
-   printk (KERN_WARNING "Unable to allocate E3 NAND MTD device 
structure.\n");
err = -ENOMEM;
goto out;
}
-- 
2.7.4



[PATCH 2/3] mtd: maps: Remove print after allocation failure

2018-03-14 Thread Arushi Singhal
The prints after [k|v][m|z|c]alloc() functions are not needed, because
in case of failure, allocator will print their internal error prints
anyway.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/mtd/maps/sun_uflash.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c
index 1e73bba..80a253c 100644
--- a/drivers/mtd/maps/sun_uflash.c
+++ b/drivers/mtd/maps/sun_uflash.c
@@ -62,10 +62,8 @@ int uflash_devinit(struct platform_device *op, struct 
device_node *dp)
}
 
up = kzalloc(sizeof(struct uflash_dev), GFP_KERNEL);
-   if (!up) {
-   printk(KERN_ERR PFX "Cannot allocate struct uflash_dev\n");
+   if (!up)
return -ENOMEM;
-   }
 
/* copy defaults and tweak parameters */
memcpy(>map, _map_templ, sizeof(uflash_map_templ));
-- 
2.7.4



[PATCH 2/3] mtd: maps: Remove print after allocation failure

2018-03-14 Thread Arushi Singhal
The prints after [k|v][m|z|c]alloc() functions are not needed, because
in case of failure, allocator will print their internal error prints
anyway.

Signed-off-by: Arushi Singhal 
---
 drivers/mtd/maps/sun_uflash.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c
index 1e73bba..80a253c 100644
--- a/drivers/mtd/maps/sun_uflash.c
+++ b/drivers/mtd/maps/sun_uflash.c
@@ -62,10 +62,8 @@ int uflash_devinit(struct platform_device *op, struct 
device_node *dp)
}
 
up = kzalloc(sizeof(struct uflash_dev), GFP_KERNEL);
-   if (!up) {
-   printk(KERN_ERR PFX "Cannot allocate struct uflash_dev\n");
+   if (!up)
return -ENOMEM;
-   }
 
/* copy defaults and tweak parameters */
memcpy(>map, _map_templ, sizeof(uflash_map_templ));
-- 
2.7.4



[PATCH] mtd: chips: Replace printk() with pr_*() and define pr_fmt()

2018-03-12 Thread Arushi Singhal
Using pr_() is more concise than printk(KERN_).
This patch:
* Replace printks having a log level with the appropriate pr_*() macros.
* Define pr_fmt() to include relevant name.
* Remove redundant prefixes from pr_*() calls.
* Indent the code where possible.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/mtd/chips/cfi_cmdset_0001.c | 119 ++--
 1 file changed, 58 insertions(+), 61 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c 
b/drivers/mtd/chips/cfi_cmdset_0001.c
index 5e1b68c..90f56f5 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -17,6 +17,8 @@
  * - auto unlock sectors on resume for auto locking flash on power up
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include 
 #include 
 #include 
@@ -182,7 +184,7 @@ static void fixup_convert_atmel_pri(struct mtd_info *mtd)
memcpy(_pri, extp, sizeof(atmel_pri));
memset((char *)extp + 5, 0, sizeof(*extp) - 5);
 
-   printk(KERN_ERR "atmel Features: %02x\n", atmel_pri.Features);
+   pr_err("atmel Features: %02x\n", atmel_pri.Features);
 
if (atmel_pri.Features & 0x01) /* chip erase supported */
features |= (1<<0);
@@ -224,8 +226,7 @@ static void fixup_intel_strataflash(struct mtd_info *mtd)
struct cfi_private *cfi = map->fldrv_priv;
struct cfi_pri_intelext *extp = cfi->cmdset_priv;
 
-   printk(KERN_WARNING "cfi_cmdset_0001: Suspend "
-   "erase on write disabled.\n");
+   pr_warn("Suspend erase on write disabled.\n");
extp->SuspendCmdSupport &= ~1;
 }
 #endif
@@ -239,7 +240,7 @@ static void fixup_no_write_suspend(struct mtd_info *mtd)
 
if (cfip && (cfip->FeatureSupport&4)) {
cfip->FeatureSupport &= ~4;
-   printk(KERN_WARNING "cfi_cmdset_0001: write suspend 
disabled\n");
+   pr_warn("write suspend disabled\n");
}
 }
 #endif
@@ -282,13 +283,13 @@ static void fixup_LH28F640BF(struct mtd_info *mtd)
/* Reset the Partition Configuration Register on LH28F640BF
 * to a single partition (PCR = 0x000): PCR is embedded into A0-A15. */
if (is_LH28F640BF(cfi)) {
-   printk(KERN_INFO "Reset Partition Config. Register: 1 Partition 
of 4 planes\n");
+   pr_info("Reset Partition Config. Register: 1 Partition of 4 
planes\n");
map_write(map, CMD(0x60), 0);
map_write(map, CMD(0x04), 0);
 
/* We have set one single partition thus
 * Simultaneous Operations are not allowed */
-   printk(KERN_INFO "cfi_cmdset_0001: Simultaneous Operations 
disabled\n");
+   pr_info("Simultaneous Operations disabled\n");
extp->FeatureSupport &= ~512;
}
 }
@@ -307,7 +308,7 @@ static void fixup_use_write_buffers(struct mtd_info *mtd)
struct map_info *map = mtd->priv;
struct cfi_private *cfi = map->fldrv_priv;
if (cfi->cfiq->BufWriteTimeoutTyp) {
-   printk(KERN_INFO "Using buffer write method\n" );
+   pr_info("Using buffer write method\n" );
mtd->_write = cfi_intelext_write_buffers;
mtd->_writev = cfi_intelext_writev;
}
@@ -323,7 +324,7 @@ static void fixup_unlock_powerup_lock(struct mtd_info *mtd)
struct cfi_pri_intelext *cfip = cfi->cmdset_priv;
 
if (cfip->FeatureSupport&32) {
-   printk(KERN_INFO "Using auto-unlock on power-up/resume\n" );
+   pr_info("Using auto-unlock on power-up/resume\n" );
mtd->flags |= MTD_POWERUP_LOCK;
}
 }
@@ -392,9 +393,8 @@ read_pri_intelext(struct map_info *map, __u16 adr)
 
if (extp->MajorVersion != '1' ||
(extp->MinorVersion < '0' || extp->MinorVersion > '5')) {
-   printk(KERN_ERR "  Unknown Intel/Sharp Extended Query "
-  "version %c.%c.\n",  extp->MajorVersion,
-  extp->MinorVersion);
+   pr_err("Unknown Intel/Sharp Extended Query version %c.%c.\n",
+  extp->MajorVersion, extp->MinorVersion);
kfree(extp);
return NULL;
}
@@ -452,9 +452,7 @@ read_pri_intelext(struct map_info *map, __u16 adr)
extp_size = sizeof(*extp) + extra_size;
kfree(extp);
if (extp_size > 4096) {
-   printk(KERN_ERR
-   "%s: cfi_pri_intelext is too fat\n",
-   __func__)

[PATCH] mtd: chips: Replace printk() with pr_*() and define pr_fmt()

2018-03-12 Thread Arushi Singhal
Using pr_() is more concise than printk(KERN_).
This patch:
* Replace printks having a log level with the appropriate pr_*() macros.
* Define pr_fmt() to include relevant name.
* Remove redundant prefixes from pr_*() calls.
* Indent the code where possible.

Signed-off-by: Arushi Singhal 
---
 drivers/mtd/chips/cfi_cmdset_0001.c | 119 ++--
 1 file changed, 58 insertions(+), 61 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c 
b/drivers/mtd/chips/cfi_cmdset_0001.c
index 5e1b68c..90f56f5 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -17,6 +17,8 @@
  * - auto unlock sectors on resume for auto locking flash on power up
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include 
 #include 
 #include 
@@ -182,7 +184,7 @@ static void fixup_convert_atmel_pri(struct mtd_info *mtd)
memcpy(_pri, extp, sizeof(atmel_pri));
memset((char *)extp + 5, 0, sizeof(*extp) - 5);
 
-   printk(KERN_ERR "atmel Features: %02x\n", atmel_pri.Features);
+   pr_err("atmel Features: %02x\n", atmel_pri.Features);
 
if (atmel_pri.Features & 0x01) /* chip erase supported */
features |= (1<<0);
@@ -224,8 +226,7 @@ static void fixup_intel_strataflash(struct mtd_info *mtd)
struct cfi_private *cfi = map->fldrv_priv;
struct cfi_pri_intelext *extp = cfi->cmdset_priv;
 
-   printk(KERN_WARNING "cfi_cmdset_0001: Suspend "
-   "erase on write disabled.\n");
+   pr_warn("Suspend erase on write disabled.\n");
extp->SuspendCmdSupport &= ~1;
 }
 #endif
@@ -239,7 +240,7 @@ static void fixup_no_write_suspend(struct mtd_info *mtd)
 
if (cfip && (cfip->FeatureSupport&4)) {
cfip->FeatureSupport &= ~4;
-   printk(KERN_WARNING "cfi_cmdset_0001: write suspend 
disabled\n");
+   pr_warn("write suspend disabled\n");
}
 }
 #endif
@@ -282,13 +283,13 @@ static void fixup_LH28F640BF(struct mtd_info *mtd)
/* Reset the Partition Configuration Register on LH28F640BF
 * to a single partition (PCR = 0x000): PCR is embedded into A0-A15. */
if (is_LH28F640BF(cfi)) {
-   printk(KERN_INFO "Reset Partition Config. Register: 1 Partition 
of 4 planes\n");
+   pr_info("Reset Partition Config. Register: 1 Partition of 4 
planes\n");
map_write(map, CMD(0x60), 0);
map_write(map, CMD(0x04), 0);
 
/* We have set one single partition thus
 * Simultaneous Operations are not allowed */
-   printk(KERN_INFO "cfi_cmdset_0001: Simultaneous Operations 
disabled\n");
+   pr_info("Simultaneous Operations disabled\n");
extp->FeatureSupport &= ~512;
}
 }
@@ -307,7 +308,7 @@ static void fixup_use_write_buffers(struct mtd_info *mtd)
struct map_info *map = mtd->priv;
struct cfi_private *cfi = map->fldrv_priv;
if (cfi->cfiq->BufWriteTimeoutTyp) {
-   printk(KERN_INFO "Using buffer write method\n" );
+   pr_info("Using buffer write method\n" );
mtd->_write = cfi_intelext_write_buffers;
mtd->_writev = cfi_intelext_writev;
}
@@ -323,7 +324,7 @@ static void fixup_unlock_powerup_lock(struct mtd_info *mtd)
struct cfi_pri_intelext *cfip = cfi->cmdset_priv;
 
if (cfip->FeatureSupport&32) {
-   printk(KERN_INFO "Using auto-unlock on power-up/resume\n" );
+   pr_info("Using auto-unlock on power-up/resume\n" );
mtd->flags |= MTD_POWERUP_LOCK;
}
 }
@@ -392,9 +393,8 @@ read_pri_intelext(struct map_info *map, __u16 adr)
 
if (extp->MajorVersion != '1' ||
(extp->MinorVersion < '0' || extp->MinorVersion > '5')) {
-   printk(KERN_ERR "  Unknown Intel/Sharp Extended Query "
-  "version %c.%c.\n",  extp->MajorVersion,
-  extp->MinorVersion);
+   pr_err("Unknown Intel/Sharp Extended Query version %c.%c.\n",
+  extp->MajorVersion, extp->MinorVersion);
kfree(extp);
return NULL;
}
@@ -452,9 +452,7 @@ read_pri_intelext(struct map_info *map, __u16 adr)
extp_size = sizeof(*extp) + extra_size;
kfree(extp);
if (extp_size > 4096) {
-   printk(KERN_ERR
-   "%s: cfi_pri_intelext is too fat\n",
-   __func__);
+  

[PATCH v2] net: netfilter: Replace printk() with appropriate pr_*() macro

2018-03-11 Thread Arushi Singhal
Using pr_() is more concise than
printk(KERN_).
Replace printks having a log level with the appropriate
pr_*() macros.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
changes in v2
*in v1 printk() were replaced with netdev_*()

 net/netfilter/nf_conntrack_acct.c  | 2 +-
 net/netfilter/nf_conntrack_ecache.c| 2 +-
 net/netfilter/nf_conntrack_timestamp.c | 2 +-
 net/netfilter/nf_nat_core.c| 2 +-
 net/netfilter/nfnetlink_queue.c| 4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/netfilter/nf_conntrack_acct.c 
b/net/netfilter/nf_conntrack_acct.c
index 8669167..b1c3286 100644
--- a/net/netfilter/nf_conntrack_acct.c
+++ b/net/netfilter/nf_conntrack_acct.c
@@ -80,7 +80,7 @@ static int nf_conntrack_acct_init_sysctl(struct net *net)
net->ct.acct_sysctl_header = register_net_sysctl(net, "net/netfilter",
 table);
if (!net->ct.acct_sysctl_header) {
-   printk(KERN_ERR "nf_conntrack_acct: can't register to 
sysctl.\n");
+   pr_err("nf_conntrack_acct: can't register to sysctl.\n");
goto out_register;
}
return 0;
diff --git a/net/netfilter/nf_conntrack_ecache.c 
b/net/netfilter/nf_conntrack_ecache.c
index caac41a..21a3048 100644
--- a/net/netfilter/nf_conntrack_ecache.c
+++ b/net/netfilter/nf_conntrack_ecache.c
@@ -372,7 +372,7 @@ static int nf_conntrack_event_init_sysctl(struct net *net)
net->ct.event_sysctl_header =
register_net_sysctl(net, "net/netfilter", table);
if (!net->ct.event_sysctl_header) {
-   printk(KERN_ERR "nf_ct_event: can't register to sysctl.\n");
+   pr_err("nf_ct_event: can't register to sysctl.\n");
goto out_register;
}
return 0;
diff --git a/net/netfilter/nf_conntrack_timestamp.c 
b/net/netfilter/nf_conntrack_timestamp.c
index 4c4734b..f32cc86 100644
--- a/net/netfilter/nf_conntrack_timestamp.c
+++ b/net/netfilter/nf_conntrack_timestamp.c
@@ -58,7 +58,7 @@ static int nf_conntrack_tstamp_init_sysctl(struct net *net)
net->ct.tstamp_sysctl_header = register_net_sysctl(net, "net/netfilter",
   table);
if (!net->ct.tstamp_sysctl_header) {
-   printk(KERN_ERR "nf_ct_tstamp: can't register to sysctl.\n");
+   pr_err("nf_ct_tstamp: can't register to sysctl.\n");
goto out_register;
}
return 0;
diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c
index 6c38421..dcda5ac 100644
--- a/net/netfilter/nf_nat_core.c
+++ b/net/netfilter/nf_nat_core.c
@@ -814,7 +814,7 @@ static int __init nf_nat_init(void)
ret = nf_ct_extend_register(_extend);
if (ret < 0) {
nf_ct_free_hashtable(nf_nat_bysource, nf_nat_htable_size);
-   printk(KERN_ERR "nf_nat_core: Unable to register extension\n");
+   pr_err("nf_nat_core: Unable to register extension\n");
return ret;
}
 
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index 8bba231..f5ddab1 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -834,8 +834,8 @@ nfqnl_mangle(void *data, int data_len, struct 
nf_queue_entry *e, int diff)
nskb = skb_copy_expand(e->skb, skb_headroom(e->skb),
   diff, GFP_ATOMIC);
if (!nskb) {
-   printk(KERN_WARNING "nf_queue: OOM "
- "in mangle, dropping packet\n");
+   pr_warn("nf_queue: OOM "
+   "in mangle, dropping packet\n");
return -ENOMEM;
}
kfree_skb(e->skb);
-- 
2.7.4



[PATCH v2] net: netfilter: Replace printk() with appropriate pr_*() macro

2018-03-11 Thread Arushi Singhal
Using pr_() is more concise than
printk(KERN_).
Replace printks having a log level with the appropriate
pr_*() macros.

Signed-off-by: Arushi Singhal 
---
changes in v2
*in v1 printk() were replaced with netdev_*()

 net/netfilter/nf_conntrack_acct.c  | 2 +-
 net/netfilter/nf_conntrack_ecache.c| 2 +-
 net/netfilter/nf_conntrack_timestamp.c | 2 +-
 net/netfilter/nf_nat_core.c| 2 +-
 net/netfilter/nfnetlink_queue.c| 4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/netfilter/nf_conntrack_acct.c 
b/net/netfilter/nf_conntrack_acct.c
index 8669167..b1c3286 100644
--- a/net/netfilter/nf_conntrack_acct.c
+++ b/net/netfilter/nf_conntrack_acct.c
@@ -80,7 +80,7 @@ static int nf_conntrack_acct_init_sysctl(struct net *net)
net->ct.acct_sysctl_header = register_net_sysctl(net, "net/netfilter",
 table);
if (!net->ct.acct_sysctl_header) {
-   printk(KERN_ERR "nf_conntrack_acct: can't register to 
sysctl.\n");
+   pr_err("nf_conntrack_acct: can't register to sysctl.\n");
goto out_register;
}
return 0;
diff --git a/net/netfilter/nf_conntrack_ecache.c 
b/net/netfilter/nf_conntrack_ecache.c
index caac41a..21a3048 100644
--- a/net/netfilter/nf_conntrack_ecache.c
+++ b/net/netfilter/nf_conntrack_ecache.c
@@ -372,7 +372,7 @@ static int nf_conntrack_event_init_sysctl(struct net *net)
net->ct.event_sysctl_header =
register_net_sysctl(net, "net/netfilter", table);
if (!net->ct.event_sysctl_header) {
-   printk(KERN_ERR "nf_ct_event: can't register to sysctl.\n");
+   pr_err("nf_ct_event: can't register to sysctl.\n");
goto out_register;
}
return 0;
diff --git a/net/netfilter/nf_conntrack_timestamp.c 
b/net/netfilter/nf_conntrack_timestamp.c
index 4c4734b..f32cc86 100644
--- a/net/netfilter/nf_conntrack_timestamp.c
+++ b/net/netfilter/nf_conntrack_timestamp.c
@@ -58,7 +58,7 @@ static int nf_conntrack_tstamp_init_sysctl(struct net *net)
net->ct.tstamp_sysctl_header = register_net_sysctl(net, "net/netfilter",
   table);
if (!net->ct.tstamp_sysctl_header) {
-   printk(KERN_ERR "nf_ct_tstamp: can't register to sysctl.\n");
+   pr_err("nf_ct_tstamp: can't register to sysctl.\n");
goto out_register;
}
return 0;
diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c
index 6c38421..dcda5ac 100644
--- a/net/netfilter/nf_nat_core.c
+++ b/net/netfilter/nf_nat_core.c
@@ -814,7 +814,7 @@ static int __init nf_nat_init(void)
ret = nf_ct_extend_register(_extend);
if (ret < 0) {
nf_ct_free_hashtable(nf_nat_bysource, nf_nat_htable_size);
-   printk(KERN_ERR "nf_nat_core: Unable to register extension\n");
+   pr_err("nf_nat_core: Unable to register extension\n");
return ret;
}
 
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index 8bba231..f5ddab1 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -834,8 +834,8 @@ nfqnl_mangle(void *data, int data_len, struct 
nf_queue_entry *e, int diff)
nskb = skb_copy_expand(e->skb, skb_headroom(e->skb),
   diff, GFP_ATOMIC);
if (!nskb) {
-   printk(KERN_WARNING "nf_queue: OOM "
- "in mangle, dropping packet\n");
+   pr_warn("nf_queue: OOM "
+   "in mangle, dropping packet\n");
return -ENOMEM;
}
kfree_skb(e->skb);
-- 
2.7.4



[PATCH] mtd: Replace printk() with more standardize output format.

2018-03-11 Thread Arushi Singhal
printk() is the raw way to print output and should be avoided.

For drivers with defined "struct device object", dev_*macro() is
prefer and for "struct netdevice object", netdev_*macro() is prefer over
dev_*macro() to standardize the output format within the subsystem.

If no "struct device object" is defined prefer pr_*macro() over
printk().

This patch Replace printk having a log level with the appropriate output
format according to the order of preference.

Code is indented where possible.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/mtd/ftl.c | 111 ++
 1 file changed, 53 insertions(+), 58 deletions(-)

diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index 664d206..7db808c 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -177,18 +177,18 @@ static int scan_header(partition_t *part)
 }
 
 if (offset == max_offset) {
-   printk(KERN_NOTICE "ftl_cs: FTL header not found.\n");
+   pr_notice("ftl_cs: FTL header not found.\n");
return -ENOENT;
 }
 if (header.BlockSize != 9 ||
(header.EraseUnitSize < 10) || (header.EraseUnitSize > 31) ||
(header.NumTransferUnits >= le16_to_cpu(header.NumEraseUnits))) {
-   printk(KERN_NOTICE "ftl_cs: FTL header corrupt!\n");
+   pr_notice("ftl_cs: FTL header corrupt!\n");
return -1;
 }
 if ((1 << header.EraseUnitSize) != part->mbd.mtd->erasesize) {
-   printk(KERN_NOTICE "ftl: FTL EraseUnitSize %x != MTD erasesize %x\n",
-  1 << header.EraseUnitSize,part->mbd.mtd->erasesize);
+   pr_notice("ftl: FTL EraseUnitSize %x != MTD erasesize %x\n",
+ 1 << header.EraseUnitSize,part->mbd.mtd->erasesize);
return -1;
 }
 part->header = header;
@@ -240,8 +240,8 @@ static int build_maps(partition_t *part)
xvalid++;
} else {
if (xtrans == part->header.NumTransferUnits) {
-   printk(KERN_NOTICE "ftl_cs: format error: too many "
-  "transfer units!\n");
+   pr_notice("ftl_cs: format error: too many "
+ "transfer units!\n");
goto out_XferInfo;
}
if (hdr_ok && (le16_to_cpu(header.LogicalEUN) == 0x)) {
@@ -261,8 +261,7 @@ static int build_maps(partition_t *part)
 header = part->header;
 if ((xtrans != header.NumTransferUnits) ||
(xvalid+xtrans != le16_to_cpu(header.NumEraseUnits))) {
-   printk(KERN_NOTICE "ftl_cs: format error: erase units "
-  "don't add up!\n");
+   pr_notice("ftl_cs: format error: erase units don't add up!\n");
goto out_XferInfo;
 }
 
@@ -384,8 +383,8 @@ static void ftl_erase_callback(struct erase_info *erase)
if (part->XferInfo[i].Offset == erase->addr) break;
 
 if (i == part->header.NumTransferUnits) {
-   printk(KERN_NOTICE "ftl_cs: internal error: "
-  "erase lookup failed!\n");
+   pr_notice("ftl_cs: internal error: "
+ "erase lookup failed!\n");
return;
 }
 
@@ -394,8 +393,7 @@ static void ftl_erase_callback(struct erase_info *erase)
xfer->state = XFER_ERASED;
 else {
xfer->state = XFER_FAILED;
-   printk(KERN_NOTICE "ftl_cs: erase failed: state = %d\n",
-  erase->state);
+   pr_notice("ftl_cs: erase failed: state = %d\n", erase->state);
 }
 
 kfree(erase);
@@ -492,7 +490,7 @@ static int copy_erase_unit(partition_t *part, uint16_t 
srcunit,
part->bam_index = 0x;
 
if (ret) {
-   printk( KERN_WARNING "ftl: Failed to read BAM cache in 
copy_erase_unit()!\n");
+   pr_warn("ftl: Failed to read BAM cache in copy_erase_unit()!\n");
return ret;
}
 }
@@ -506,7 +504,7 @@ static int copy_erase_unit(partition_t *part, uint16_t 
srcunit,
 (u_char *));
 
 if (ret) {
-   printk( KERN_WARNING "ftl: Failed to write back to BAM cache in 
copy_erase_unit()!\n");
+   pr_warn("ftl: Failed to write back to BAM cache in 
copy_erase_unit()!\n");
return ret;
 }
 
@@ -525,7 +523,7 @@ static int copy_erase_unit(partition_t *part, uint16_t 
srcunit,
ret = mtd_read(part->mbd.mtd, src, SECTOR_SIZE, ,
(u_char *)buf);
if (ret) {
-   printk(KERN_WARNING "ftl: Error reading old xfer unit in 
copy_erase_unit\n");
+   pr_warn("ftl: Error reading old xfer unit in 
copy_erase_unit\n");
return ret;
 }
 
@@ -533,7 +531,7 

[PATCH] mtd: Replace printk() with more standardize output format.

2018-03-11 Thread Arushi Singhal
printk() is the raw way to print output and should be avoided.

For drivers with defined "struct device object", dev_*macro() is
prefer and for "struct netdevice object", netdev_*macro() is prefer over
dev_*macro() to standardize the output format within the subsystem.

If no "struct device object" is defined prefer pr_*macro() over
printk().

This patch Replace printk having a log level with the appropriate output
format according to the order of preference.

Code is indented where possible.

Signed-off-by: Arushi Singhal 
---
 drivers/mtd/ftl.c | 111 ++
 1 file changed, 53 insertions(+), 58 deletions(-)

diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index 664d206..7db808c 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -177,18 +177,18 @@ static int scan_header(partition_t *part)
 }
 
 if (offset == max_offset) {
-   printk(KERN_NOTICE "ftl_cs: FTL header not found.\n");
+   pr_notice("ftl_cs: FTL header not found.\n");
return -ENOENT;
 }
 if (header.BlockSize != 9 ||
(header.EraseUnitSize < 10) || (header.EraseUnitSize > 31) ||
(header.NumTransferUnits >= le16_to_cpu(header.NumEraseUnits))) {
-   printk(KERN_NOTICE "ftl_cs: FTL header corrupt!\n");
+   pr_notice("ftl_cs: FTL header corrupt!\n");
return -1;
 }
 if ((1 << header.EraseUnitSize) != part->mbd.mtd->erasesize) {
-   printk(KERN_NOTICE "ftl: FTL EraseUnitSize %x != MTD erasesize %x\n",
-  1 << header.EraseUnitSize,part->mbd.mtd->erasesize);
+   pr_notice("ftl: FTL EraseUnitSize %x != MTD erasesize %x\n",
+ 1 << header.EraseUnitSize,part->mbd.mtd->erasesize);
return -1;
 }
 part->header = header;
@@ -240,8 +240,8 @@ static int build_maps(partition_t *part)
xvalid++;
} else {
if (xtrans == part->header.NumTransferUnits) {
-   printk(KERN_NOTICE "ftl_cs: format error: too many "
-  "transfer units!\n");
+   pr_notice("ftl_cs: format error: too many "
+ "transfer units!\n");
goto out_XferInfo;
}
if (hdr_ok && (le16_to_cpu(header.LogicalEUN) == 0x)) {
@@ -261,8 +261,7 @@ static int build_maps(partition_t *part)
 header = part->header;
 if ((xtrans != header.NumTransferUnits) ||
(xvalid+xtrans != le16_to_cpu(header.NumEraseUnits))) {
-   printk(KERN_NOTICE "ftl_cs: format error: erase units "
-  "don't add up!\n");
+   pr_notice("ftl_cs: format error: erase units don't add up!\n");
goto out_XferInfo;
 }
 
@@ -384,8 +383,8 @@ static void ftl_erase_callback(struct erase_info *erase)
if (part->XferInfo[i].Offset == erase->addr) break;
 
 if (i == part->header.NumTransferUnits) {
-   printk(KERN_NOTICE "ftl_cs: internal error: "
-  "erase lookup failed!\n");
+   pr_notice("ftl_cs: internal error: "
+ "erase lookup failed!\n");
return;
 }
 
@@ -394,8 +393,7 @@ static void ftl_erase_callback(struct erase_info *erase)
xfer->state = XFER_ERASED;
 else {
xfer->state = XFER_FAILED;
-   printk(KERN_NOTICE "ftl_cs: erase failed: state = %d\n",
-  erase->state);
+   pr_notice("ftl_cs: erase failed: state = %d\n", erase->state);
 }
 
 kfree(erase);
@@ -492,7 +490,7 @@ static int copy_erase_unit(partition_t *part, uint16_t 
srcunit,
part->bam_index = 0x;
 
if (ret) {
-   printk( KERN_WARNING "ftl: Failed to read BAM cache in 
copy_erase_unit()!\n");
+   pr_warn("ftl: Failed to read BAM cache in copy_erase_unit()!\n");
return ret;
}
 }
@@ -506,7 +504,7 @@ static int copy_erase_unit(partition_t *part, uint16_t 
srcunit,
 (u_char *));
 
 if (ret) {
-   printk( KERN_WARNING "ftl: Failed to write back to BAM cache in 
copy_erase_unit()!\n");
+   pr_warn("ftl: Failed to write back to BAM cache in 
copy_erase_unit()!\n");
return ret;
 }
 
@@ -525,7 +523,7 @@ static int copy_erase_unit(partition_t *part, uint16_t 
srcunit,
ret = mtd_read(part->mbd.mtd, src, SECTOR_SIZE, ,
(u_char *)buf);
if (ret) {
-   printk(KERN_WARNING "ftl: Error reading old xfer unit in 
copy_erase_unit\n");
+   pr_warn("ftl: Error reading old xfer unit in 
copy_erase_unit\n");
return ret;
 }
 
@@ -533,7 +531,7 @@ static int copy_erase_unit(partit

[PATCH] staging: iio: Remove unnecessary cast on void pointer

2018-03-07 Thread Arushi Singhal
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|

- (T*)
  e
)

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/staging/iio/adc/ad7816.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index bfe180a..bf76a86 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -254,7 +254,7 @@ static const struct attribute_group ad7816_attribute_group 
= {
 static irqreturn_t ad7816_event_handler(int irq, void *private)
 {
iio_push_event(private, IIO_EVENT_CODE_AD7816_OTI,
-  iio_get_time_ns((struct iio_dev *)private));
+  iio_get_time_ns(private));
return IRQ_HANDLED;
 }
 
-- 
2.7.4



[PATCH] staging: iio: Remove unnecessary cast on void pointer

2018-03-07 Thread Arushi Singhal
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|

- (T*)
  e
)

Signed-off-by: Arushi Singhal 
---
 drivers/staging/iio/adc/ad7816.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index bfe180a..bf76a86 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -254,7 +254,7 @@ static const struct attribute_group ad7816_attribute_group 
= {
 static irqreturn_t ad7816_event_handler(int irq, void *private)
 {
iio_push_event(private, IIO_EVENT_CODE_AD7816_OTI,
-  iio_get_time_ns((struct iio_dev *)private));
+  iio_get_time_ns(private));
return IRQ_HANDLED;
 }
 
-- 
2.7.4



[PATCH v3] staging: rtl8192u: Replace printk() with more standardize output format.

2018-03-07 Thread Arushi Singhal
printk() is the raw way to print output and should be avoided.

For drivers with defined "struct device object", dev_*macro() is
prefer and for "struct netdevice object", netdev_*macro() is prefer over
dev_*macro() to standardize the output format within the subsystem.

If no "struct device object" is defined prefer pr_*macro() over printk().

This patch Replace printk having a log level with the appropriate output
format according to the order of preference.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
Changes in v3
*In version2 net_*macro_ratelimited was used which is not helping in
standardizing the output format.

Changes in v2
*change the subject line, driver name was wrong.

 .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c  | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
index e6648f7..a4b4042 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
@@ -73,7 +73,7 @@ static void *ieee80211_ccmp_init(int key_idx)
 
priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->tfm)) {
-   printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate 
crypto API aes\n");
+   pr_debug("ieee80211_crypt_ccmp: could not allocate crypto API 
aes\n");
priv->tfm = NULL;
goto fail;
}
@@ -276,22 +276,22 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, 
int hdr_len, void *priv)
keyidx = pos[3];
if (!(keyidx & (1 << 5))) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: received packet without ExtIV 
flag from %pM\n",
-   hdr->addr2);
+   netdev_dbg(skb->dev, "CCMP: received packet without 
ExtIV flag from %pM\n",
+  hdr->addr2);
}
key->dot11RSNAStatsCCMPFormatErrors++;
return -2;
}
keyidx >>= 6;
if (key->key_idx != keyidx) {
-   printk(KERN_DEBUG "CCMP: RX tkey->key_idx=%d frame keyidx=%d 
priv=%p\n",
-   key->key_idx, keyidx, priv);
+   netdev_dbg(skb->dev, "CCMP: RX tkey->key_idx=%d frame keyidx=%d 
priv=%p\n",
+  key->key_idx, keyidx, priv);
return -6;
}
if (!key->key_set) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: received packet from %pM with 
keyid=%d that does not have a configured key\n",
-   hdr->addr2, keyidx);
+   netdev_dbg(skb->dev, "CCMP: received packet from %pM 
with keyid=%d that does not have a configured key\n",
+  hdr->addr2, keyidx);
}
return -3;
}
@@ -306,8 +306,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
 
if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: replay detected: STA=%pM 
previous PN %pm received PN %pm\n",
-  hdr->addr2, key->rx_pn, pn);
+   netdev_dbg(skb->dev, "CCMP: replay detected: STA=%pM 
previous PN %pm received PN %pm\n",
+  hdr->addr2, key->rx_pn, pn);
}
key->dot11RSNAStatsCCMPReplays++;
return -4;
@@ -341,8 +341,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
 
if (memcmp(mic, a, CCMP_MIC_LEN) != 0) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: decrypt failed: 
STA=%pM\n",
-   hdr->addr2);
+   netdev_dbg(skb->dev, "CCMP: decrypt failed: 
STA=%pM\n",
+  hdr->addr2);
}
key->dot11RSNAStatsCCMPDecryptErrors++;
return -5;
-- 
2.7.4



[PATCH v3] staging: rtl8192u: Replace printk() with more standardize output format.

2018-03-07 Thread Arushi Singhal
printk() is the raw way to print output and should be avoided.

For drivers with defined "struct device object", dev_*macro() is
prefer and for "struct netdevice object", netdev_*macro() is prefer over
dev_*macro() to standardize the output format within the subsystem.

If no "struct device object" is defined prefer pr_*macro() over printk().

This patch Replace printk having a log level with the appropriate output
format according to the order of preference.

Signed-off-by: Arushi Singhal 
---
Changes in v3
*In version2 net_*macro_ratelimited was used which is not helping in
standardizing the output format.

Changes in v2
*change the subject line, driver name was wrong.

 .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c  | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
index e6648f7..a4b4042 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
@@ -73,7 +73,7 @@ static void *ieee80211_ccmp_init(int key_idx)
 
priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->tfm)) {
-   printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate 
crypto API aes\n");
+   pr_debug("ieee80211_crypt_ccmp: could not allocate crypto API 
aes\n");
priv->tfm = NULL;
goto fail;
}
@@ -276,22 +276,22 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, 
int hdr_len, void *priv)
keyidx = pos[3];
if (!(keyidx & (1 << 5))) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: received packet without ExtIV 
flag from %pM\n",
-   hdr->addr2);
+   netdev_dbg(skb->dev, "CCMP: received packet without 
ExtIV flag from %pM\n",
+  hdr->addr2);
}
key->dot11RSNAStatsCCMPFormatErrors++;
return -2;
}
keyidx >>= 6;
if (key->key_idx != keyidx) {
-   printk(KERN_DEBUG "CCMP: RX tkey->key_idx=%d frame keyidx=%d 
priv=%p\n",
-   key->key_idx, keyidx, priv);
+   netdev_dbg(skb->dev, "CCMP: RX tkey->key_idx=%d frame keyidx=%d 
priv=%p\n",
+  key->key_idx, keyidx, priv);
return -6;
}
if (!key->key_set) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: received packet from %pM with 
keyid=%d that does not have a configured key\n",
-   hdr->addr2, keyidx);
+   netdev_dbg(skb->dev, "CCMP: received packet from %pM 
with keyid=%d that does not have a configured key\n",
+  hdr->addr2, keyidx);
}
return -3;
}
@@ -306,8 +306,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
 
if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: replay detected: STA=%pM 
previous PN %pm received PN %pm\n",
-  hdr->addr2, key->rx_pn, pn);
+   netdev_dbg(skb->dev, "CCMP: replay detected: STA=%pM 
previous PN %pm received PN %pm\n",
+  hdr->addr2, key->rx_pn, pn);
}
key->dot11RSNAStatsCCMPReplays++;
return -4;
@@ -341,8 +341,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
 
if (memcmp(mic, a, CCMP_MIC_LEN) != 0) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: decrypt failed: 
STA=%pM\n",
-   hdr->addr2);
+   netdev_dbg(skb->dev, "CCMP: decrypt failed: 
STA=%pM\n",
+  hdr->addr2);
}
key->dot11RSNAStatsCCMPDecryptErrors++;
return -5;
-- 
2.7.4



[PATCH v2] staging: rtl8192u: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-04 Thread Arushi Singhal
Replace printk having a log level with the appropriate
net_*macro_ratelimited.
It's better to use actual device name as a prefix in error messages.
Indentation is also changed, to fix the  checkpatch issue if line is not
exceding 80 characters.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
changes in v2
*change the subject line, in v1 driver name was wrong.

 .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c  | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
index e6648f7..200fe5f 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
@@ -73,7 +73,7 @@ static void *ieee80211_ccmp_init(int key_idx)
 
priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->tfm)) {
-   printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate 
crypto API aes\n");
+   net_dbg_ratelimited("ieee80211_crypt_ccmp: could not allocate 
crypto API aes\n");
priv->tfm = NULL;
goto fail;
}
@@ -276,22 +276,22 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, 
int hdr_len, void *priv)
keyidx = pos[3];
if (!(keyidx & (1 << 5))) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: received packet without ExtIV 
flag from %pM\n",
-   hdr->addr2);
+   net_dbg_ratelimited("CCMP: received packet without 
ExtIV flag from %pM\n",
+   hdr->addr2);
}
key->dot11RSNAStatsCCMPFormatErrors++;
return -2;
}
keyidx >>= 6;
if (key->key_idx != keyidx) {
-   printk(KERN_DEBUG "CCMP: RX tkey->key_idx=%d frame keyidx=%d 
priv=%p\n",
-   key->key_idx, keyidx, priv);
+   net_dbg_ratelimited("CCMP: RX tkey->key_idx=%d frame keyidx=%d 
priv=%p\n",
+   key->key_idx, keyidx, priv);
return -6;
}
if (!key->key_set) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: received packet from %pM with 
keyid=%d that does not have a configured key\n",
-   hdr->addr2, keyidx);
+   net_dbg_ratelimited("CCMP: received packet from %pM 
with keyid=%d that does not have a configured key\n",
+   hdr->addr2, keyidx);
}
return -3;
}
@@ -306,8 +306,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
 
if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: replay detected: STA=%pM 
previous PN %pm received PN %pm\n",
-  hdr->addr2, key->rx_pn, pn);
+   net_dbg_ratelimited("CCMP: replay detected: STA=%pM 
previous PN %pm received PN %pm\n",
+   hdr->addr2, key->rx_pn, pn);
}
key->dot11RSNAStatsCCMPReplays++;
return -4;
@@ -341,8 +341,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
 
if (memcmp(mic, a, CCMP_MIC_LEN) != 0) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: decrypt failed: 
STA=%pM\n",
-   hdr->addr2);
+   net_dbg_ratelimited("CCMP: decrypt failed: 
STA=%pM\n",
+   hdr->addr2);
}
key->dot11RSNAStatsCCMPDecryptErrors++;
return -5;
-- 
2.7.4



[PATCH v2] staging: rtl8192u: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-04 Thread Arushi Singhal
Replace printk having a log level with the appropriate
net_*macro_ratelimited.
It's better to use actual device name as a prefix in error messages.
Indentation is also changed, to fix the  checkpatch issue if line is not
exceding 80 characters.

Signed-off-by: Arushi Singhal 
---
changes in v2
*change the subject line, in v1 driver name was wrong.

 .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c  | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
index e6648f7..200fe5f 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
@@ -73,7 +73,7 @@ static void *ieee80211_ccmp_init(int key_idx)
 
priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->tfm)) {
-   printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate 
crypto API aes\n");
+   net_dbg_ratelimited("ieee80211_crypt_ccmp: could not allocate 
crypto API aes\n");
priv->tfm = NULL;
goto fail;
}
@@ -276,22 +276,22 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, 
int hdr_len, void *priv)
keyidx = pos[3];
if (!(keyidx & (1 << 5))) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: received packet without ExtIV 
flag from %pM\n",
-   hdr->addr2);
+   net_dbg_ratelimited("CCMP: received packet without 
ExtIV flag from %pM\n",
+   hdr->addr2);
}
key->dot11RSNAStatsCCMPFormatErrors++;
return -2;
}
keyidx >>= 6;
if (key->key_idx != keyidx) {
-   printk(KERN_DEBUG "CCMP: RX tkey->key_idx=%d frame keyidx=%d 
priv=%p\n",
-   key->key_idx, keyidx, priv);
+   net_dbg_ratelimited("CCMP: RX tkey->key_idx=%d frame keyidx=%d 
priv=%p\n",
+   key->key_idx, keyidx, priv);
return -6;
}
if (!key->key_set) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: received packet from %pM with 
keyid=%d that does not have a configured key\n",
-   hdr->addr2, keyidx);
+   net_dbg_ratelimited("CCMP: received packet from %pM 
with keyid=%d that does not have a configured key\n",
+   hdr->addr2, keyidx);
}
return -3;
}
@@ -306,8 +306,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
 
if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: replay detected: STA=%pM 
previous PN %pm received PN %pm\n",
-  hdr->addr2, key->rx_pn, pn);
+   net_dbg_ratelimited("CCMP: replay detected: STA=%pM 
previous PN %pm received PN %pm\n",
+   hdr->addr2, key->rx_pn, pn);
}
key->dot11RSNAStatsCCMPReplays++;
return -4;
@@ -341,8 +341,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
 
if (memcmp(mic, a, CCMP_MIC_LEN) != 0) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: decrypt failed: 
STA=%pM\n",
-   hdr->addr2);
+   net_dbg_ratelimited("CCMP: decrypt failed: 
STA=%pM\n",
+   hdr->addr2);
}
key->dot11RSNAStatsCCMPDecryptErrors++;
return -5;
-- 
2.7.4



[PATCH v2] staging: comedi: Replace "dont" with "don't

2018-03-04 Thread Arushi Singhal
Replace "dont" with "don't".
"Dont" is not same as "Do not" or "Don't".

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
changes in v2
*Commit log is rewrite in the imperative.

 drivers/staging/comedi/drivers/cb_pcidas64.c | 2 +-
 drivers/staging/comedi/drivers/das16.c   | 2 +-
 drivers/staging/comedi/drivers/das16m1.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
b/drivers/staging/comedi/drivers/cb_pcidas64.c
index c007500..ceef905 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -1700,7 +1700,7 @@ static void i2c_write(struct comedi_device *dev, unsigned 
int address,
 * eeprom and i2c bus
 */
 
-   /* make sure we dont send anything to eeprom */
+   /* make sure we don't send anything to eeprom */
devpriv->plx_control_bits &= ~PLX_CNTRL_EECS;
 
i2c_stop(dev);
diff --git a/drivers/staging/comedi/drivers/das16.c 
b/drivers/staging/comedi/drivers/das16.c
index 74ff204..81eb51b 100644
--- a/drivers/staging/comedi/drivers/das16.c
+++ b/drivers/staging/comedi/drivers/das16.c
@@ -619,7 +619,7 @@ static int das16_cmd_test(struct comedi_device *dev, struct 
comedi_subdevice *s,
 
/* Step 2b : and mutually compatible */
 
-   /*  make sure scan_begin_src and convert_src dont conflict */
+   /*  make sure scan_begin_src and convert_src don't conflict */
if (cmd->scan_begin_src == TRIG_FOLLOW && cmd->convert_src == TRIG_NOW)
err |= -EINVAL;
if (cmd->scan_begin_src != TRIG_FOLLOW && cmd->convert_src != TRIG_NOW)
diff --git a/drivers/staging/comedi/drivers/das16m1.c 
b/drivers/staging/comedi/drivers/das16m1.c
index 72f8ed2..4e36377 100644
--- a/drivers/staging/comedi/drivers/das16m1.c
+++ b/drivers/staging/comedi/drivers/das16m1.c
@@ -407,7 +407,7 @@ static void das16m1_handler(struct comedi_device *dev, 
unsigned int status)
if (num_samples > cmd->stop_arg * cmd->chanlist_len)
num_samples = cmd->stop_arg * cmd->chanlist_len;
}
-   /*  make sure we dont try to get too many points if fifo has overrun */
+   /*  make sure we don't try to get too many points if fifo has overrun */
if (num_samples > DAS16M1_AI_FIFO_SZ)
num_samples = DAS16M1_AI_FIFO_SZ;
insw(dev->iobase, devpriv->ai_buffer, num_samples);
-- 
2.7.4



[PATCH v2] staging: comedi: Replace "dont" with "don't

2018-03-04 Thread Arushi Singhal
Replace "dont" with "don't".
"Dont" is not same as "Do not" or "Don't".

Signed-off-by: Arushi Singhal 
---
changes in v2
*Commit log is rewrite in the imperative.

 drivers/staging/comedi/drivers/cb_pcidas64.c | 2 +-
 drivers/staging/comedi/drivers/das16.c   | 2 +-
 drivers/staging/comedi/drivers/das16m1.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
b/drivers/staging/comedi/drivers/cb_pcidas64.c
index c007500..ceef905 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -1700,7 +1700,7 @@ static void i2c_write(struct comedi_device *dev, unsigned 
int address,
 * eeprom and i2c bus
 */
 
-   /* make sure we dont send anything to eeprom */
+   /* make sure we don't send anything to eeprom */
devpriv->plx_control_bits &= ~PLX_CNTRL_EECS;
 
i2c_stop(dev);
diff --git a/drivers/staging/comedi/drivers/das16.c 
b/drivers/staging/comedi/drivers/das16.c
index 74ff204..81eb51b 100644
--- a/drivers/staging/comedi/drivers/das16.c
+++ b/drivers/staging/comedi/drivers/das16.c
@@ -619,7 +619,7 @@ static int das16_cmd_test(struct comedi_device *dev, struct 
comedi_subdevice *s,
 
/* Step 2b : and mutually compatible */
 
-   /*  make sure scan_begin_src and convert_src dont conflict */
+   /*  make sure scan_begin_src and convert_src don't conflict */
if (cmd->scan_begin_src == TRIG_FOLLOW && cmd->convert_src == TRIG_NOW)
err |= -EINVAL;
if (cmd->scan_begin_src != TRIG_FOLLOW && cmd->convert_src != TRIG_NOW)
diff --git a/drivers/staging/comedi/drivers/das16m1.c 
b/drivers/staging/comedi/drivers/das16m1.c
index 72f8ed2..4e36377 100644
--- a/drivers/staging/comedi/drivers/das16m1.c
+++ b/drivers/staging/comedi/drivers/das16m1.c
@@ -407,7 +407,7 @@ static void das16m1_handler(struct comedi_device *dev, 
unsigned int status)
if (num_samples > cmd->stop_arg * cmd->chanlist_len)
num_samples = cmd->stop_arg * cmd->chanlist_len;
}
-   /*  make sure we dont try to get too many points if fifo has overrun */
+   /*  make sure we don't try to get too many points if fifo has overrun */
if (num_samples > DAS16M1_AI_FIFO_SZ)
num_samples = DAS16M1_AI_FIFO_SZ;
insw(dev->iobase, devpriv->ai_buffer, num_samples);
-- 
2.7.4



[PATCH v3] staging: ipx: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-04 Thread Arushi Singhal
Replace printk having a log level with the appropriate
net_*macro_ratelimited.
It's better to use actual device name as a prefix in error messages.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
changes in v2
*In v1 printk was changed to pr_*macro(), which is used
in kernel instead of calling printk() directly. And for drivers,
dev_*macro() or net_*macro_ratelimited() should be used for calling
printk() directly.

changes in v3
*Indentation is not changed, as line is exceeding 80 characters limit.

 drivers/staging/ipx/af_ipx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ipx/af_ipx.c b/drivers/staging/ipx/af_ipx.c
index d21a9d1..5ec6591 100644
--- a/drivers/staging/ipx/af_ipx.c
+++ b/drivers/staging/ipx/af_ipx.c
@@ -744,7 +744,7 @@ static void ipxitf_discover_netnum(struct ipx_interface 
*intrfc,
intrfc->if_netnum = cb->ipx_source_net;
ipxitf_add_local_route(intrfc);
} else {
-   printk(KERN_WARNING "IPX: Network number collision "
+   net_warn_ratelimited("IPX: Network number collision "
"%lx\n%s %s and %s %s\n",
(unsigned long) ntohl(cb->ipx_source_net),
ipx_device_name(i),
-- 
2.7.4



[PATCH v3] staging: ipx: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-04 Thread Arushi Singhal
Replace printk having a log level with the appropriate
net_*macro_ratelimited.
It's better to use actual device name as a prefix in error messages.

Signed-off-by: Arushi Singhal 
---
changes in v2
*In v1 printk was changed to pr_*macro(), which is used
in kernel instead of calling printk() directly. And for drivers,
dev_*macro() or net_*macro_ratelimited() should be used for calling
printk() directly.

changes in v3
*Indentation is not changed, as line is exceeding 80 characters limit.

 drivers/staging/ipx/af_ipx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ipx/af_ipx.c b/drivers/staging/ipx/af_ipx.c
index d21a9d1..5ec6591 100644
--- a/drivers/staging/ipx/af_ipx.c
+++ b/drivers/staging/ipx/af_ipx.c
@@ -744,7 +744,7 @@ static void ipxitf_discover_netnum(struct ipx_interface 
*intrfc,
intrfc->if_netnum = cb->ipx_source_net;
ipxitf_add_local_route(intrfc);
} else {
-   printk(KERN_WARNING "IPX: Network number collision "
+   net_warn_ratelimited("IPX: Network number collision "
"%lx\n%s %s and %s %s\n",
(unsigned long) ntohl(cb->ipx_source_net),
ipx_device_name(i),
-- 
2.7.4



[PATCH] staging: irda: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-04 Thread Arushi Singhal
Replace printk having a log level with the appropriate
net_*macro_ratelimited.
It's better to use actual device name as a prefix in error messages.
Indentation is also changed, to fix the  checkpatch issue if line is not
exceding 80 characters.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c  | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
index e6648f7..200fe5f 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
@@ -73,7 +73,7 @@ static void *ieee80211_ccmp_init(int key_idx)
 
priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->tfm)) {
-   printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate 
crypto API aes\n");
+   net_dbg_ratelimited("ieee80211_crypt_ccmp: could not allocate 
crypto API aes\n");
priv->tfm = NULL;
goto fail;
}
@@ -276,22 +276,22 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, 
int hdr_len, void *priv)
keyidx = pos[3];
if (!(keyidx & (1 << 5))) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: received packet without ExtIV 
flag from %pM\n",
-   hdr->addr2);
+   net_dbg_ratelimited("CCMP: received packet without 
ExtIV flag from %pM\n",
+   hdr->addr2);
}
key->dot11RSNAStatsCCMPFormatErrors++;
return -2;
}
keyidx >>= 6;
if (key->key_idx != keyidx) {
-   printk(KERN_DEBUG "CCMP: RX tkey->key_idx=%d frame keyidx=%d 
priv=%p\n",
-   key->key_idx, keyidx, priv);
+   net_dbg_ratelimited("CCMP: RX tkey->key_idx=%d frame keyidx=%d 
priv=%p\n",
+   key->key_idx, keyidx, priv);
return -6;
}
if (!key->key_set) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: received packet from %pM with 
keyid=%d that does not have a configured key\n",
-   hdr->addr2, keyidx);
+   net_dbg_ratelimited("CCMP: received packet from %pM 
with keyid=%d that does not have a configured key\n",
+   hdr->addr2, keyidx);
}
return -3;
}
@@ -306,8 +306,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
 
if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: replay detected: STA=%pM 
previous PN %pm received PN %pm\n",
-  hdr->addr2, key->rx_pn, pn);
+   net_dbg_ratelimited("CCMP: replay detected: STA=%pM 
previous PN %pm received PN %pm\n",
+   hdr->addr2, key->rx_pn, pn);
}
key->dot11RSNAStatsCCMPReplays++;
return -4;
@@ -341,8 +341,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
 
if (memcmp(mic, a, CCMP_MIC_LEN) != 0) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: decrypt failed: 
STA=%pM\n",
-   hdr->addr2);
+   net_dbg_ratelimited("CCMP: decrypt failed: 
STA=%pM\n",
+   hdr->addr2);
}
key->dot11RSNAStatsCCMPDecryptErrors++;
return -5;
-- 
2.7.4



[PATCH] staging: irda: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-04 Thread Arushi Singhal
Replace printk having a log level with the appropriate
net_*macro_ratelimited.
It's better to use actual device name as a prefix in error messages.
Indentation is also changed, to fix the  checkpatch issue if line is not
exceding 80 characters.

Signed-off-by: Arushi Singhal 
---
 .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c  | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
index e6648f7..200fe5f 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
@@ -73,7 +73,7 @@ static void *ieee80211_ccmp_init(int key_idx)
 
priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->tfm)) {
-   printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate 
crypto API aes\n");
+   net_dbg_ratelimited("ieee80211_crypt_ccmp: could not allocate 
crypto API aes\n");
priv->tfm = NULL;
goto fail;
}
@@ -276,22 +276,22 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, 
int hdr_len, void *priv)
keyidx = pos[3];
if (!(keyidx & (1 << 5))) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: received packet without ExtIV 
flag from %pM\n",
-   hdr->addr2);
+   net_dbg_ratelimited("CCMP: received packet without 
ExtIV flag from %pM\n",
+   hdr->addr2);
}
key->dot11RSNAStatsCCMPFormatErrors++;
return -2;
}
keyidx >>= 6;
if (key->key_idx != keyidx) {
-   printk(KERN_DEBUG "CCMP: RX tkey->key_idx=%d frame keyidx=%d 
priv=%p\n",
-   key->key_idx, keyidx, priv);
+   net_dbg_ratelimited("CCMP: RX tkey->key_idx=%d frame keyidx=%d 
priv=%p\n",
+   key->key_idx, keyidx, priv);
return -6;
}
if (!key->key_set) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: received packet from %pM with 
keyid=%d that does not have a configured key\n",
-   hdr->addr2, keyidx);
+   net_dbg_ratelimited("CCMP: received packet from %pM 
with keyid=%d that does not have a configured key\n",
+   hdr->addr2, keyidx);
}
return -3;
}
@@ -306,8 +306,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
 
if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: replay detected: STA=%pM 
previous PN %pm received PN %pm\n",
-  hdr->addr2, key->rx_pn, pn);
+   net_dbg_ratelimited("CCMP: replay detected: STA=%pM 
previous PN %pm received PN %pm\n",
+   hdr->addr2, key->rx_pn, pn);
}
key->dot11RSNAStatsCCMPReplays++;
return -4;
@@ -341,8 +341,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
 
if (memcmp(mic, a, CCMP_MIC_LEN) != 0) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: decrypt failed: 
STA=%pM\n",
-   hdr->addr2);
+   net_dbg_ratelimited("CCMP: decrypt failed: 
STA=%pM\n",
+   hdr->addr2);
}
key->dot11RSNAStatsCCMPDecryptErrors++;
return -5;
-- 
2.7.4



[PATCH v2] staging: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-04 Thread Arushi Singhal
Replace printk having a log level with the appropriate
net_*macro_ratelimited.
It's better to use actual device name as a prefix in error messages.
Indentation is also changed, to fix the  checkpatch issue.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
changes in v2
*In previous version printk was changed to pr_*macro(), which is used
in kernel instead of calling printk() directly. And for drivers,
dev_*macro() or net_*macro_ratelimited() should be used for calling
printk() directly.

 drivers/staging/ipx/af_ipx.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/ipx/af_ipx.c b/drivers/staging/ipx/af_ipx.c
index d21a9d1..9a96962 100644
--- a/drivers/staging/ipx/af_ipx.c
+++ b/drivers/staging/ipx/af_ipx.c
@@ -744,13 +744,13 @@ static void ipxitf_discover_netnum(struct ipx_interface 
*intrfc,
intrfc->if_netnum = cb->ipx_source_net;
ipxitf_add_local_route(intrfc);
} else {
-   printk(KERN_WARNING "IPX: Network number collision "
-   "%lx\n%s %s and %s %s\n",
-   (unsigned long) ntohl(cb->ipx_source_net),
-   ipx_device_name(i),
-   ipx_frame_name(i->if_dlink_type),
-   ipx_device_name(intrfc),
-   ipx_frame_name(intrfc->if_dlink_type));
+   net_warn_ratelimited("IPX: Network number collision "
+"%lx\n%s %s and %s %s\n",
+(unsigned long) 
ntohl(cb->ipx_source_net),
+ipx_device_name(i),
+ipx_frame_name(i->if_dlink_type),
+ipx_device_name(intrfc),
+
ipx_frame_name(intrfc->if_dlink_type));
ipxitf_put(i);
}
}
-- 
2.7.4



[PATCH v2] staging: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-04 Thread Arushi Singhal
Replace printk having a log level with the appropriate
net_*macro_ratelimited.
It's better to use actual device name as a prefix in error messages.
Indentation is also changed, to fix the  checkpatch issue.

Signed-off-by: Arushi Singhal 
---
changes in v2
*In previous version printk was changed to pr_*macro(), which is used
in kernel instead of calling printk() directly. And for drivers,
dev_*macro() or net_*macro_ratelimited() should be used for calling
printk() directly.

 drivers/staging/ipx/af_ipx.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/ipx/af_ipx.c b/drivers/staging/ipx/af_ipx.c
index d21a9d1..9a96962 100644
--- a/drivers/staging/ipx/af_ipx.c
+++ b/drivers/staging/ipx/af_ipx.c
@@ -744,13 +744,13 @@ static void ipxitf_discover_netnum(struct ipx_interface 
*intrfc,
intrfc->if_netnum = cb->ipx_source_net;
ipxitf_add_local_route(intrfc);
} else {
-   printk(KERN_WARNING "IPX: Network number collision "
-   "%lx\n%s %s and %s %s\n",
-   (unsigned long) ntohl(cb->ipx_source_net),
-   ipx_device_name(i),
-   ipx_frame_name(i->if_dlink_type),
-   ipx_device_name(intrfc),
-   ipx_frame_name(intrfc->if_dlink_type));
+   net_warn_ratelimited("IPX: Network number collision "
+"%lx\n%s %s and %s %s\n",
+(unsigned long) 
ntohl(cb->ipx_source_net),
+ipx_device_name(i),
+ipx_frame_name(i->if_dlink_type),
+ipx_device_name(intrfc),
+
ipx_frame_name(intrfc->if_dlink_type));
ipxitf_put(i);
}
}
-- 
2.7.4



[PATCH 3/3] staging: media: Replace "dont" with "don't"

2018-03-04 Thread Arushi Singhal
Replace "dont" with "don't".
"Dont" is not same as "Do not" or "Don't".

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c 
b/drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c
index e36c2a3..f21075c 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c
@@ -450,7 +450,7 @@ static void mmu_l1_unmap(struct isp_mmu *mmu, phys_addr_t 
l1_pt,
ptr = end;
}
/*
-* use the same L2 page next time, so we dont
+* use the same L2 page next time, so we don't
 * need to invalidate and free this PT.
 */
/*  atomisp_set_pte(l1_pt, idx, NULL_PTE); */
-- 
2.7.4



[PATCH 3/3] staging: media: Replace "dont" with "don't"

2018-03-04 Thread Arushi Singhal
Replace "dont" with "don't".
"Dont" is not same as "Do not" or "Don't".

Signed-off-by: Arushi Singhal 
---
 drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c 
b/drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c
index e36c2a3..f21075c 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c
@@ -450,7 +450,7 @@ static void mmu_l1_unmap(struct isp_mmu *mmu, phys_addr_t 
l1_pt,
ptr = end;
}
/*
-* use the same L2 page next time, so we dont
+* use the same L2 page next time, so we don't
 * need to invalidate and free this PT.
 */
/*  atomisp_set_pte(l1_pt, idx, NULL_PTE); */
-- 
2.7.4



[PATCH 2/3] staging: media: Replace "cant" with "can't"

2018-03-04 Thread Arushi Singhal
Replace "cant" with "can't".
"cant" is not same as "Can not" or "Can't".

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c 
b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
index bffe215..634d38c 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
@@ -444,7 +444,7 @@ static int vpfe_register_entities(struct vpfe_device 
*vpfe_dev)
for (i = 0; i < vpfe_dev->num_ext_subdevs; i++)
/*
 * if entity has no pads (ex: amplifier),
-* cant establish link
+* can't establish link
 */
if (vpfe_dev->sd[i]->entity.num_pads) {
ret = media_create_pad_link(_dev->sd[i]->entity,
-- 
2.7.4



[PATCH 2/3] staging: media: Replace "cant" with "can't"

2018-03-04 Thread Arushi Singhal
Replace "cant" with "can't".
"cant" is not same as "Can not" or "Can't".

Signed-off-by: Arushi Singhal 
---
 drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c 
b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
index bffe215..634d38c 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
@@ -444,7 +444,7 @@ static int vpfe_register_entities(struct vpfe_device 
*vpfe_dev)
for (i = 0; i < vpfe_dev->num_ext_subdevs; i++)
/*
 * if entity has no pads (ex: amplifier),
-* cant establish link
+* can't establish link
 */
if (vpfe_dev->sd[i]->entity.num_pads) {
ret = media_create_pad_link(_dev->sd[i]->entity,
-- 
2.7.4



[PATCH 1/3] staging: media: Replace "be be" with "be"

2018-03-04 Thread Arushi Singhal
This patch replace "be be" with "be".

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe_public.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe_public.h 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe_public.h
index df0aad9..4057a5a 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe_public.h
+++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe_public.h
@@ -402,7 +402,7 @@ ia_css_pipe_set_isp_config(struct ia_css_pipe *pipe,
  exception holds for IA_CSS_EVENT_TYPE_PORT_EOF, for this event an IRQ is 
always
  raised.
  Note that events are still queued and the Host can poll for them. The
- or_mask and and_mask may be be active at the same time\n
+ or_mask and and_mask may be active at the same time\n
  \n
  Default values, for all pipe id's, after ia_css_init:\n
  or_mask = IA_CSS_EVENT_TYPE_ALL\n
-- 
2.7.4



[PATCH 1/3] staging: media: Replace "be be" with "be"

2018-03-04 Thread Arushi Singhal
This patch replace "be be" with "be".

Signed-off-by: Arushi Singhal 
---
 drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe_public.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe_public.h 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe_public.h
index df0aad9..4057a5a 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe_public.h
+++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe_public.h
@@ -402,7 +402,7 @@ ia_css_pipe_set_isp_config(struct ia_css_pipe *pipe,
  exception holds for IA_CSS_EVENT_TYPE_PORT_EOF, for this event an IRQ is 
always
  raised.
  Note that events are still queued and the Host can poll for them. The
- or_mask and and_mask may be be active at the same time\n
+ or_mask and and_mask may be active at the same time\n
  \n
  Default values, for all pipe id's, after ia_css_init:\n
  or_mask = IA_CSS_EVENT_TYPE_ALL\n
-- 
2.7.4



[PATCH 0/3] staging: media: cleanup

2018-03-04 Thread Arushi Singhal
Spellcheck the comments.
Remove the repeated, consecutive words with single word.

Arushi Singhal (3):
  staging: media: Replace "be be" with "be"
  staging: media: Replace "cant" with "can't"
  staging: media: Replace "dont" with "don't"

 drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe_public.h | 2 +-
 drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c| 2 +-
 drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c| 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.7.4



[PATCH 0/3] staging: media: cleanup

2018-03-04 Thread Arushi Singhal
Spellcheck the comments.
Remove the repeated, consecutive words with single word.

Arushi Singhal (3):
  staging: media: Replace "be be" with "be"
  staging: media: Replace "cant" with "can't"
  staging: media: Replace "dont" with "don't"

 drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe_public.h | 2 +-
 drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c| 2 +-
 drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c| 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.7.4



[PATCH 0/3] staging: lustre: cleanup

2018-03-04 Thread Arushi Singhal
Spellcheck the comments. 
Remove the repeated, consecutive words with single word.

Arushi Singhal (3):
  staging: lustre: Replace "be be" with "be"
  staging: lustre: Replace "to to" with "to"
  staging: lustre: Replace "dont" with "don't"

 drivers/staging/lustre/lnet/libcfs/debug.c | 2 +-
 drivers/staging/lustre/lustre/fld/fld_cache.c  | 2 +-
 drivers/staging/lustre/lustre/include/cl_object.h  | 2 +-
 drivers/staging/lustre/lustre/include/lprocfs_status.h | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.7.4



[PATCH 0/3] staging: lustre: cleanup

2018-03-04 Thread Arushi Singhal
Spellcheck the comments. 
Remove the repeated, consecutive words with single word.

Arushi Singhal (3):
  staging: lustre: Replace "be be" with "be"
  staging: lustre: Replace "to to" with "to"
  staging: lustre: Replace "dont" with "don't"

 drivers/staging/lustre/lnet/libcfs/debug.c | 2 +-
 drivers/staging/lustre/lustre/fld/fld_cache.c  | 2 +-
 drivers/staging/lustre/lustre/include/cl_object.h  | 2 +-
 drivers/staging/lustre/lustre/include/lprocfs_status.h | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.7.4



[PATCH 3/3] staging: lustre: Replace "dont" with "don't"

2018-03-04 Thread Arushi Singhal
Replace "dont" with "don't".
"Dont" is not same as "Do not" or "Don't".

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/staging/lustre/lustre/fld/fld_cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/fld/fld_cache.c 
b/drivers/staging/lustre/lustre/fld/fld_cache.c
index ecf8b9e..2d61ca4 100644
--- a/drivers/staging/lustre/lustre/fld/fld_cache.c
+++ b/drivers/staging/lustre/lustre/fld/fld_cache.c
@@ -263,7 +263,7 @@ static void fld_cache_punch_hole(struct fld_cache *cache,
fldt = kzalloc(sizeof(*fldt), GFP_ATOMIC);
if (!fldt) {
kfree(f_new);
-   /* overlap is not allowed, so dont mess up list. */
+   /* overlap is not allowed, so don't mess up list. */
return;
}
/*  break f_curr RANGE into three RANGES:
-- 
2.7.4



[PATCH 1/3] staging: lustre: Replace "be be" with "be"

2018-03-04 Thread Arushi Singhal
This patch replace "be be" with "be".

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/staging/lustre/lnet/libcfs/debug.c | 2 +-
 drivers/staging/lustre/lustre/include/lprocfs_status.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/libcfs/debug.c 
b/drivers/staging/lustre/lnet/libcfs/debug.c
index c70d2ae..1371224 100644
--- a/drivers/staging/lustre/lnet/libcfs/debug.c
+++ b/drivers/staging/lustre/lnet/libcfs/debug.c
@@ -440,7 +440,7 @@ int libcfs_debug_clear_buffer(void)
return 0;
 }
 
-/* Debug markers, although printed by S_LNET should not be be marked as such. 
*/
+/* Debug markers, although printed by S_LNET should not be marked as such. */
 #undef DEBUG_SUBSYSTEM
 #define DEBUG_SUBSYSTEM S_UNDEFINED
 int libcfs_debug_mark_buffer(const char *text)
diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h 
b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 835a729..426e8f3 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -114,7 +114,7 @@ struct rename_stats {
  * LPROCFS_CNTR_AVGMINMAX indicates a multi-valued counter samples,
  * (i.e. counter can be incremented by more than "1"). When specified,
  * the counter maintains min, max and sum in addition to a simple
- * invocation count. This allows averages to be be computed.
+ * invocation count. This allows averages to be computed.
  * If not specified, the counter is an increment-by-1 counter.
  * min, max, sum, etc. are not maintained.
  *
-- 
2.7.4



[PATCH 2/3] staging: lustre: Replace "to to" with "to"

2018-03-04 Thread Arushi Singhal
This patch replace "to to" with "to".

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/staging/lustre/lustre/include/cl_object.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/include/cl_object.h 
b/drivers/staging/lustre/lustre/include/cl_object.h
index 90419dc..341a145 100644
--- a/drivers/staging/lustre/lustre/include/cl_object.h
+++ b/drivers/staging/lustre/lustre/include/cl_object.h
@@ -1833,7 +1833,7 @@ struct cl_io {
 */
 ci_verify_layout:1,
/**
-* file is released, restore has to to be triggered by vvp layer
+* file is released, restore has to be triggered by vvp layer
 */
 ci_restore_needed:1,
/**
-- 
2.7.4



[PATCH 1/3] staging: lustre: Replace "be be" with "be"

2018-03-04 Thread Arushi Singhal
This patch replace "be be" with "be".

Signed-off-by: Arushi Singhal 
---
 drivers/staging/lustre/lnet/libcfs/debug.c | 2 +-
 drivers/staging/lustre/lustre/include/lprocfs_status.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/libcfs/debug.c 
b/drivers/staging/lustre/lnet/libcfs/debug.c
index c70d2ae..1371224 100644
--- a/drivers/staging/lustre/lnet/libcfs/debug.c
+++ b/drivers/staging/lustre/lnet/libcfs/debug.c
@@ -440,7 +440,7 @@ int libcfs_debug_clear_buffer(void)
return 0;
 }
 
-/* Debug markers, although printed by S_LNET should not be be marked as such. 
*/
+/* Debug markers, although printed by S_LNET should not be marked as such. */
 #undef DEBUG_SUBSYSTEM
 #define DEBUG_SUBSYSTEM S_UNDEFINED
 int libcfs_debug_mark_buffer(const char *text)
diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h 
b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 835a729..426e8f3 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -114,7 +114,7 @@ struct rename_stats {
  * LPROCFS_CNTR_AVGMINMAX indicates a multi-valued counter samples,
  * (i.e. counter can be incremented by more than "1"). When specified,
  * the counter maintains min, max and sum in addition to a simple
- * invocation count. This allows averages to be be computed.
+ * invocation count. This allows averages to be computed.
  * If not specified, the counter is an increment-by-1 counter.
  * min, max, sum, etc. are not maintained.
  *
-- 
2.7.4



[PATCH 2/3] staging: lustre: Replace "to to" with "to"

2018-03-04 Thread Arushi Singhal
This patch replace "to to" with "to".

Signed-off-by: Arushi Singhal 
---
 drivers/staging/lustre/lustre/include/cl_object.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/include/cl_object.h 
b/drivers/staging/lustre/lustre/include/cl_object.h
index 90419dc..341a145 100644
--- a/drivers/staging/lustre/lustre/include/cl_object.h
+++ b/drivers/staging/lustre/lustre/include/cl_object.h
@@ -1833,7 +1833,7 @@ struct cl_io {
 */
 ci_verify_layout:1,
/**
-* file is released, restore has to to be triggered by vvp layer
+* file is released, restore has to be triggered by vvp layer
 */
 ci_restore_needed:1,
/**
-- 
2.7.4



[PATCH 3/3] staging: lustre: Replace "dont" with "don't"

2018-03-04 Thread Arushi Singhal
Replace "dont" with "don't".
"Dont" is not same as "Do not" or "Don't".

Signed-off-by: Arushi Singhal 
---
 drivers/staging/lustre/lustre/fld/fld_cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/fld/fld_cache.c 
b/drivers/staging/lustre/lustre/fld/fld_cache.c
index ecf8b9e..2d61ca4 100644
--- a/drivers/staging/lustre/lustre/fld/fld_cache.c
+++ b/drivers/staging/lustre/lustre/fld/fld_cache.c
@@ -263,7 +263,7 @@ static void fld_cache_punch_hole(struct fld_cache *cache,
fldt = kzalloc(sizeof(*fldt), GFP_ATOMIC);
if (!fldt) {
kfree(f_new);
-   /* overlap is not allowed, so dont mess up list. */
+   /* overlap is not allowed, so don't mess up list. */
return;
}
/*  break f_curr RANGE into three RANGES:
-- 
2.7.4



[PATCH] staging: comedi: "dont" is changed to "don't"

2018-03-04 Thread Arushi Singhal
"dont" is changed to "don't" in messages, "dont" is not correct
english.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/staging/comedi/drivers/cb_pcidas64.c | 2 +-
 drivers/staging/comedi/drivers/das16.c   | 2 +-
 drivers/staging/comedi/drivers/das16m1.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
b/drivers/staging/comedi/drivers/cb_pcidas64.c
index c007500..ceef905 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -1700,7 +1700,7 @@ static void i2c_write(struct comedi_device *dev, unsigned 
int address,
 * eeprom and i2c bus
 */
 
-   /* make sure we dont send anything to eeprom */
+   /* make sure we don't send anything to eeprom */
devpriv->plx_control_bits &= ~PLX_CNTRL_EECS;
 
i2c_stop(dev);
diff --git a/drivers/staging/comedi/drivers/das16.c 
b/drivers/staging/comedi/drivers/das16.c
index 74ff204..81eb51b 100644
--- a/drivers/staging/comedi/drivers/das16.c
+++ b/drivers/staging/comedi/drivers/das16.c
@@ -619,7 +619,7 @@ static int das16_cmd_test(struct comedi_device *dev, struct 
comedi_subdevice *s,
 
/* Step 2b : and mutually compatible */
 
-   /*  make sure scan_begin_src and convert_src dont conflict */
+   /*  make sure scan_begin_src and convert_src don't conflict */
if (cmd->scan_begin_src == TRIG_FOLLOW && cmd->convert_src == TRIG_NOW)
err |= -EINVAL;
if (cmd->scan_begin_src != TRIG_FOLLOW && cmd->convert_src != TRIG_NOW)
diff --git a/drivers/staging/comedi/drivers/das16m1.c 
b/drivers/staging/comedi/drivers/das16m1.c
index 72f8ed2..4e36377 100644
--- a/drivers/staging/comedi/drivers/das16m1.c
+++ b/drivers/staging/comedi/drivers/das16m1.c
@@ -407,7 +407,7 @@ static void das16m1_handler(struct comedi_device *dev, 
unsigned int status)
if (num_samples > cmd->stop_arg * cmd->chanlist_len)
num_samples = cmd->stop_arg * cmd->chanlist_len;
}
-   /*  make sure we dont try to get too many points if fifo has overrun */
+   /*  make sure we don't try to get too many points if fifo has overrun */
if (num_samples > DAS16M1_AI_FIFO_SZ)
num_samples = DAS16M1_AI_FIFO_SZ;
insw(dev->iobase, devpriv->ai_buffer, num_samples);
-- 
2.7.4



[PATCH] staging: comedi: "dont" is changed to "don't"

2018-03-04 Thread Arushi Singhal
"dont" is changed to "don't" in messages, "dont" is not correct
english.

Signed-off-by: Arushi Singhal 
---
 drivers/staging/comedi/drivers/cb_pcidas64.c | 2 +-
 drivers/staging/comedi/drivers/das16.c   | 2 +-
 drivers/staging/comedi/drivers/das16m1.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
b/drivers/staging/comedi/drivers/cb_pcidas64.c
index c007500..ceef905 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -1700,7 +1700,7 @@ static void i2c_write(struct comedi_device *dev, unsigned 
int address,
 * eeprom and i2c bus
 */
 
-   /* make sure we dont send anything to eeprom */
+   /* make sure we don't send anything to eeprom */
devpriv->plx_control_bits &= ~PLX_CNTRL_EECS;
 
i2c_stop(dev);
diff --git a/drivers/staging/comedi/drivers/das16.c 
b/drivers/staging/comedi/drivers/das16.c
index 74ff204..81eb51b 100644
--- a/drivers/staging/comedi/drivers/das16.c
+++ b/drivers/staging/comedi/drivers/das16.c
@@ -619,7 +619,7 @@ static int das16_cmd_test(struct comedi_device *dev, struct 
comedi_subdevice *s,
 
/* Step 2b : and mutually compatible */
 
-   /*  make sure scan_begin_src and convert_src dont conflict */
+   /*  make sure scan_begin_src and convert_src don't conflict */
if (cmd->scan_begin_src == TRIG_FOLLOW && cmd->convert_src == TRIG_NOW)
err |= -EINVAL;
if (cmd->scan_begin_src != TRIG_FOLLOW && cmd->convert_src != TRIG_NOW)
diff --git a/drivers/staging/comedi/drivers/das16m1.c 
b/drivers/staging/comedi/drivers/das16m1.c
index 72f8ed2..4e36377 100644
--- a/drivers/staging/comedi/drivers/das16m1.c
+++ b/drivers/staging/comedi/drivers/das16m1.c
@@ -407,7 +407,7 @@ static void das16m1_handler(struct comedi_device *dev, 
unsigned int status)
if (num_samples > cmd->stop_arg * cmd->chanlist_len)
num_samples = cmd->stop_arg * cmd->chanlist_len;
}
-   /*  make sure we dont try to get too many points if fifo has overrun */
+   /*  make sure we don't try to get too many points if fifo has overrun */
if (num_samples > DAS16M1_AI_FIFO_SZ)
num_samples = DAS16M1_AI_FIFO_SZ;
insw(dev->iobase, devpriv->ai_buffer, num_samples);
-- 
2.7.4



[PATCH] staging: ipx: Replace printk() with appropriate pr_*() macro

2018-03-04 Thread Arushi Singhal
Using pr_() is more concise than printk(KERN_).
Replace printks having a log level with the appropriate pr_*() macros.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/staging/ipx/af_ipx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ipx/af_ipx.c b/drivers/staging/ipx/af_ipx.c
index d21a9d1..27f4461 100644
--- a/drivers/staging/ipx/af_ipx.c
+++ b/drivers/staging/ipx/af_ipx.c
@@ -744,7 +744,7 @@ static void ipxitf_discover_netnum(struct ipx_interface 
*intrfc,
intrfc->if_netnum = cb->ipx_source_net;
ipxitf_add_local_route(intrfc);
} else {
-   printk(KERN_WARNING "IPX: Network number collision "
+   pr_warn("IPX: Network number collision "
"%lx\n%s %s and %s %s\n",
(unsigned long) ntohl(cb->ipx_source_net),
ipx_device_name(i),
-- 
2.7.4



[PATCH] staging: ipx: Replace printk() with appropriate pr_*() macro

2018-03-04 Thread Arushi Singhal
Using pr_() is more concise than printk(KERN_).
Replace printks having a log level with the appropriate pr_*() macros.

Signed-off-by: Arushi Singhal 
---
 drivers/staging/ipx/af_ipx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ipx/af_ipx.c b/drivers/staging/ipx/af_ipx.c
index d21a9d1..27f4461 100644
--- a/drivers/staging/ipx/af_ipx.c
+++ b/drivers/staging/ipx/af_ipx.c
@@ -744,7 +744,7 @@ static void ipxitf_discover_netnum(struct ipx_interface 
*intrfc,
intrfc->if_netnum = cb->ipx_source_net;
ipxitf_add_local_route(intrfc);
} else {
-   printk(KERN_WARNING "IPX: Network number collision "
+   pr_warn("IPX: Network number collision "
"%lx\n%s %s and %s %s\n",
(unsigned long) ntohl(cb->ipx_source_net),
ipx_device_name(i),
-- 
2.7.4



[PATCH] staging: rtl8723bs: Replace memset with eth_zero_addr

2018-03-03 Thread Arushi Singhal
Use eth_zero_addr to assign zero address to the given address array
instead of memset when the second argument in memset is address
of zero. Coccinelle was used to do the replacement and add the
header file linux/etherdevice.h if not already present.

The Coccinelle semantic patch that makes this change is as follows:
@header@
@@
#include 

@r1@
expression e;
@@

-memset(e,0x00,ETH_ALEN);
+eth_zero_addr(e);

@includeheader depends on r1 && !header@
@@
+ #include 
#include <...> 

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 ++-
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 3 ++-
 drivers/staging/rtl8723bs/os_dep/ioctl_linux.c| 9 +
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index fe739eb..c13e514 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -14,6 +14,7 @@
  
**/
 #define _RTW_MLME_C_
 
+#include 
 #include 
 #include 
 #include 
@@ -2109,7 +2110,7 @@ int rtw_select_roaming_candidate(struct mlme_priv *mlme)
mlme->roam_network = candidate;
 
if (!memcmp(candidate->network.MacAddress, mlme->roam_tgt_addr, 
ETH_ALEN))
-   memset(mlme->roam_tgt_addr, 0, ETH_ALEN);
+   eth_zero_addr(mlme->roam_tgt_addr);
}
 
ret = _SUCCESS;
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 1e6c587..75a4b23 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -14,6 +14,7 @@
  
**/
 #define  _IOCTL_CFG80211_C_
 
+#include 
 #include 
 #include 
 #include 
@@ -2391,7 +2392,7 @@ static int cfg80211_rtw_del_pmksa(struct wiphy *wiphy,
{
if (!memcmp(psecuritypriv->PMKIDList[index].Bssid, (u8 
*)pmksa->bssid, ETH_ALEN))
{ /*  BSSID is matched, the same AP => Remove this PMKID 
information and reset it. */
-   memset(psecuritypriv->PMKIDList[index].Bssid, 0x00, 
ETH_ALEN);
+   eth_zero_addr(psecuritypriv->PMKIDList[index].Bssid);
memset(psecuritypriv->PMKIDList[index].PMKID, 0x00, 
WLAN_PMKID_LEN);
psecuritypriv->PMKIDList[index].bUsed = false;
bMatched = true;
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index cc18d0a..bf437c8 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -14,6 +14,7 @@
  
**/
 #define _IOCTL_LINUX_C_
 
+#include 
 #include 
 #include 
 #include 
@@ -124,7 +125,7 @@ void rtw_indicate_wx_disassoc_event(struct adapter 
*padapter)
memset(, 0, sizeof(union iwreq_data));
 
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
-   memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
+   eth_zero_addr(wrqu.ap_addr.sa_data);
 }
 
 /*
@@ -1080,7 +1081,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev,
for (j = 0 ; j<NUM_PMKID_CACHE; j++) {
if (!memcmp(psecuritypriv->PMKIDList[j].Bssid, 
strIssueBssid, ETH_ALEN)) {
/*  BSSID is matched, the same AP => Remove 
this PMKID information and reset it. */
-memset(psecuritypriv->PMKIDList[ j ].Bssid, 
0x00, ETH_ALEN);
+
eth_zero_addr(psecuritypriv->PMKIDList[j].Bssid);
 psecuritypriv->PMKIDList[ j ].bUsed = false;
break;
}
@@ -1294,7 +1295,7 @@ static int rtw_wx_get_wap(struct net_device *dev,
 
wrqu->ap_addr.sa_family = ARPHRD_ETHER;
 
-   memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
+   eth_zero_addr(wrqu->ap_addr.sa_data);
 
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("rtw_wx_get_wap\n"));
 
@@ -1303,7 +1304,7 @@ static int rtw_wx_get_wap(struct net_device *dev,
((check_fwstate(pmlmepriv, WIFI_AP_STATE)) == true)) {
memcpy(wrqu->ap_addr.sa_data, pcur_bss->MacAddress, ETH_ALEN);
} else {
-   memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
+   eth_zero_addr(wrqu->ap_addr.sa_data);
}
 
return 0;
-- 
2.7.4



[PATCH] staging: rtl8723bs: Replace memset with eth_zero_addr

2018-03-03 Thread Arushi Singhal
Use eth_zero_addr to assign zero address to the given address array
instead of memset when the second argument in memset is address
of zero. Coccinelle was used to do the replacement and add the
header file linux/etherdevice.h if not already present.

The Coccinelle semantic patch that makes this change is as follows:
@header@
@@
#include 

@r1@
expression e;
@@

-memset(e,0x00,ETH_ALEN);
+eth_zero_addr(e);

@includeheader depends on r1 && !header@
@@
+ #include 
#include <...> 

Signed-off-by: Arushi Singhal 
---
 drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 ++-
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 3 ++-
 drivers/staging/rtl8723bs/os_dep/ioctl_linux.c| 9 +
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index fe739eb..c13e514 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -14,6 +14,7 @@
  
**/
 #define _RTW_MLME_C_
 
+#include 
 #include 
 #include 
 #include 
@@ -2109,7 +2110,7 @@ int rtw_select_roaming_candidate(struct mlme_priv *mlme)
mlme->roam_network = candidate;
 
if (!memcmp(candidate->network.MacAddress, mlme->roam_tgt_addr, 
ETH_ALEN))
-   memset(mlme->roam_tgt_addr, 0, ETH_ALEN);
+   eth_zero_addr(mlme->roam_tgt_addr);
}
 
ret = _SUCCESS;
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 1e6c587..75a4b23 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -14,6 +14,7 @@
  
**/
 #define  _IOCTL_CFG80211_C_
 
+#include 
 #include 
 #include 
 #include 
@@ -2391,7 +2392,7 @@ static int cfg80211_rtw_del_pmksa(struct wiphy *wiphy,
{
if (!memcmp(psecuritypriv->PMKIDList[index].Bssid, (u8 
*)pmksa->bssid, ETH_ALEN))
{ /*  BSSID is matched, the same AP => Remove this PMKID 
information and reset it. */
-   memset(psecuritypriv->PMKIDList[index].Bssid, 0x00, 
ETH_ALEN);
+   eth_zero_addr(psecuritypriv->PMKIDList[index].Bssid);
memset(psecuritypriv->PMKIDList[index].PMKID, 0x00, 
WLAN_PMKID_LEN);
psecuritypriv->PMKIDList[index].bUsed = false;
bMatched = true;
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index cc18d0a..bf437c8 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -14,6 +14,7 @@
  
**/
 #define _IOCTL_LINUX_C_
 
+#include 
 #include 
 #include 
 #include 
@@ -124,7 +125,7 @@ void rtw_indicate_wx_disassoc_event(struct adapter 
*padapter)
memset(, 0, sizeof(union iwreq_data));
 
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
-   memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
+   eth_zero_addr(wrqu.ap_addr.sa_data);
 }
 
 /*
@@ -1080,7 +1081,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev,
for (j = 0 ; jPMKIDList[j].Bssid, 
strIssueBssid, ETH_ALEN)) {
/*  BSSID is matched, the same AP => Remove 
this PMKID information and reset it. */
-memset(psecuritypriv->PMKIDList[ j ].Bssid, 
0x00, ETH_ALEN);
+
eth_zero_addr(psecuritypriv->PMKIDList[j].Bssid);
 psecuritypriv->PMKIDList[ j ].bUsed = false;
break;
}
@@ -1294,7 +1295,7 @@ static int rtw_wx_get_wap(struct net_device *dev,
 
wrqu->ap_addr.sa_family = ARPHRD_ETHER;
 
-   memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
+   eth_zero_addr(wrqu->ap_addr.sa_data);
 
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("rtw_wx_get_wap\n"));
 
@@ -1303,7 +1304,7 @@ static int rtw_wx_get_wap(struct net_device *dev,
((check_fwstate(pmlmepriv, WIFI_AP_STATE)) == true)) {
memcpy(wrqu->ap_addr.sa_data, pcur_bss->MacAddress, ETH_ALEN);
} else {
-   memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
+   eth_zero_addr(wrqu->ap_addr.sa_data);
}
 
return 0;
-- 
2.7.4



[PATCH] staging: media: Remove unnecessary semicolon

2018-03-03 Thread Arushi Singhal
Remove unnecessary semicolon found using semicolon.cocci Coccinelle
script.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 .../media/atomisp/pci/atomisp2/css2400/runtime/frame/src/frame.c| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/frame/src/frame.c 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/frame/src/frame.c
index 5faa89a..7562bea 100644
--- 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/frame/src/frame.c
+++ 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/frame/src/frame.c
@@ -196,7 +196,7 @@ enum ia_css_err ia_css_frame_map(struct ia_css_frame 
**frame,
  attribute, context);
if (me->data == mmgr_NULL)
err = IA_CSS_ERR_INVALID_ARGUMENTS;
-   };
+   }
 
if (err != IA_CSS_SUCCESS) {
sh_css_free(me);
-- 
2.7.4



[PATCH] staging: media: Remove unnecessary semicolon

2018-03-03 Thread Arushi Singhal
Remove unnecessary semicolon found using semicolon.cocci Coccinelle
script.

Signed-off-by: Arushi Singhal 
---
 .../media/atomisp/pci/atomisp2/css2400/runtime/frame/src/frame.c| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/frame/src/frame.c 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/frame/src/frame.c
index 5faa89a..7562bea 100644
--- 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/frame/src/frame.c
+++ 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/frame/src/frame.c
@@ -196,7 +196,7 @@ enum ia_css_err ia_css_frame_map(struct ia_css_frame 
**frame,
  attribute, context);
if (me->data == mmgr_NULL)
err = IA_CSS_ERR_INVALID_ARGUMENTS;
-   };
+   }
 
if (err != IA_CSS_SUCCESS) {
sh_css_free(me);
-- 
2.7.4



[PATCH] staging: rtl8723bs: Remove unnecessary semicolon.

2018-03-03 Thread Arushi Singhal
Remove unnecessary semicolon using semicolon.cocci Coccinelle script.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_recv.c   | 2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c 
b/drivers/staging/rtl8723bs/core/rtw_recv.c
index 9c7c3be..86f995b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -1785,7 +1785,7 @@ static union recv_frame *recvframe_defrag(struct adapter 
*adapter,
pfhdr->attrib.icv_len = pnfhdr->attrib.icv_len;
plist = get_next(plist);
 
-   };
+   }
 
/* free the defrag_q queue and return the prframe */
rtw_free_recvframe_queue(defrag_q, pfree_recv_queue);
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c 
b/drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c
index a71b552..f6aeb26 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c
@@ -163,7 +163,7 @@ static int phy_RF6052_Config_ParaFile(struct adapter 
*Adapter)
break;
}
 
-   /*Restore RFENV control type*/;
+   /*Restore RFENV control type*/
switch (eRFPath) {
case RF_PATH_A:
case RF_PATH_C:
-- 
2.7.4



[PATCH] staging: rtl8723bs: Remove unnecessary semicolon.

2018-03-03 Thread Arushi Singhal
Remove unnecessary semicolon using semicolon.cocci Coccinelle script.

Signed-off-by: Arushi Singhal 
---
 drivers/staging/rtl8723bs/core/rtw_recv.c   | 2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c 
b/drivers/staging/rtl8723bs/core/rtw_recv.c
index 9c7c3be..86f995b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -1785,7 +1785,7 @@ static union recv_frame *recvframe_defrag(struct adapter 
*adapter,
pfhdr->attrib.icv_len = pnfhdr->attrib.icv_len;
plist = get_next(plist);
 
-   };
+   }
 
/* free the defrag_q queue and return the prframe */
rtw_free_recvframe_queue(defrag_q, pfree_recv_queue);
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c 
b/drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c
index a71b552..f6aeb26 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c
@@ -163,7 +163,7 @@ static int phy_RF6052_Config_ParaFile(struct adapter 
*Adapter)
break;
}
 
-   /*Restore RFENV control type*/;
+   /*Restore RFENV control type*/
switch (eRFPath) {
case RF_PATH_A:
case RF_PATH_C:
-- 
2.7.4



[PATCH] staging: rtlwifi: Remove nonessential semicolon

2018-03-03 Thread Arushi Singhal
Remove non-essential semicolon after 'else' and 'switch' statements. Issue
found using semicolon.cocci Coccinelle script.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 drivers/staging/rtlwifi/base.c   | 6 +++---
 drivers/staging/rtlwifi/phydm/phydm_rainfo.c | 1 -
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtlwifi/base.c b/drivers/staging/rtlwifi/base.c
index c947def..eea0003 100644
--- a/drivers/staging/rtlwifi/base.c
+++ b/drivers/staging/rtlwifi/base.c
@@ -710,20 +710,20 @@ u8 rtl_mrate_idx_to_arfr_id(
ret = RATEID_IDX_BGN_40M_1SS;
else
ret = RATEID_IDX_BGN_40M_2SS;
-   ; break;
+   break;
case RATR_INX_WIRELESS_N:
case RATR_INX_WIRELESS_NG:
if (rtlphy->rf_type == RF_1T1R)
ret = RATEID_IDX_GN_N1SS;
else
ret = RATEID_IDX_GN_N2SS;
-   ; break;
+   break;
case RATR_INX_WIRELESS_NB:
if (rtlphy->rf_type == RF_1T1R)
ret = RATEID_IDX_BGN_20M_1SS_BN;
else
ret = RATEID_IDX_BGN_20M_2SS_BN;
-   ; break;
+   break;
case RATR_INX_WIRELESS_GB:
ret = RATEID_IDX_BG;
break;
diff --git a/drivers/staging/rtlwifi/phydm/phydm_rainfo.c 
b/drivers/staging/rtlwifi/phydm/phydm_rainfo.c
index 8c08c76..e10a91a 100644
--- a/drivers/staging/rtlwifi/phydm/phydm_rainfo.c
+++ b/drivers/staging/rtlwifi/phydm/phydm_rainfo.c
@@ -142,7 +142,6 @@ void odm_c2h_ra_para_report_handler(void *dm_void, u8 
*cmd_buf, u8 cmd_len)
 "SGI_support =", cmd_buf[7]);
ODM_RT_TRACE(dm, ODM_FW_DEBUG_TRACE, "%5s  %d\n",
 "Rate_ID =", cmd_buf[8]);
-   ;
}
ODM_RT_TRACE(dm, ODM_FW_DEBUG_TRACE,
 "---\n");
-- 
2.7.4



[PATCH] staging: rtlwifi: Remove nonessential semicolon

2018-03-03 Thread Arushi Singhal
Remove non-essential semicolon after 'else' and 'switch' statements. Issue
found using semicolon.cocci Coccinelle script.

Signed-off-by: Arushi Singhal 
---
 drivers/staging/rtlwifi/base.c   | 6 +++---
 drivers/staging/rtlwifi/phydm/phydm_rainfo.c | 1 -
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtlwifi/base.c b/drivers/staging/rtlwifi/base.c
index c947def..eea0003 100644
--- a/drivers/staging/rtlwifi/base.c
+++ b/drivers/staging/rtlwifi/base.c
@@ -710,20 +710,20 @@ u8 rtl_mrate_idx_to_arfr_id(
ret = RATEID_IDX_BGN_40M_1SS;
else
ret = RATEID_IDX_BGN_40M_2SS;
-   ; break;
+   break;
case RATR_INX_WIRELESS_N:
case RATR_INX_WIRELESS_NG:
if (rtlphy->rf_type == RF_1T1R)
ret = RATEID_IDX_GN_N1SS;
else
ret = RATEID_IDX_GN_N2SS;
-   ; break;
+   break;
case RATR_INX_WIRELESS_NB:
if (rtlphy->rf_type == RF_1T1R)
ret = RATEID_IDX_BGN_20M_1SS_BN;
else
ret = RATEID_IDX_BGN_20M_2SS_BN;
-   ; break;
+   break;
case RATR_INX_WIRELESS_GB:
ret = RATEID_IDX_BG;
break;
diff --git a/drivers/staging/rtlwifi/phydm/phydm_rainfo.c 
b/drivers/staging/rtlwifi/phydm/phydm_rainfo.c
index 8c08c76..e10a91a 100644
--- a/drivers/staging/rtlwifi/phydm/phydm_rainfo.c
+++ b/drivers/staging/rtlwifi/phydm/phydm_rainfo.c
@@ -142,7 +142,6 @@ void odm_c2h_ra_para_report_handler(void *dm_void, u8 
*cmd_buf, u8 cmd_len)
 "SGI_support =", cmd_buf[7]);
ODM_RT_TRACE(dm, ODM_FW_DEBUG_TRACE, "%5s  %d\n",
 "Rate_ID =", cmd_buf[8]);
-   ;
}
ODM_RT_TRACE(dm, ODM_FW_DEBUG_TRACE,
 "---\n");
-- 
2.7.4



[PATCH v2] infiniband: hw: Drop unnecessary continue

2018-03-03 Thread Arushi Singhal
Continue at the bottom of a loop are removed.
Issue found using drop_continue.cocci Coccinelle script.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
Changes in v2:
- Braces is dropped from if with single statement.

 drivers/infiniband/hw/qib/qib_init.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/qib/qib_init.c 
b/drivers/infiniband/hw/qib/qib_init.c
index 3990f38..6c68f8a 100644
--- a/drivers/infiniband/hw/qib/qib_init.c
+++ b/drivers/infiniband/hw/qib/qib_init.c
@@ -678,11 +678,9 @@ int qib_init(struct qib_devdata *dd, int reinit)
lastfail = qib_create_rcvhdrq(dd, rcd);
if (!lastfail)
lastfail = qib_setup_eagerbufs(rcd);
-   if (lastfail) {
+   if (lastfail)
qib_dev_err(dd,
"failed to allocate kernel ctxt's rcvhdrq 
and/or egr bufs\n");
-   continue;
-   }
}
 
for (pidx = 0; pidx < dd->num_pports; ++pidx) {
-- 
2.7.4



[PATCH v2] infiniband: hw: Drop unnecessary continue

2018-03-03 Thread Arushi Singhal
Continue at the bottom of a loop are removed.
Issue found using drop_continue.cocci Coccinelle script.

Signed-off-by: Arushi Singhal 
---
Changes in v2:
- Braces is dropped from if with single statement.

 drivers/infiniband/hw/qib/qib_init.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/qib/qib_init.c 
b/drivers/infiniband/hw/qib/qib_init.c
index 3990f38..6c68f8a 100644
--- a/drivers/infiniband/hw/qib/qib_init.c
+++ b/drivers/infiniband/hw/qib/qib_init.c
@@ -678,11 +678,9 @@ int qib_init(struct qib_devdata *dd, int reinit)
lastfail = qib_create_rcvhdrq(dd, rcd);
if (!lastfail)
lastfail = qib_setup_eagerbufs(rcd);
-   if (lastfail) {
+   if (lastfail)
qib_dev_err(dd,
"failed to allocate kernel ctxt's rcvhdrq 
and/or egr bufs\n");
-   continue;
-   }
}
 
for (pidx = 0; pidx < dd->num_pports; ++pidx) {
-- 
2.7.4



  1   2   3   4   5   6   7   8   >