Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1614097 > unrolled thread
| Started by | simran singhal <singhalsimran0@gmail.com> |
|---|---|
| First post | 2017-03-31 17:20 +0200 |
| Last post | 2017-04-02 10:50 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 2/3] staging: iio: frequency: Remove useless type conversion simran singhal <singhalsimran0@gmail.com> - 2017-03-31 17:20 +0200
Re: [PATCH 2/3] staging: iio: frequency: Remove useless type conversion Jonathan Cameron <jic23@kernel.org> - 2017-04-02 10:50 +0200
| From | simran singhal <singhalsimran0@gmail.com> |
|---|---|
| Date | 2017-03-31 17:20 +0200 |
| Subject | [PATCH 2/3] staging: iio: frequency: Remove useless type conversion |
| Message-ID | <tr6vg-6i4-9@gated-at.bofh.it> |
Some type conversions like casting a pointer to a pointer of same type,
casting to the original type using addressof(&) operator etc. are not
needed. Therefore, remove them. Done using coccinelle:
@@
type t;
t *p;
t a;
@@
(
- (t)(a)
+ a
|
- (t *)(p)
+ p
|
- (t *)(&a)
+ &a
)
Signed-off-by: simran singhal <singhalsimran0@gmail.com>
---
drivers/staging/iio/frequency/ad9832.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c
index 425b8ab..01bdf8e 100644
--- a/drivers/staging/iio/frequency/ad9832.c
+++ b/drivers/staging/iio/frequency/ad9832.c
@@ -119,7 +119,7 @@ struct ad9832_state {
static unsigned long ad9832_calc_freqreg(unsigned long mclk, unsigned long fout)
{
unsigned long long freqreg = (u64)fout *
- (u64)((u64)1L << AD9832_FREQ_BITS);
+ (u64)1L << AD9832_FREQ_BITS;
do_div(freqreg, mclk);
return freqreg;
}
--
2.7.4
[toc] | [next] | [standalone]
| From | Jonathan Cameron <jic23@kernel.org> |
|---|---|
| Date | 2017-04-02 10:50 +0200 |
| Subject | Re: [PATCH 2/3] staging: iio: frequency: Remove useless type conversion |
| Message-ID | <trJmV-6yC-9@gated-at.bofh.it> |
| In reply to | #1614097 |
On 31/03/17 16:08, simran singhal wrote:
> Some type conversions like casting a pointer to a pointer of same type,
> casting to the original type using addressof(&) operator etc. are not
> needed. Therefore, remove them. Done using coccinelle:
>
> @@
> type t;
> t *p;
> t a;
> @@
> (
> - (t)(a)
> + a
> |
> - (t *)(p)
> + p
> |
> - (t *)(&a)
> + &a
> )
>
> Signed-off-by: simran singhal <singhalsimran0@gmail.com>
driver name in title please, plus a patch description rather more tailored
to the patch.
> ---
> drivers/staging/iio/frequency/ad9832.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c
> index 425b8ab..01bdf8e 100644
> --- a/drivers/staging/iio/frequency/ad9832.c
> +++ b/drivers/staging/iio/frequency/ad9832.c
> @@ -119,7 +119,7 @@ struct ad9832_state {
> static unsigned long ad9832_calc_freqreg(unsigned long mclk, unsigned long fout)
> {
> unsigned long long freqreg = (u64)fout *
> - (u64)((u64)1L << AD9832_FREQ_BITS);
> + (u64)1L << AD9832_FREQ_BITS;
> do_div(freqreg, mclk);
> return freqreg;
> }
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web