All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] h [Patch] Fixed unnecessary typecasting to int. Error found with checkpatch. Signed-off-by: Nishka Dasgupta <nishka.dasgupta_ug18@ashoka.edu.in>
@ 2018-02-26 18:18 Nishka Dasgupta
  2018-02-26 18:55 ` [Outreachy kernel] " Gargi Sharma
  0 siblings, 1 reply; 7+ messages in thread
From: Nishka Dasgupta @ 2018-02-26 18:18 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Nishka Dasgupta

---
 drivers/staging/ks7010/ks_wlan_net.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index e48c557..69cd8347 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -201,6 +201,8 @@ static int ks_wlan_set_freq(struct net_device *dev,
 {
 	struct ks_wlan_private *priv = netdev_priv(dev);
 	int channel;
+	int a2412 = 2.412e8;
+	int b2487 = 2.487e8;
 
 	if (priv->sleep_mode == SLP_SLEEP)
 		return -EPERM;
@@ -208,7 +210,7 @@ static int ks_wlan_set_freq(struct net_device *dev,
 	/* for SLEEP MODE */
 	/* If setting by frequency, convert to a channel */
 	if ((fwrq->e == 1) &&
-	    (fwrq->m >= (int)2.412e8) && (fwrq->m <= (int)2.487e8)) {
+	    (fwrq->m >= a2412) && (fwrq->m <= b2487)) {
 		int f = fwrq->m / 100000;
 		int c = 0;
 
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Outreachy kernel] [PATCH] h [Patch] Fixed unnecessary typecasting to int. Error found with checkpatch. Signed-off-by: Nishka Dasgupta <nishka.dasgupta_ug18@ashoka.edu.in>
  2018-02-26 18:18 [PATCH] h [Patch] Fixed unnecessary typecasting to int. Error found with checkpatch. Signed-off-by: Nishka Dasgupta <nishka.dasgupta_ug18@ashoka.edu.in> Nishka Dasgupta
@ 2018-02-26 18:55 ` Gargi Sharma
  2018-02-27 13:23   ` Re: [PATCH] h [Patch] Fixed unnecessary typecasting to in. " Nishka Dasgupta
  0 siblings, 1 reply; 7+ messages in thread
From: Gargi Sharma @ 2018-02-26 18:55 UTC (permalink / raw)
  To: Nishka Dasgupta; +Cc: outreachy-kernel

Hi Nishka,

Thanks for your patch. A few things you would want to take care of:
1) Subject line: Has two [Patch]. There should be only one. Also, if
you see the other patches in the mailing list, you can see the subject
line should be {driver}: {filename}.

On Mon, Feb 26, 2018 at 6:18 PM, Nishka Dasgupta
<nishka.dasgupta_ug18@ashoka.edu.in> wrote:

2) Here you would want to mention what changes you made and why you
made them. Also mention if you used any tools. The signed off by would
also go here and not the subject line.
3) You would also want to add the maintainer of this driver to the
patch you submit.

> ---
>  drivers/staging/ks7010/ks_wlan_net.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
> index e48c557..69cd8347 100644
> --- a/drivers/staging/ks7010/ks_wlan_net.c
> +++ b/drivers/staging/ks7010/ks_wlan_net.c
> @@ -201,6 +201,8 @@ static int ks_wlan_set_freq(struct net_device *dev,
>  {
>         struct ks_wlan_private *priv = netdev_priv(dev);
>         int channel;
> +       int a2412 = 2.412e8;
> +       int b2487 = 2.487e8;
>
>         if (priv->sleep_mode == SLP_SLEEP)
>                 return -EPERM;
> @@ -208,7 +210,7 @@ static int ks_wlan_set_freq(struct net_device *dev,
>         /* for SLEEP MODE */
>         /* If setting by frequency, convert to a channel */
>         if ((fwrq->e == 1) &&
> -           (fwrq->m >= (int)2.412e8) && (fwrq->m <= (int)2.487e8)) {
> +           (fwrq->m >= a2412) && (fwrq->m <= b2487)) {

4) I don't think this is right. Why do you have an a and a b prepended?
5) Lastly did you compile the kernel before sending in your changes?
If not, please do.

Thanks!
Gargi

>                 int f = fwrq->m / 100000;
>                 int c = 0;
>
> --
> 1.9.1
>
> --
> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1519669095-31351-1-git-send-email-nishka.dasgupta_ug18%40ashoka.edu.in.
> For more options, visit https://groups.google.com/d/optout.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Re: [PATCH] h [Patch] Fixed unnecessary typecasting to in. Error found with checkpatch. Signed-off-by: Nishka Dasgupta <nishka.dasgupta_ug18@ashoka.edu.in>
  2018-02-26 18:55 ` [Outreachy kernel] " Gargi Sharma
