RE: [PATCH 1/4] staging: kpc2000: add spaces around operators in core.c

2019-05-30 Thread Matt Sickler
>From: devel  On Behalf Of
>Greg KH
>On Fri, May 24, 2019 at 01:07:59PM +0200, Simon Sandström wrote:
>> --- a/drivers/staging/kpc2000/kpc2000/core.c
>> +++ b/drivers/staging/kpc2000/kpc2000/core.c
>> @@ -276,18 +276,18 @@ static ssize_t kp2000_cdev_read(struct file *filp,
>
>This whole function just needs to be deleted, it's a horrible hack.

>From the outside, I would definitely agree with you.  On the inside though, we
rely on this function to quickly identify what kind and version is running on
a given piece of hardware.  Since that same information is provided by an ioctl,
I could be convinced to remove this API and write a userspace application that
uses the ioctl to get the information and pretty prints it.
I'd be more inclined to agree with the deletion if it means the whole char dev
interface can be removed from the kpc2000 driver.  That won't be straightforward
as the ioctl is exposed through this interface.  We could remove the ioctl, but
we'd need to ensure that all the same information is exposed via sysfs.  Our
userspace side is all funneled through a single class, so changing it to use
sysfs wouldn't be too difficult.  I'd support that change if someone wants to 
make it.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/4] staging: kpc2000: add spaces around operators in core.c

2019-05-30 Thread Greg KH
On Thu, May 30, 2019 at 10:57:09PM +, Matt Sickler wrote:
> >From: devel  On Behalf Of
> >Greg KH
> >On Fri, May 24, 2019 at 01:07:59PM +0200, Simon Sandström wrote:
> >> --- a/drivers/staging/kpc2000/kpc2000/core.c
> >> +++ b/drivers/staging/kpc2000/kpc2000/core.c
> >> @@ -276,18 +276,18 @@ static ssize_t kp2000_cdev_read(struct file *filp,
> >
> >This whole function just needs to be deleted, it's a horrible hack.
> 
> >From the outside, I would definitely agree with you.  On the inside though, 
> >we
> rely on this function to quickly identify what kind and version is running on
> a given piece of hardware.  Since that same information is provided by an 
> ioctl,
> I could be convinced to remove this API and write a userspace application that
> uses the ioctl to get the information and pretty prints it.

The ioctl needs to die as well, just use the sysfs entries instead, as
you already have them :)

> I'd be more inclined to agree with the deletion if it means the whole char dev
> interface can be removed from the kpc2000 driver.  That won't be 
> straightforward
> as the ioctl is exposed through this interface.  We could remove the ioctl, 
> but
> we'd need to ensure that all the same information is exposed via sysfs.

I think you are there already, what is missing?

> Our userspace side is all funneled through a single class, so changing
> it to use sysfs wouldn't be too difficult.  I'd support that change if
> someone wants to make it.

I will be glad to do that, it's always nice to delete code :)

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/4] staging: kpc2000: add spaces around operators in core.c

2019-05-30 Thread Greg KH
On Fri, May 24, 2019 at 01:07:59PM +0200, Simon Sandström wrote:
> Fixes checkpatch.pl check "spaces preferred around that ".
> 
> Signed-off-by: Simon Sandström 
> ---
>  drivers/staging/kpc2000/kpc2000/core.c | 24 
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/staging/kpc2000/kpc2000/core.c 
> b/drivers/staging/kpc2000/kpc2000/core.c
> index 4110032d0cbb..b464973d12ad 100644
> --- a/drivers/staging/kpc2000/kpc2000/core.c
> +++ b/drivers/staging/kpc2000/kpc2000/core.c
> @@ -276,18 +276,18 @@ static ssize_t kp2000_cdev_read(struct file *filp, char 
> __user *buf,
>   if (WARN(NULL == buf, "kp2000_cdev_read: buf is a NULL pointer!\n"))
>   return -EINVAL;
>  
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "Card ID : 
> 0x%08x\n", pcard->card_id);
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "Build Version   : 
> 0x%08x\n", pcard->build_version);
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "Build Date  : 
> 0x%08x\n", pcard->build_datestamp);
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "Build Time  : 
> 0x%08x\n", pcard->build_timestamp);
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "Core Table Offset   : 
> 0x%08x\n", pcard->core_table_offset);
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "Core Table Length   : 
> 0x%08x\n", pcard->core_table_length);
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "Hardware Revision   : 
> 0x%08x\n", pcard->hardware_revision);
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "SSID: 
> 0x%016llx\n", pcard->ssid);
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "DDNA: 
> 0x%016llx\n", pcard->ddna);
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "IRQ Mask: 
> 0x%016llx\n", readq(pcard->sysinfo_regs_base + REG_INTERRUPT_MASK));
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "IRQ Active  : 
> 0x%016llx\n", readq(pcard->sysinfo_regs_base + REG_INTERRUPT_ACTIVE));
> - cnt += scnprintf(buff+cnt, BUFF_CNT-cnt, "CPLD: 
> 0x%016llx\n", readq(pcard->sysinfo_regs_base + REG_CPLD_CONFIG));
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "Card ID : 
> 0x%08x\n", pcard->card_id);
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "Build Version   : 
> 0x%08x\n", pcard->build_version);
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "Build Date  : 
> 0x%08x\n", pcard->build_datestamp);
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "Build Time  : 
> 0x%08x\n", pcard->build_timestamp);
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "Core Table Offset   : 
> 0x%08x\n", pcard->core_table_offset);
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "Core Table Length   : 
> 0x%08x\n", pcard->core_table_length);
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "Hardware Revision   : 
> 0x%08x\n", pcard->hardware_revision);
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "SSID: 
> 0x%016llx\n", pcard->ssid);
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "DDNA: 
> 0x%016llx\n", pcard->ddna);
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "IRQ Mask: 
> 0x%016llx\n", readq(pcard->sysinfo_regs_base + REG_INTERRUPT_MASK));
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "IRQ Active  : 
> 0x%016llx\n", readq(pcard->sysinfo_regs_base + REG_INTERRUPT_ACTIVE));
> + cnt += scnprintf(buff + cnt, BUFF_CNT - cnt, "CPLD: 
> 0x%016llx\n", readq(pcard->sysinfo_regs_base + REG_CPLD_CONFIG));
>  
>   if (*f_pos >= cnt)
>   return 0;

This whole function just needs to be deleted, it's a horrible hack.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel