On 10/8/19 9:50 AM, Douglas Gilbert wrote: > Shorten sg_ioctl() by adding some helper functions. sg_ioctl() > is the main entry point for ioctls used on this driver's > devices. > > Signed-off-by: Douglas Gilbert <dgilbert@xxxxxxxxxxxx> > --- > drivers/scsi/sg.c | 325 ++++++++++++++++++++++++++++------------------ > 1 file changed, 200 insertions(+), 125 deletions(-) > > diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c > index 2796fef42837..90753f7759c7 100644 > --- a/drivers/scsi/sg.c > +++ b/drivers/scsi/sg.c > @@ -72,6 +72,9 @@ static char *sg_version_date = "20190606"; > */ > #define SG_MAX_CDB_SIZE 252 > > +#define uptr64(val) ((void __user *)(uintptr_t)(val)) > +#define cuptr64(val) ((const void __user *)(uintptr_t)(val)) > + > #define SG_DEFAULT_TIMEOUT mult_frac(SG_DEFAULT_TIMEOUT_USER, HZ, USER_HZ) > > /* Bit positions (flags) for sg_device::fdev_bm bitmask follow */ These defines are used only once; I'd rather drop them and do the conversion in-place. Cheers, Hannes -- Dr. Hannes Reinecke Teamlead Storage & Networking hare@xxxxxxx +49 911 74053 688 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 247165 (AG München), GF: Felix Imendörffer