@ 2018-02-27 13:23   ` Nishka Dasgupta
  2018-02-27 13:39     ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 7+ messages in thread
From: Nishka Dasgupta @ 2018-02-27 13:23 UTC (permalink / raw)
  To: outreachy-kernel

Hi,
Thank you for pointing out the formatting errors. I have deleted the unnecessary [Patch] and added the driver information. 
I could not, however, work out how to separate the subject line from the body of the text.
I sent the commit to the maintainer of the patch in a separate email as I was (and am) not comfortable with git send-email, though I am doing my best to learn. I have sent him the revised patch, however.
I don't know why a and b are prepended, unless you are referring to the variables that I added, in which case I would like to clarify that I did not want to use names as generic and vague as a and b for the new variables, so I appended part of their respective values after the initial character for ease of understanding. Should I have used more descriptive variable names?
Finally, I did compile the this particular driver (make path/ as on the website) and an output file was generated for the modified file, so I took that to mean it was working as it should. Was I wrong?

Thanking you,
Nishka Dasgupta


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Outreachy kernel] Re: Re: [PATCH] h [Patch] Fixed unnecessary typecasting to in. Error found with checkpatch. Signed-off-by: Nishka Dasgupta <nishka.dasgupta_ug18@ashoka.edu.in>
  2018-02-27 13:23   ` Re: [PATCH] h [Patch] Fixed unnecessary typecasting to in. " Nishka Dasgupta
@ 2018-02-27 13:39     ` Julia Lawall
  2018-02-27 13:53       ` Nishka Dasgupta
  0 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2018-02-27 13:39 UTC (permalink / raw)
  To: Nishka Dasgupta; +Cc: outreachy-kernel



On Tue, 27 Feb 2018, Nishka Dasgupta wrote:

> Hi,
> Thank you for pointing out the formatting errors. I have deleted the unnecessary [Patch] and added the driver information.
> I could not, however, work out how to separate the subject line from the body of the text.
> I sent the commit to the maintainer of the patch in a separate email as I was (and am) not comfortable with git send-email, though I am doing my best to learn. I have sent him the revised patch, however.
> I don't know why a and b are prepended, unless you are referring to the variables that I added, in which case I would like to clarify that I did not want to use names as generic and vague as a and b for the new variables, so I appended part of their respective values after the initial character for ease of understanding. Should I have used more descriptive variable names?
> Finally, I did compile the this particular driver (make path/ as on the website) and an output file was generated for the modified file, so I took that to mean it was working as it should. Was I wrong?

I think that the code is actually better as is.  Normally, there are not
floating point numbers in kernel code, so it is nice to see the int cast,
and to see what the numbers are being used for.  Checkpatch is not always
correct...

julia


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re:
  2018-02-27 13:39     ` [Outreachy kernel] " Julia Lawall
@ 2018-02-27 13:53       ` Nishka Dasgupta
  2018-02-27 13:58         ` [Outreachy kernel] Re: Julia Lawall
  0 siblings, 1 reply; 7+ messages in thread
From: Nishka Dasgupta @ 2018-02-27 13:53 UTC (permalink / raw)
  To: outreachy-kernel

Hi,
Weren't the original values already integers because of the "e8" appended?
If this was an unnecessary patch, I will try to do better next time.
Thanking you,
Nishka Dasgupta


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Outreachy kernel] Re:
  2018-02-27 13:53       ` Nishka Dasgupta
@ 2018-02-27 13:58         ` Julia Lawall
  2018-02-27 14:07           ` Re: Nishka Dasgupta
  0 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2018-02-27 13:58 UTC (permalink / raw)
  To: Nishka Dasgupta; +Cc: outreachy-kernel



On Tue, 27 Feb 2018, Nishka Dasgupta wrote:

> Hi,
> Weren't the original values already integers because of the "e8" appended?
> If this was an unnecessary patch, I will try to do better next time.

I think that they remain floats.

julia

> Thanking you,
> Nishka Dasgupta
>
> --
> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1519739588-3783-1-git-send-email-nishka.dasgupta_ug18%40ashoka.edu.in.
> For more options, visit https://groups.google.com/d/optout.
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re:
  2018-02-27 13:58         ` [Outreachy kernel] Re: Julia Lawall
@ 2018-02-27 14:07           ` Nishka Dasgupta
  0 siblings, 0 replies; 7+ messages in thread
From: Nishka Dasgupta @ 2018-02-27 14:07 UTC (permalink / raw)
  To: outreachy-kernel

Hi,
Thank you for the clarification!
Regards,
Nishka Dasgupta


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-02-27 14:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-26 18:18 [PATCH] h [Patch] Fixed unnecessary typecasting to int. Error found with checkpatch. Signed-off-by: Nishka Dasgupta <nishka.dasgupta_ug18@ashoka.edu.in> Nishka Dasgupta
2018-02-26 18:55 ` [Outreachy kernel] " Gargi Sharma
2018-02-27 13:23   ` Re: [PATCH] h [Patch] Fixed unnecessary typecasting to in. " Nishka Dasgupta
2018-02-27 13:39     ` [Outreachy kernel] " Julia Lawall
2018-02-27 13:53       ` Nishka Dasgupta
2018-02-27 13:58         ` [Outreachy kernel] Re: Julia Lawall
2018-02-27 14:07           ` Re: Nishka Dasgupta

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.