All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guido Kiener <guido@kiener-muenchen.de>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	USB <linux-usb@vger.kernel.org>,
	guido.kiener@rohde-schwarz.com, pankaj.adhikari@ni.com,
	steve_bayless@keysight.com, Dave Penkler <dpenkler@gmail.com>
Subject: [03/12] usb: usbtmc: Add ioctls to set/get usb timeout
Date: Fri, 18 May 2018 22:19:48 +0000	[thread overview]
Message-ID: <20180518221948.Horde.RRfRupyOohw_VtGo8gthLMX@webmail.kiener-muenchen.de> (raw)

Zitat von Andy Shevchenko <andy.shevchenko@gmail.com>:

> On Thu, May 17, 2018 at 8:03 PM, Guido Kiener  
> <guido@kiener-muenchen.de> wrote:
>> Add ioctls USBTMC_IOCTL_GET_TIMEOUT / USBTMC_IOCTL_SET_TIMEOUT to
>> get/set I/O timeout for specific file handle.
>
>
>
>
>> +static int usbtmc_ioctl_get_timeout(struct usbtmc_file_data *file_data,
>> +                               void __user *arg)
>> +{
>> +       __u32 timeout;
>> +
>> +       timeout = file_data->timeout;
>
> Why do you need __u32 on kernel side?
> Would plain u32 work?

It compiles and links with u32 and __u32 (and even double). AFAIK __u32 is for
user code and u32 for kernel code. So, correct is here what the  
maintainer says
or experienced kernel developers :-).
My opinion here is that put_user(..) and get_user(..) should always  
copy to the
same type to always have a safe copy operation from/to userland. So I prefer
__u32.

If you are sure that u32 is more correct here, then we use u32.

Best regards,

Guido

>
>> +
>> +       return put_user(timeout, (__u32 __user *)arg);
>> +}
>
>> +static int usbtmc_ioctl_set_timeout(struct usbtmc_file_data *file_data,
>> +                               void __user *arg)
>> +{
>> +       __u32 timeout;
>
> Ditto.
>
>> +       return 0;
>> +}
>
>
> --
> With Best Regards,
> Andy Shevchenko
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2018-05-18 22:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-18 22:19 Guido Kiener [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-05-19  7:05 [03/12] usb: usbtmc: Add ioctls to set/get usb timeout Greg Kroah-Hartman
2018-05-18 19:48 Andy Shevchenko
2018-05-18 14:56 Guido Kiener
2018-05-18 13:20 Greg Kroah-Hartman
2018-05-17 17:03 Guido Kiener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180518221948.Horde.RRfRupyOohw_VtGo8gthLMX@webmail.kiener-muenchen.de \
    --to=guido@kiener-muenchen.de \
    --cc=andy.shevchenko@gmail.com \
    --cc=dpenkler@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=guido.kiener@rohde-schwarz.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=pankaj.adhikari@ni.com \
    --cc=steve_bayless@keysight.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.