Skip to contentSkip to conversation

staging: comedi: Remove useless cast.

PATCH In review Varsha Rao 2 participants 2 messages Mar 9, 2017 Staging

lore
Share & tools
lore

Varsha Rao

author
#0 lore raw

PATCH 1/1 staging: comedi: Remove useless cast.

Variable dac_data is already declared as of type u8. Again explicit type casting of dac_data to u8, is not required. Hence this patch removes it by using the following coccinelle script.

@@
type T;
T *ptr;
T p;
@@
(
- (T *)(&p)
+ &p
|
- (T *)ptr
+ ptr
|
- (T *)(ptr)
+ ptr
|
- (T)(p)
+ p
)

---
 drivers/staging/comedi/drivers/s626.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/s626.c +1 -1
index 4523378..0b189c5 100644
@@ -599,7 +599,7 @@ static int s626_write_trim_dac(struct comedi_device *dev,
 	 * Save the new setpoint in case the application needs to read it back
 	 * later.
 	 */
-	devpriv->trim_setpoint[logical_chan] = (u8)dac_data;
+	devpriv->trim_setpoint[logical_chan] = dac_data;
 
 	/* Map logical channel number to physical channel number. */
 	chan = s626_trimchan[logical_chan];
Signature · 1 line
2.9.3
Acked-by on v1 1/1
#1 lore raw
Quoted 23 lines · Varsha Rao

Variable dac_data is already declared as of type u8. Again explicit type casting of dac_data to u8, is not required. Hence this patch removes it by using the following coccinelle script.

@@
type T;
T *ptr;
T p;
@@
(
- (T *)(&p)
+ &p
|
- (T *)ptr
+ ptr
|
- (T *)(ptr)
+ ptr
|
- (T)(p)
+ p
)

Quoted 1 line
Quoted 27 lines
---
 drivers/staging/comedi/drivers/s626.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/s626.c +1 -2
index 4523378..0b189c5 100644
@@ -599,7 +599,7 @@ static int s626_write_trim_dac(struct comedi_device *dev,
 	 * Save the new setpoint in case the application needs to read it back
 	 * later.
 	 */
-	devpriv->trim_setpoint[logical_chan] = (u8)dac_data;
+	devpriv->trim_setpoint[logical_chan] = dac_data;
 
 	/* Map logical channel number to physical channel number. */
 	chan = s626_trimchan[logical_chan];
--

2.9.3

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/58c1645c.cf9b620a.9896c.d32c%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.