Re: [PATCH 1/6] staging: kpc2000: make kconfig symbol 'KPC2000' select dependencies

2019-05-22 Thread Greg Kroah-Hartman
On Thu, May 23, 2019 at 01:35:02AM +, Geordan Neukum wrote:
> On Wed, May 22, 2019 at 12:27 PM Greg Kroah-Hartman
>  wrote:
> > depends on is better than select.  There's a change to depend on UIO for
> > this code already in my -linus branch which will show up in Linus's tree
> > in a week or so.
> 
> Noted on both accounts. Thanks for the feedback and sorry for the
> inconvenience on the latter.
> 
> > Are you sure we need MFD_CORE as well for this code?
> 
> I noticed the build issue when working locally. I was doing
> something along the lines of: 'make distclean && make x86_64_defconfig',
> selecting 'CONFIG_KPC2000' and 'CONFIG_UIO' via menuconfig, then
> running a good old 'make'. From make, I received an error along the
> lines of:
> 
> ERROR: "mfd_remove_devices"
> [drivers/staging/kpc2000/kpc2000/kpc2000.ko] undefined!
> ERROR: "mfd_add_devices" [drivers/staging/kpc2000/kpc2000/kpc2000.ko] 
> undefined!
> make[1]: *** [scripts/Makefile.modpost:91: __modpost] Error 1
> make: *** [Makefile:1290: modules] Error 2
> 
> which appears to indicate that those two symbols are undefined. When
> I looked, it appeared that those symbols were exported from the
> mfd-core which is why I also threw in a select for that Kconfig
> symbol. Assuming that I didn't do something silly above, I'd be happy
> to submit a new patch (with only a depends on for MFD_CORE) as I
> continue trying to fix up the i2c driver.

Yes, a depends for MFD_CORE would be good, can you base it against my
staging-linus branch so that fix can go to Linus for this release?

thanks,

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


Re: staging: mt7621-pci: factor out 'mt7621_pcie_enable_port' function

2019-05-22 Thread Sergio Paracuellos
Hi Greg,


On Thu, May 23, 2019 at 4:11 AM Greg Ungerer  wrote:
>
> Hi Sergio,
>
> On 22/5/19 4:27 pm, Sergio Paracuellos wrote:
> [snip]
> > There are some big changes between 4.20 and 5.x. One is the use of PERST_N
> > instead of using gpio. This PERT_N stuff is used now on enable ports
> > assuming the
> > link of PCI is properly detected after enabling the phy. And it seems
> > it is not according to
> > your dmesg traces. The previous 4.20 code used gpio before this was done.
> >
> > This code is the one I am referring:
> >
> > /* Use GPIO control instead of PERST_N */
> > *(unsigned int *)(0xbe000620) |= BIT(19) | BIT(8) | BIT(7); // set DATA
> > mdelay(1000);
>
> I have been looking closely at those, wondering why the old code
> drove that PERST line as a GPIO instead of using the built-in behavior.
> (I have ignored bits 7 and 8 here since they are control of UART 3)

Yes, this was also at first one of my big concerns so I tried to change into
to use builtin behaviour (which is much more cleaner) and when the
code was tested
it worked. It seems it is not valid for every board.

>
>
> > I assume reset lines on your device tree are properly set up which is
> > other of the big changes here: use
> > reset lines instead of that hardcoding stuff. Also, the
> > mt7621_reset_port routine is also using msleep(100)
> > but maybe you can try a bigger value and change it into a mdelay, to
> > see if that changes anything.
>
> I see the reset line configuration in the pcie section of mt7621.dtsi,
> is there any others absolutely required here?  I couldn't see the
> gbpc1.dts devicetree do anything else with pcie - othe than enable it.
> My device tree for the EX15 is similar in that regard.
>
> I tried a couple of things with interesting results.
>
> 1. I made sure that the PERST_N line is set for PCIe operation (not GPIO).
> I forced it with:
>
> *(unsigned int *)(0xbe60) &= ~(0x3 << 10);
>
> I checked bits 10 and 11 at kernel PCI init and they were 00 anyway.
> So PERST_N was definitely in PCIe reset mode. No change in behavior,
>
>
> 2. I forced a GPIO style reset of that PERST line (using GPIO19) and got
> the following result on kernel boot:
>
>  mt7621-pci 1e14.pcie: Port 454043648 N_FTS = 0
>  mt7621-pci-phy 1e149000.pcie-phy: Xtal is 40MHz
>  mt7621-pci 1e14.pcie: Port 454043648 N_FTS = 1
>  mt7621-pci 1e14.pcie: pcie1 no card, disable it (RST & CLK)
>  mt7621-pci 1e14.pcie: Initiating port 1 failed
>  mt7621-pci 1e14.pcie: Port 454043648 N_FTS = 2
>  mt7621-pci-phy 1e14a000.pcie-phy: Xtal is 40MHz
>  mt7621-pci 1e14.pcie: pcie2 no card, disable it (RST & CLK)
>  mt7621-pci 1e14.pcie: Initiating port 2 failed
>  mt7621-pci 1e14.pcie: de-assert port 0 PERST_N

This line seems to be the problem. When ports are init, (and with your
changes seems the are
init properly), the ports with pcie link are stored into a list to be
enabled afterwards. This code is
located into 'mt7621_pcie_enable_ports' which call simple
'mt7621_pcie_enable_port' to enable each port
on the list. In this process it uses the PERS_N built-in register
deasserting and asserting it. If enabling fails
(and this is ypour case now) the port is removed from the list and it
is not properly set up. You should try to
comment this code:

/* assert port PERST_N */
val = pcie_read(pcie, RALINK_PCI_PCICFG_ADDR);
val |= PCIE_PORT_PERST(slot);
pcie_write(pcie, val, RALINK_PCI_PCICFG_ADDR);

/* de-assert port PERST_N */
val = pcie_read(pcie, RALINK_PCI_PCICFG_ADDR);
val &= ~PCIE_PORT_PERST(slot);
pcie_write(pcie, val, RALINK_PCI_PCICFG_ADDR);

/* 100ms timeout value should be enough for Gen1 training */
err = readl_poll_timeout(port->base + RALINK_PCI_STATUS,
val, !!(val & PCIE_PORT_LINKUP),
20, 100 * USEC_PER_MSEC);
if (err)
return -ETIMEDOUT;

because on enabling, it seems it is getting ETIMEOUT and hence the
message '  mt7621-pci 1e14.pcie: de-assert port 0 PERST_N'.
Commenting
this code should end up into a properly configured pci?

>  mt7621-pci 1e14.pcie: PCI coherence region base: 0x6000, 
> mask/settings: 0xf002
>  mt7621-pci 1e14.pcie: PCI host bridge to bus :00
>  pci_bus :00: root bus resource [io  0x]
>  pci_bus :00: root bus resource [mem 0x6000-0x6fff]
>  pci_bus :00: root bus resource [bus 00-ff]
>
> And the system continued on to fully boot. So it looks like it thinks
> pcie0 is active. Better, but the PCI bus probe didn't find any of the
> devices it should have.

Yes, that seems what is happening because of my explanation above.

>
> I inserted the quick hack code to do this at the top of 
> mt7621_pcie_init_ports()
> and it looked like this:
>
>  /* Force PERST PCIe line into GPIO mode */
>  *(unsigned int *)(0xbe60) &= ~(0x3 << 10);
>  *(unsigned int *)(0xbe60) |=  BIT(10);
>  mdelay(100);
>
>  *(unsigned int 

[Patch v2] staging: rtl8723bs: core: rtw_recv: fix warning Comparison to NULL

2019-05-22 Thread Hariprasad Kelam
fix below warning reported by checkpatch

CHECK: Comparison to NULL could be written
"!precvpriv->pallocated_frame_buf"
CHECK: Comparison to NULL could be written "padapter"

Signed-off-by: Hariprasad Kelam 
-
changes in v2:
Corected few erorrs like (!*psta == NULL) pointed in
review
---
 drivers/staging/rtl8723bs/core/rtw_recv.c | 48 +++
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c 
b/drivers/staging/rtl8723bs/core/rtw_recv.c
index b9f758e..b9c9bba 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -50,7 +50,7 @@ sint _rtw_init_recv_priv(struct recv_priv *precvpriv, struct 
adapter *padapter)
 
precvpriv->pallocated_frame_buf = vzalloc(NR_RECVFRAME * sizeof(union 
recv_frame) + RXFRAME_ALIGN_SZ);
 
-   if (precvpriv->pallocated_frame_buf == NULL) {
+   if (!precvpriv->pallocated_frame_buf) {
res = _FAIL;
goto exit;
}
@@ -122,7 +122,7 @@ union recv_frame *_rtw_alloc_recvframe(struct __queue 
*pfree_recv_queue)
 
list_del_init(>u.hdr.list);
padapter = precvframe->u.hdr.adapter;
-   if (padapter != NULL) {
+   if (padapter) {
precvpriv = >recvpriv;
if (pfree_recv_queue == >free_recv_queue)
precvpriv->free_recvframe_cnt--;
@@ -160,7 +160,7 @@ int rtw_free_recvframe(union recv_frame *precvframe, struct 
__queue *pfree_recv_
 
list_add_tail(&(precvframe->u.hdr.list), 
get_list_head(pfree_recv_queue));
 
-   if (padapter != NULL) {
+   if (padapter) {
if (pfree_recv_queue == >free_recv_queue)
precvpriv->free_recvframe_cnt++;
}
@@ -183,7 +183,7 @@ sint _rtw_enqueue_recvframe(union recv_frame *precvframe, 
struct __queue *queue)
 
list_add_tail(&(precvframe->u.hdr.list), get_list_head(queue));
 
-   if (padapter != NULL)
+   if (padapter)
if (queue == >free_recv_queue)
precvpriv->free_recvframe_cnt++;
 
@@ -334,7 +334,7 @@ sint recvframe_chkmic(struct adapter *adapter,  union 
recv_frame *precvframe)
prxattrib->ra[0], prxattrib->ra[1], prxattrib->ra[2], 
prxattrib->ra[3], prxattrib->ra[4], prxattrib->ra[5]));
 
/* calculate mic code */
-   if (stainfo != NULL) {
+   if (stainfo) {
if (IS_MCAST(prxattrib->ra)) {
/* mickey 
=>dot118021XGrprxmickey.skey[0]; */
/* iv = 
precvframe->u.hdr.rx_data+prxattrib->hdrlen; */
@@ -570,7 +570,7 @@ union recv_frame *portctrl(struct adapter *adapter, union 
recv_frame *precv_fram
RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, 
("portctrl:adapter->securitypriv.dot11AuthAlgrthm =%d\n", 
adapter->securitypriv.dot11AuthAlgrthm));
 
if (auth_alg == 2) {
-   if ((psta != NULL) && (psta->ieee8021x_blocked)) {
+   if ((psta) && (psta->ieee8021x_blocked)) {
__be16 be_tmp;
 
/* blocked */
@@ -859,7 +859,7 @@ sint sta2sta_data_frame(
else
*psta = rtw_get_stainfo(pstapriv, sta_addr); /*  get ap_info */
 
-   if (*psta == NULL) {
+   if (!*psta) {
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("can't get psta 
under sta2sta_data_frame ; drop pkt\n"));
ret = _FAIL;
goto exit;
@@ -942,7 +942,7 @@ sint ap2sta_data_frame(
else
*psta = rtw_get_stainfo(pstapriv, pattrib->bssid); /*  
get ap_info */
 
-   if (*psta == NULL) {
+   if (!*psta) {
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("ap2sta: 
can't get psta under STATION_MODE ; drop pkt\n"));
#ifdef DBG_RX_DROP_FRAME
DBG_871X("DBG_RX_DROP_FRAME %s can't get psta under 
STATION_MODE ; drop pkt\n", __func__);
@@ -974,7 +974,7 @@ sint ap2sta_data_frame(
 
 
*psta = rtw_get_stainfo(pstapriv, pattrib->bssid); /*  get 
sta_info */
-   if (*psta == NULL) {
+   if (!*psta) {
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("can't 
get psta under MP_MODE ; drop pkt\n"));
#ifdef DBG_RX_DROP_FRAME
DBG_871X("DBG_RX_DROP_FRAME %s can't get psta under 
WIFI_MP_STATE ; drop pkt\n", __func__);
@@ -991,7 +991,7 @@ sint ap2sta_data_frame(
} else {
if (!memcmp(myhwaddr, pattrib->dst, ETH_ALEN) && (!bmcast)) {
*psta = rtw_get_stainfo(pstapriv, pattrib->bssid); /*  
get sta_info */
-   if (*psta == NULL) {
+   if (!*psta) {
 
 

Re: staging: mt7621-pci: factor out 'mt7621_pcie_enable_port' function

2019-05-22 Thread Greg Ungerer

Hi Sergio,

On 22/5/19 4:27 pm, Sergio Paracuellos wrote:
[snip]

There are some big changes between 4.20 and 5.x. One is the use of PERST_N
instead of using gpio. This PERT_N stuff is used now on enable ports
assuming the
link of PCI is properly detected after enabling the phy. And it seems
it is not according to
your dmesg traces. The previous 4.20 code used gpio before this was done.

This code is the one I am referring:

/* Use GPIO control instead of PERST_N */
*(unsigned int *)(0xbe000620) |= BIT(19) | BIT(8) | BIT(7); // set DATA
mdelay(1000);


I have been looking closely at those, wondering why the old code
drove that PERST line as a GPIO instead of using the built-in behavior.
(I have ignored bits 7 and 8 here since they are control of UART 3)



I assume reset lines on your device tree are properly set up which is
other of the big changes here: use
reset lines instead of that hardcoding stuff. Also, the
mt7621_reset_port routine is also using msleep(100)
but maybe you can try a bigger value and change it into a mdelay, to
see if that changes anything.


I see the reset line configuration in the pcie section of mt7621.dtsi,
is there any others absolutely required here?  I couldn't see the
gbpc1.dts devicetree do anything else with pcie - othe than enable it.
My device tree for the EX15 is similar in that regard.

I tried a couple of things with interesting results.

1. I made sure that the PERST_N line is set for PCIe operation (not GPIO).
   I forced it with:

   *(unsigned int *)(0xbe60) &= ~(0x3 << 10);

   I checked bits 10 and 11 at kernel PCI init and they were 00 anyway.
   So PERST_N was definitely in PCIe reset mode. No change in behavior,
   


2. I forced a GPIO style reset of that PERST line (using GPIO19) and got
   the following result on kernel boot:

mt7621-pci 1e14.pcie: Port 454043648 N_FTS = 0
mt7621-pci-phy 1e149000.pcie-phy: Xtal is 40MHz
mt7621-pci 1e14.pcie: Port 454043648 N_FTS = 1
mt7621-pci 1e14.pcie: pcie1 no card, disable it (RST & CLK)
mt7621-pci 1e14.pcie: Initiating port 1 failed
mt7621-pci 1e14.pcie: Port 454043648 N_FTS = 2
mt7621-pci-phy 1e14a000.pcie-phy: Xtal is 40MHz
mt7621-pci 1e14.pcie: pcie2 no card, disable it (RST & CLK)
mt7621-pci 1e14.pcie: Initiating port 2 failed
mt7621-pci 1e14.pcie: de-assert port 0 PERST_N
mt7621-pci 1e14.pcie: PCI coherence region base: 0x6000, 
mask/settings: 0xf002
mt7621-pci 1e14.pcie: PCI host bridge to bus :00
pci_bus :00: root bus resource [io  0x]
pci_bus :00: root bus resource [mem 0x6000-0x6fff]
pci_bus :00: root bus resource [bus 00-ff]

And the system continued on to fully boot. So it looks like it thinks
pcie0 is active. Better, but the PCI bus probe didn't find any of the
devices it should have.

I inserted the quick hack code to do this at the top of mt7621_pcie_init_ports()
and it looked like this:

/* Force PERST PCIe line into GPIO mode */
*(unsigned int *)(0xbe60) &= ~(0x3 << 10);
*(unsigned int *)(0xbe60) |=  BIT(10);
mdelay(100);

*(unsigned int *)(0xbe000600) |= BIT(19); // use GPIO19 (PERST_N/)
mdelay(100);
*(unsigned int *)(0xbe000620) &= ~(BIT(19)); // clear DATA
mdelay(1000);

/* Use GPIO control instead of PERST_N */
*(unsigned int *)(0xbe000620) |= BIT(19); // set DATA
mdelay(1000);


Regards
Greg



Other big change is to use the new phy driver but I think the problem
seems to be related with resets.



Regards
Greg


Please, don't hesitate to ask me whatever you need to.

Hope this helps.

Best regards,
 Sergio Paracuellos


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


Your Response Please....

2019-05-22 Thread Klen Tindle
Hello Dear,

I am Klen Tindle  by name, from America and working with the USA
military still on a mission in Afghanistan.  I really need your
assistance that is the reason why I contacted you, I want to go
into a cordial relationship and business partnership with you, as
I don't know how long we would stay in the war zone here, Here in
the military zone we are not allowed to make use of mobile
phones, we only make use of radio message and e-mail
communication.

I want you to know that we are being attacked by insurgents every
day and several bombings. During one of our rescue mission we
came across a safe box that contain huge amount of money that
belongs to the revolutionaries, which I believe they use in
buying weapons and ammunition and it was agreed by all parties
present that the money will be shared among us.

Out of the total fund my share was $5,000,000 (Five Million US
Dollars), I am seeking your assistance to evacuate my share of
the money, which is $5,000,000. out of here to you; in as much as
you can assure me that my own share will be safe in your care
until I complete my service here, This is not stolen money, and
there are no dangers involved.

I have made arrangements with a United Nation Diplomat who
promised to deliver the fund to any of my chosen destination, I
shall be compensating you with 30% of the total fund if you can
help me secure the box, while the balance shall be my investment
capital in your country, One passionate appeal I will make to you
is not to discuss this matter to a third party, if you have
reasons to reject this offer, please destroy this e-mail as any
leakage of this information will be too bad for me, due to my
position as a USAF Lieutenant.

I have chosen to contact you after my prayers and I believe that
you will not betray my trust, but rather take me as your own
sister, Though you may wonder why I am so soon revealing myself
to you without knowing you, well I will say that my mind
convinced me that you are the true person to help me receive and
invest the fund.

I do not know how long we will remain here, and I have survived
two bomb attacks here, which prompted me to search out for a
reliable and trustworthy person to help me receive and invest the
fund in his country.

I wish you send me a reply immediately as soon as you receive
this proposal, Your urgent reply will be highly appreciated. I
hope my explanation is very clear but if you need further
clarification, then send your questions, I wait to hear from you
soonest.

Regards,
USAF Lieutenant Klen Tindle.
 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/6] staging: kpc2000: make kconfig symbol 'KPC2000' select dependencies

2019-05-22 Thread Geordan Neukum
On Wed, May 22, 2019 at 12:27 PM Greg Kroah-Hartman
 wrote:
> depends on is better than select.  There's a change to depend on UIO for
> this code already in my -linus branch which will show up in Linus's tree
> in a week or so.

Noted on both accounts. Thanks for the feedback and sorry for the
inconvenience on the latter.

> Are you sure we need MFD_CORE as well for this code?

I noticed the build issue when working locally. I was doing
something along the lines of: 'make distclean && make x86_64_defconfig',
selecting 'CONFIG_KPC2000' and 'CONFIG_UIO' via menuconfig, then
running a good old 'make'. From make, I received an error along the
lines of:

ERROR: "mfd_remove_devices"
[drivers/staging/kpc2000/kpc2000/kpc2000.ko] undefined!
ERROR: "mfd_add_devices" [drivers/staging/kpc2000/kpc2000/kpc2000.ko] undefined!
make[1]: *** [scripts/Makefile.modpost:91: __modpost] Error 1
make: *** [Makefile:1290: modules] Error 2

which appears to indicate that those two symbols are undefined. When
I looked, it appeared that those symbols were exported from the
mfd-core which is why I also threw in a select for that Kconfig
symbol. Assuming that I didn't do something silly above, I'd be happy
to submit a new patch (with only a depends on for MFD_CORE) as I
continue trying to fix up the i2c driver.

>Why hasn't that been seen on any build errors?

To be honest, I can't say that I'm familiar with all of the different
build bots out there so I can't even begin to speculate on that one.
If someone could point me in the right direction there, I'd be happy
to investigate further.

Thanks again for your feedback all,
Geordan Neukum
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: pi433: cleanup to adhere with linux coding style

2019-05-22 Thread Shobhit Kukreti
The linux coding style emphasizes on a limit of 80 characters
per line. Cleaned up several over 80 character warnings in following files:

pi433_if.c
pi433_if.h
rf69.c

Signed-off-by: Shobhit Kukreti 
---
 drivers/staging/pi433/pi433_if.c | 15 ---
 drivers/staging/pi433/pi433_if.h | 25 +++
 drivers/staging/pi433/rf69.c | 89 
 3 files changed, 78 insertions(+), 51 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index c889f0b..07715c9 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -439,8 +439,7 @@ pi433_receive(void *data)
/* wait for RSSI level to become high */
dev_dbg(dev->dev, "rx: going to wait for high RSSI level");
retval = wait_event_interruptible(dev->rx_wait_queue,
- rf69_get_flag(dev->spi,
-   
rssi_exceeded_threshold));
+   rf69_get_flag(dev->spi, rssi_exceeded_threshold));
if (retval) /* wait was interrupted */
goto abort;
dev->interrupt_rx_allowed = false;
@@ -475,7 +474,7 @@ pi433_receive(void *data)
/* length byte enabled? */
if (dev->rx_cfg.enable_length_byte == OPTION_ON) {
retval = wait_event_interruptible(dev->fifo_wait_queue,
- dev->free_in_fifo < 
FIFO_SIZE);
+   dev->free_in_fifo < FIFO_SIZE);
if (retval) /* wait was interrupted */
goto abort;
 
@@ -496,7 +495,7 @@ pi433_receive(void *data)
bytes_total--;
 
retval = wait_event_interruptible(dev->fifo_wait_queue,
- dev->free_in_fifo < 
FIFO_SIZE);
+   dev->free_in_fifo < FIFO_SIZE);
if (retval) /* wait was interrupted */
goto abort;
 
@@ -509,7 +508,7 @@ pi433_receive(void *data)
while (dev->rx_position < bytes_total) {
if (!rf69_get_flag(dev->spi, payload_ready)) {
retval = wait_event_interruptible(dev->fifo_wait_queue,
- dev->free_in_fifo < 
FIFO_SIZE);
+   dev->free_in_fifo < FIFO_SIZE);
if (retval) /* wait was interrupted */
goto abort;
}
@@ -690,8 +689,8 @@ pi433_tx_thread(void *data)
return retval;
device->irq_state[DIO0] = DIO_PACKET_SENT;
irq_set_irq_type(device->irq_num[DIO0], IRQ_TYPE_EDGE_RISING);
-   enable_irq(device->irq_num[DIO0]); /* was disabled by rx active 
check */
-
+   /* was disabled by rx active check */
+   enable_irq(device->irq_num[DIO0]);
/* enable transmission */
retval = rf69_set_mode(spi, transmit);
if (retval < 0)
@@ -722,7 +721,7 @@ pi433_tx_thread(void *data)
}
 
retval = 
wait_event_interruptible(device->fifo_wait_queue,
- device->free_in_fifo 
> 0);
+   device->free_in_fifo > 
0);
if (retval) {
dev_dbg(device->dev, "ABORT\n");
goto abort;
diff --git a/drivers/staging/pi433/pi433_if.h b/drivers/staging/pi433/pi433_if.h
index 9feb95c..05441ae 100644
--- a/drivers/staging/pi433/pi433_if.h
+++ b/drivers/staging/pi433/pi433_if.h
@@ -117,10 +117,15 @@ struct pi433_rx_cfg {
 
/* packet format */
enum option_on_off  enable_sync;
-   enum option_on_off  enable_length_byte;   /* should be used in 
combination with sync, only */
-   enum address_filtering  enable_address_filtering; /* operational with 
sync, only */
-   enum option_on_off  enable_crc;   /* only operational, 
if sync on and fixed length or length byte is used */
-
+   /* should be used in combination with sync, only */
+   enum option_on_off  enable_length_byte;
+   /* operational with sync, only */
+   enum address_filtering  enable_address_filtering;
+   /*
+* only operational, if sync on and fixed length or
+* length byte is used
+*/
+   enum option_on_off  enable_crc;
__u8sync_length;
__u8fixed_message_length;
__u32   bytes_to_drop;
@@ -132,10 +137,14 @@ struct pi433_rx_cfg {
 
 #define PI433_IOC_MAGIC'r'
 
-#define PI433_IOC_RD_TX_CFG_IOR(PI433_IOC_MAGIC, 

[PATCH 5/6] staging: kpc2000: add space after comma in cell_probe.c

2019-05-22 Thread Simon Sandström
Fixes checkpatch.pl error "space required after that ','".

Signed-off-by: Simon Sandström 
---
 drivers/staging/kpc2000/kpc2000/cell_probe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c 
b/drivers/staging/kpc2000/kpc2000/cell_probe.c
index 9a32660a56e2..7d4986502013 100644
--- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
+++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
@@ -323,7 +323,7 @@ static int probe_core_uio(unsigned int core_num, struct 
kp2000_device *pcard,
kudev->uioinfo.mem[0].size = (cte.length + PAGE_SIZE - 1) & ~(PAGE_SIZE 
- 1); // Round up to nearest PAGE_SIZE boundary
kudev->uioinfo.mem[0].memtype = UIO_MEM_PHYS;
 
-   kudev->dev = device_create(kpc_uio_class, >pdev->dev, 
MKDEV(0,0), kudev, "%s.%d.%d.%d", kudev->uioinfo.name, pcard->card_num, 
cte.type, kudev->core_num);
+   kudev->dev = device_create(kpc_uio_class, >pdev->dev, MKDEV(0, 
0), kudev, "%s.%d.%d.%d", kudev->uioinfo.name, pcard->card_num, cte.type, 
kudev->core_num);
if (IS_ERR(kudev->dev)) {
dev_err(>pdev->dev, "probe_core_uio device_create 
failed!\n");
kfree(kudev);
-- 
2.20.1

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


[PATCH 2/6] staging: kpc2000: add space between ) and { in cell_probe.c

2019-05-22 Thread Simon Sandström
Fixes checkpatch.pl error "space required before the open brace '{'".

Signed-off-by: Simon Sandström 
---
 drivers/staging/kpc2000/kpc2000/cell_probe.c | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c 
b/drivers/staging/kpc2000/kpc2000/cell_probe.c
index 6e034d115b47..51d32970f025 100644
--- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
+++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
@@ -241,8 +241,8 @@ int  kp2000_check_uio_irq(struct kp2000_device *pcard, u32 
irq_num)
u64 interrupt_active   =  readq(pcard->sysinfo_regs_base + 
REG_INTERRUPT_ACTIVE);
u64 interrupt_mask_inv = ~readq(pcard->sysinfo_regs_base + 
REG_INTERRUPT_MASK);
u64 irq_check_mask = (1 << irq_num);
-   if (interrupt_active & irq_check_mask){ // if it's active (interrupt 
pending)
-   if (interrupt_mask_inv & irq_check_mask){// and if it's not 
masked off
+   if (interrupt_active & irq_check_mask) { // if it's active (interrupt 
pending)
+   if (interrupt_mask_inv & irq_check_mask) {// and if it's 
not masked off
return 1;
}
}
@@ -256,7 +256,7 @@ irqreturn_t  kuio_handler(int irq, struct uio_info *uioinfo)
if (irq != kudev->pcard->pdev->irq)
return IRQ_NONE;
 
-   if (kp2000_check_uio_irq(kudev->pcard, kudev->cte.irq_base_num)){
+   if (kp2000_check_uio_irq(kudev->pcard, kudev->cte.irq_base_num)) {
writeq((1 << kudev->cte.irq_base_num), 
kudev->pcard->sysinfo_regs_base + REG_INTERRUPT_ACTIVE); // Clear the active 
flag
return IRQ_HANDLED;
}
@@ -272,7 +272,7 @@ int kuio_irqcontrol(struct uio_info *uioinfo, s32 irq_on)
 
mutex_lock(>sem);
mask = readq(pcard->sysinfo_regs_base + REG_INTERRUPT_MASK);
-   if (irq_on){
+   if (irq_on) {
mask &= ~(1 << (kudev->cte.irq_base_num));
} else {
mask |= (1 << (kudev->cte.irq_base_num));
@@ -292,7 +292,7 @@ static int probe_core_uio(unsigned int core_num, struct 
kp2000_device *pcard,
dev_dbg(>pdev->dev, "Found UIO core:   type = %02d  dma = %02x / 
%02x  offset = 0x%x  length = 0x%x (%d regs)\n", cte.type, 
KPC_OLD_S2C_DMA_CH_NUM(cte), KPC_OLD_C2S_DMA_CH_NUM(cte), cte.offset, 
cte.length, cte.length / 8);
 
kudev = kzalloc(sizeof(struct kpc_uio_device), GFP_KERNEL);
-   if (!kudev){
+   if (!kudev) {
dev_err(>pdev->dev, "probe_core_uio: failed to kzalloc 
kpc_uio_device\n");
return -ENOMEM;
}
@@ -305,7 +305,7 @@ static int probe_core_uio(unsigned int core_num, struct 
kp2000_device *pcard,
kudev->uioinfo.priv = kudev;
kudev->uioinfo.name = name;
kudev->uioinfo.version = "0.0";
-   if (cte.irq_count > 0){
+   if (cte.irq_count > 0) {
kudev->uioinfo.irq_flags = IRQF_SHARED;
kudev->uioinfo.irq = pcard->pdev->irq;
kudev->uioinfo.handler = kuio_handler;
@@ -328,7 +328,7 @@ static int probe_core_uio(unsigned int core_num, struct 
kp2000_device *pcard,
dev_set_drvdata(kudev->dev, kudev);
 
rv = uio_register_device(kudev->dev, >uioinfo);
-   if (rv){
+   if (rv) {
dev_err(>pdev->dev, "probe_core_uio failed 
uio_register_device: %d\n", rv);
put_device(kudev->dev);
kfree(kudev);
@@ -383,17 +383,17 @@ static int  kp2000_setup_dma_controller(struct 
kp2000_device *pcard)
u64 capabilities_reg;
 
// S2C Engines
-   for (i = 0 ; i < 32 ; i++){
+   for (i = 0 ; i < 32 ; i++) {
capabilities_reg = readq( pcard->dma_bar_base + 
KPC_DMA_S2C_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i) );
-   if (capabilities_reg & ENGINE_CAP_PRESENT_MASK){
+   if (capabilities_reg & ENGINE_CAP_PRESENT_MASK) {
err = create_dma_engine_core(pcard, 
(KPC_DMA_S2C_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i)), i,  pcard->pdev->irq);
if (err) goto err_out;
}
}
// C2S Engines
-   for (i = 0 ; i < 32 ; i++){
+   for (i = 0 ; i < 32 ; i++) {
capabilities_reg = readq( pcard->dma_bar_base + 
KPC_DMA_C2S_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i) );
-   if (capabilities_reg & ENGINE_CAP_PRESENT_MASK){
+   if (capabilities_reg & ENGINE_CAP_PRESENT_MASK) {
err = create_dma_engine_core(pcard, 
(KPC_DMA_C2S_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i)), 32+i,  pcard->pdev->irq);
if (err) goto err_out;
}
@@ -423,23 +423,23 @@ int  kp2000_probe_cores(struct kp2000_device *pcard)
INIT_LIST_HEAD(>uio_devices_list);
 
// First, iterate the core table looking for the highest CORE_ID
-   for (i = 0 ; i < pcard->core_table_length ; i++){
+   for (i = 0 ; i < 

[PATCH 0/6] Fix coding style issues in drivers/staging/kpc2000

2019-05-22 Thread Simon Sandström
These patches fixes a bunch of minor coding style issues in
kpc2000/cell_probe.c.

- Simon

Simon Sandström (6):
  staging: kpc2000: fix indent in cell_probe.c
  staging: kpc2000: add space between ) and { in cell_probe.c
  staging: kpc2000: fix invalid linebreaks in cell_probe.c
  staging: kpc2000: add spaces around operators in cell_probe.c
  staging: kpc2000: add space after comma in cell_probe.c
  staging: kpc2000: remove invalid spaces in cell_probe.c

 drivers/staging/kpc2000/kpc2000/cell_probe.c | 585 ++-
 1 file changed, 296 insertions(+), 289 deletions(-)

-- 
2.20.1

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


[PATCH 6/6] staging: kpc2000: remove invalid spaces in cell_probe.c

2019-05-22 Thread Simon Sandström
Fixes checkpatch.pl error "space prohibited before/after that
parenthesis".

Signed-off-by: Simon Sandström 
---
 drivers/staging/kpc2000/kpc2000/cell_probe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c 
b/drivers/staging/kpc2000/kpc2000/cell_probe.c
index 7d4986502013..98a7a3194519 100644
--- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
+++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
@@ -388,7 +388,7 @@ static int  kp2000_setup_dma_controller(struct 
kp2000_device *pcard)
 
// S2C Engines
for (i = 0 ; i < 32 ; i++) {
-   capabilities_reg = readq( pcard->dma_bar_base + 
KPC_DMA_S2C_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i) );
+   capabilities_reg = readq(pcard->dma_bar_base + 
KPC_DMA_S2C_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i));
if (capabilities_reg & ENGINE_CAP_PRESENT_MASK) {
err = create_dma_engine_core(pcard, 
(KPC_DMA_S2C_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i)), i,  pcard->pdev->irq);
if (err)
@@ -397,7 +397,7 @@ static int  kp2000_setup_dma_controller(struct 
kp2000_device *pcard)
}
// C2S Engines
for (i = 0 ; i < 32 ; i++) {
-   capabilities_reg = readq( pcard->dma_bar_base + 
KPC_DMA_C2S_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i) );
+   capabilities_reg = readq(pcard->dma_bar_base + 
KPC_DMA_C2S_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i));
if (capabilities_reg & ENGINE_CAP_PRESENT_MASK) {
err = create_dma_engine_core(pcard, 
(KPC_DMA_C2S_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i)), 32 + i,  
pcard->pdev->irq);
if (err)
-- 
2.20.1

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


[PATCH 3/6] staging: kpc2000: fix invalid linebreaks in cell_probe.c

2019-05-22 Thread Simon Sandström
Fixes checkpatch.pl error "else should follow close brace '}'" and
"trailing statements should be on next line".

Signed-off-by: Simon Sandström 
---
 drivers/staging/kpc2000/kpc2000/cell_probe.c | 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c 
b/drivers/staging/kpc2000/kpc2000/cell_probe.c
index 51d32970f025..4742f909db79 100644
--- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
+++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
@@ -85,8 +85,12 @@ static
 void parse_core_table_entry(struct core_table_entry *cte, const u64 read_val, 
const u8 entry_rev)
 {
switch (entry_rev) {
-   case 0: parse_core_table_entry_v0(cte, read_val); break;
-   default: cte->type = 0; break;
+   case 0:
+   parse_core_table_entry_v0(cte, read_val);
+   break;
+   default:
+   cte->type = 0;
+   break;
}
 }
 
@@ -387,7 +391,8 @@ static int  kp2000_setup_dma_controller(struct 
kp2000_device *pcard)
capabilities_reg = readq( pcard->dma_bar_base + 
KPC_DMA_S2C_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i) );
if (capabilities_reg & ENGINE_CAP_PRESENT_MASK) {
err = create_dma_engine_core(pcard, 
(KPC_DMA_S2C_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i)), i,  pcard->pdev->irq);
-   if (err) goto err_out;
+   if (err)
+   goto err_out;
}
}
// C2S Engines
@@ -395,7 +400,8 @@ static int  kp2000_setup_dma_controller(struct 
kp2000_device *pcard)
capabilities_reg = readq( pcard->dma_bar_base + 
KPC_DMA_C2S_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i) );
if (capabilities_reg & ENGINE_CAP_PRESENT_MASK) {
err = create_dma_engine_core(pcard, 
(KPC_DMA_C2S_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i)), 32+i,  pcard->pdev->irq);
-   if (err) goto err_out;
+   if (err)
+   goto err_out;
}
}
 
@@ -418,7 +424,8 @@ int  kp2000_probe_cores(struct kp2000_device *pcard)
dev_dbg(>pdev->dev, "kp2000_probe_cores(pcard = %p / %d)\n", 
pcard, pcard->card_num);
 
err = kp2000_setup_dma_controller(pcard);
-   if (err) return err;
+   if (err)
+   return err;
 
INIT_LIST_HEAD(>uio_devices_list);
 
-- 
2.20.1

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


[PATCH 1/6] staging: kpc2000: fix indent in cell_probe.c

2019-05-22 Thread Simon Sandström
Use tabs instead of spaces for indentation.

Signed-off-by: Simon Sandström 
---
 drivers/staging/kpc2000/kpc2000/cell_probe.c | 574 +--
 1 file changed, 287 insertions(+), 287 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c 
b/drivers/staging/kpc2000/kpc2000/cell_probe.c
index 0181b0a8ff82..6e034d115b47 100644
--- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
+++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
@@ -25,7 +25,7 @@
  *  D  
 C2S DMA Present
  *   DDD   
 C2S DMA Channel Number[up to 8 channels]
  *  II 
 IRQ Count [0 to 3 IRQs per core]
-  
111000
+ *
111000
  *III  
 IRQ Base Number [up to 128 IRQs per card]
  *   
___Spare
  *
@@ -40,45 +40,45 @@
 #define KP_CORE_ID_SPI  5
 
 struct core_table_entry {
-u16 type;
-u32 offset;
-u32 length;
-bools2c_dma_present;
-u8  s2c_dma_channel_num;
-boolc2s_dma_present;
-u8  c2s_dma_channel_num;
-u8  irq_count;
-u8  irq_base_num;
+   u16  type;
+   u32  offset;
+   u32  length;
+   bool s2c_dma_present;
+   u8   s2c_dma_channel_num;
+   bool c2s_dma_present;
+   u8   c2s_dma_channel_num;
+   u8   irq_count;
+   u8   irq_base_num;
 };
 
 static
 void  parse_core_table_entry_v0(struct core_table_entry *cte, const u64 
read_val)
 {
-cte->type= ((read_val & 0xFFF0) >> 52);
-cte->offset  = ((read_val & 0x) >> 16) * 4096;
-cte->length  = ((read_val & 0x) >> 32) * 8;
-cte->s2c_dma_present = ((read_val & 0x0008) >> 51);
-cte->s2c_dma_channel_num = ((read_val & 0x0007) >> 48);
-cte->c2s_dma_present = ((read_val & 0x8000) >> 15);
-cte->c2s_dma_channel_num = ((read_val & 0x7000) >> 12);
-cte->irq_count   = ((read_val & 0x0C00) >> 10);
-cte->irq_base_num= ((read_val & 0x03F8) >>  3);
+   cte->type= ((read_val & 0xFFF0) >> 52);
+   cte->offset  = ((read_val & 0x) >> 16) * 
4096;
+   cte->length  = ((read_val & 0x) >> 32) * 8;
+   cte->s2c_dma_present = ((read_val & 0x0008) >> 51);
+   cte->s2c_dma_channel_num = ((read_val & 0x0007) >> 48);
+   cte->c2s_dma_present = ((read_val & 0x8000) >> 15);
+   cte->c2s_dma_channel_num = ((read_val & 0x7000) >> 12);
+   cte->irq_count   = ((read_val & 0x0C00) >> 10);
+   cte->irq_base_num= ((read_val & 0x03F8) >>  3);
 }
 
 static
 void dbg_cte(struct kp2000_device *pcard, struct core_table_entry *cte)
 {
-dev_dbg(>pdev->dev, "CTE: type:%3d  offset:%3d (%3d)  length:%3d 
(%3d)  s2c:%d  c2s:%d  irq_count:%d  base_irq:%d\n",
-cte->type,
-cte->offset,
-cte->offset / 4096,
-cte->length,
-cte->length / 8,
-(cte->s2c_dma_present ? cte->s2c_dma_channel_num : -1),
-(cte->c2s_dma_present ? cte->c2s_dma_channel_num : -1),
-cte->irq_count,
-cte->irq_base_num
-);
+   dev_dbg(>pdev->dev, "CTE: type:%3d  offset:%3d (%3d)  length:%3d 
(%3d)  s2c:%d  c2s:%d  irq_count:%d  base_irq:%d\n",
+   cte->type,
+   cte->offset,
+   cte->offset / 4096,
+   cte->length,
+   cte->length / 8,
+   (cte->s2c_dma_present ? cte->s2c_dma_channel_num : -1),
+   (cte->c2s_dma_present ? cte->c2s_dma_channel_num : -1),
+   cte->irq_count,
+   cte->irq_base_num
+   );
 }
 
 static
@@ -94,55 +94,55 @@ void parse_core_table_entry(struct core_table_entry *cte, 
const u64 read_val, co
 static int probe_core_basic(unsigned int core_num, struct kp2000_device *pcard,
char *name, const struct core_table_entry cte)
 {
-struct mfd_cell  cell = { .id = core_num, .name = name };
-struct resource  resources[2];
+   struct mfd_cell  cell = { .id = core_num, .name = name };
+   struct resource resources[2];
 
-struct kpc_core_device_platdata  core_pdata = {
-.card_id   = pcard->card_id,
-.build_version = pcard->build_version,
-.hardware_revision = pcard->hardware_revision,
-.ssid  = pcard->ssid,
- 

[PATCH 4/6] staging: kpc2000: add spaces around operators in cell_probe.c

2019-05-22 Thread Simon Sandström
Fixes checkpatch.pl warning "spaces preferred around that ".

Signed-off-by: Simon Sandström 
---
 drivers/staging/kpc2000/kpc2000/cell_probe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c 
b/drivers/staging/kpc2000/kpc2000/cell_probe.c
index 4742f909db79..9a32660a56e2 100644
--- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
+++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
@@ -320,7 +320,7 @@ static int probe_core_uio(unsigned int core_num, struct 
kp2000_device *pcard,
 
kudev->uioinfo.mem[0].name = "uiomap";
kudev->uioinfo.mem[0].addr = pci_resource_start(pcard->pdev, REG_BAR) + 
cte.offset;
-   kudev->uioinfo.mem[0].size = (cte.length + PAGE_SIZE-1) & 
~(PAGE_SIZE-1); // Round up to nearest PAGE_SIZE boundary
+   kudev->uioinfo.mem[0].size = (cte.length + PAGE_SIZE - 1) & ~(PAGE_SIZE 
- 1); // Round up to nearest PAGE_SIZE boundary
kudev->uioinfo.mem[0].memtype = UIO_MEM_PHYS;
 
kudev->dev = device_create(kpc_uio_class, >pdev->dev, 
MKDEV(0,0), kudev, "%s.%d.%d.%d", kudev->uioinfo.name, pcard->card_num, 
cte.type, kudev->core_num);
@@ -399,7 +399,7 @@ static int  kp2000_setup_dma_controller(struct 
kp2000_device *pcard)
for (i = 0 ; i < 32 ; i++) {
capabilities_reg = readq( pcard->dma_bar_base + 
KPC_DMA_C2S_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i) );
if (capabilities_reg & ENGINE_CAP_PRESENT_MASK) {
-   err = create_dma_engine_core(pcard, 
(KPC_DMA_C2S_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i)), 32+i,  pcard->pdev->irq);
+   err = create_dma_engine_core(pcard, 
(KPC_DMA_C2S_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i)), 32 + i,  
pcard->pdev->irq);
if (err)
goto err_out;
}
@@ -481,7 +481,7 @@ int  kp2000_probe_cores(struct kp2000_device *pcard)
// Finally, instantiate a UIO device for the core_table.
cte.type= 0; // CORE_ID_BOARD_INFO
cte.offset  = 0; // board info is always at the beginning
-   cte.length  = 512*8;
+   cte.length  = 512 * 8;
cte.s2c_dma_present = false;
cte.s2c_dma_channel_num = 0;
cte.c2s_dma_present = false;
-- 
2.20.1

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


Re: [PATCH] staging: rtl8192u: Remove an unnecessary NULL check

2019-05-22 Thread Nathan Chancellor
On Wed, May 22, 2019 at 10:04:18AM +0300, Dan Carpenter wrote:
> On Tue, May 21, 2019 at 10:42:21AM -0700, Nathan Chancellor wrote:
> > Clang warns:
> > 
> > drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:2663:47: warning:
> > address of array 'param->u.wpa_ie.data' will always evaluate to 'true'
> > [-Wpointer-bool-conversion]
> > (param->u.wpa_ie.len && !param->u.wpa_ie.data))
> > ~^~~~
> > 
> > This was exposed by commit deabe03523a7 ("Staging: rtl8192u: ieee80211:
> > Use !x in place of NULL comparisons") because we disable the warning
> > that would have pointed out the comparison against NULL is also false:
> > 
> 
> Heh.  Weird.  Why would people disable one and not the other?
> 
> regards,
> dan carpenter
> 

-Wtautological-compare has a lot of different sub-warnings under it,
one of which is the one shown. -Wno-tautological-compare turns off all
of those other sub-warnings. The reason that was done is there are quite
a few of them:

https://gist.github.com/nathanchance/3336adc6e796b57eadd53b106b96c569

https://clang.llvm.org/docs/DiagnosticsReference.html#wtautological-compare

It is probably worth looking into turning that on, I'm going to try to
do that as I have time.

Cheers,
Nathan
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: kpc2000: kpc_i2c: fix platform_no_drv_owner.cocci warnings

2019-05-22 Thread kbuild test robot
From: kbuild test robot 

drivers/staging/kpc2000/kpc2000_i2c.c:652:3-8: No need to set .owner here. The 
core will do it.

 Remove .owner field if calls are used which set it automatically

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

Fixes: 43ad38191816 ("staging: kpc2000: kpc_i2c: add static qual to local 
symbols in kpc_i2c.c")
CC: Geordan Neukum 
Signed-off-by: kbuild test robot 
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
staging-next
head:   43ad38191816a6b77cc4bd8222353320a71a1d2d
commit: 43ad38191816a6b77cc4bd8222353320a71a1d2d [106/106] staging: kpc2000: 
kpc_i2c: add static qual to local symbols in kpc_i2c.c

 kpc2000_i2c.c |1 -
 1 file changed, 1 deletion(-)

--- a/drivers/staging/kpc2000/kpc2000_i2c.c
+++ b/drivers/staging/kpc2000/kpc2000_i2c.c
@@ -649,7 +649,6 @@ static struct platform_driver i2c_plat_d
.remove = pi2c_remove,
.driver = {
.name   = KP_DRIVER_NAME_I2C,
-   .owner  = THIS_MODULE,
},
 };
 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[staging:staging-next 106/106] drivers/staging/kpc2000/kpc2000_i2c.c:652:3-8: No need to set .owner here. The core will do it.

2019-05-22 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
staging-next
head:   43ad38191816a6b77cc4bd8222353320a71a1d2d
commit: 43ad38191816a6b77cc4bd8222353320a71a1d2d [106/106] staging: kpc2000: 
kpc_i2c: add static qual to local symbols in kpc_i2c.c

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 


coccinelle warnings: (new ones prefixed by >>)

>> drivers/staging/kpc2000/kpc2000_i2c.c:652:3-8: No need to set .owner here. 
>> The core will do it.

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: rtl8723bs: core: rtw_mlme_ext: fix warning Unneeded variable: "ret"

2019-05-22 Thread Hariprasad Kelam
This patch fixes below warnings reported by coccicheck

drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:1888:14-17: Unneeded
variable: "ret". Return "_FAIL" on line 1920
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:466:5-8: Unneeded
variable: "res". Return "_SUCCESS" on line 494

Signed-off-by: Hariprasad Kelam 

changes in v2:
change return type of init_mlme_ext_priv() from int to
void
We cant change return type of on_action_spct() it is a
call back function from action_handler.
So directly return _FAIL from this function.

---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c| 9 ++---
 drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 2 +-
 drivers/staging/rtl8723bs/os_dep/os_intfs.c  | 5 -
 3 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index d110d45..b240a40 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -461,9 +461,8 @@ static u8 init_channel_set(struct adapter *padapter, u8 
ChannelPlan, RT_CHANNEL_
return chanset_size;
 }
 
-intinit_mlme_ext_priv(struct adapter *padapter)
+void   init_mlme_ext_priv(struct adapter *padapter)
 {
-   int res = _SUCCESS;
struct registry_priv *pregistrypriv = >registrypriv;
struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
@@ -490,9 +489,6 @@ int init_mlme_ext_priv(struct adapter *padapter)
 #ifdef DBG_FIXED_CHAN
pmlmeext->fixed_chan = 0xFF;
 #endif
-
-   return res;
-
 }
 
 void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext)
@@ -1885,7 +1881,6 @@ unsigned int OnAtim(struct adapter *padapter, union 
recv_frame *precv_frame)
 
 unsigned int on_action_spct(struct adapter *padapter, union recv_frame 
*precv_frame)
 {
-   unsigned int ret = _FAIL;
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = >stapriv;
u8 *pframe = precv_frame->u.hdr.rx_data;
@@ -1917,7 +1912,7 @@ unsigned int on_action_spct(struct adapter *padapter, 
union recv_frame *precv_fr
}
 
 exit:
-   return ret;
+   return _FAIL;
 }
 
 unsigned int OnAction_back(struct adapter *padapter, union recv_frame 
*precv_frame)
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index f6eabad..0eb2da5 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -535,7 +535,7 @@ struct mlme_ext_priv
 };
 
 void init_mlme_default_rate_set(struct adapter *padapter);
-int init_mlme_ext_priv(struct adapter *padapter);
+void init_mlme_ext_priv(struct adapter *padapter);
 int init_hw_mlme_ext(struct adapter *padapter);
 void free_mlme_ext_priv (struct mlme_ext_priv *pmlmeext);
 extern void init_mlme_ext_timer(struct adapter *padapter);
diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c 
b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
index 8a9d838..c2422e5 100644
--- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
@@ -774,11 +774,6 @@ u8 rtw_init_drv_sw(struct adapter *padapter)
goto exit;
}
 
-   if (init_mlme_ext_priv(padapter) == _FAIL) {
-   RT_TRACE(_module_os_intfs_c_, _drv_err_, ("\n Can't init 
mlme_ext_priv\n"));
-   ret8 = _FAIL;
-   goto exit;
-   }
 
if (_rtw_init_xmit_priv(>xmitpriv, padapter) == _FAIL) {
DBG_871X("Can't _rtw_init_xmit_priv\n");
-- 
2.7.4

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


[PATCH v3] staging: rtl8723bs: core: rtw_ap: fix Unneeded variable: "ret". Return "0

2019-05-22 Thread Hariprasad Kelam
Function "rtw_sta_flush" always returns 0 value.
So change return type of rtw_sta_flush from int to void.

Same thing applies for rtw_hostapd_sta_flush

Signed-off-by: Hariprasad Kelam 
--
 Changes v2 -
   change return type of rtw_sta_flush
--
 Changes v3 -
   fix indentaion issue
---
 drivers/staging/rtl8723bs/core/rtw_ap.c   | 7 ++-
 drivers/staging/rtl8723bs/include/rtw_ap.h| 2 +-
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 4 ++--
 drivers/staging/rtl8723bs/os_dep/ioctl_linux.c| 7 +++
 4 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c 
b/drivers/staging/rtl8723bs/core/rtw_ap.c
index bc02306..19418ea 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -2189,10 +2189,9 @@ u8 ap_free_sta(
return beacon_updated;
 }
 
-int rtw_sta_flush(struct adapter *padapter)
+void rtw_sta_flush(struct adapter *padapter)
 {
struct list_head*phead, *plist;
-   int ret = 0;
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = >stapriv;
struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
@@ -2202,7 +2201,7 @@ int rtw_sta_flush(struct adapter *padapter)
DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(padapter->pnetdev));
 
if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE)
-   return ret;
+   return;
 
spin_lock_bh(>asoc_list_lock);
phead = >asoc_list;
@@ -2226,8 +2225,6 @@ int rtw_sta_flush(struct adapter *padapter)
issue_deauth(padapter, bc_addr, WLAN_REASON_DEAUTH_LEAVING);
 
associated_clients_update(padapter, true);
-
-   return ret;
 }
 
 /* called > TSR LEVEL for USB or SDIO Interface*/
diff --git a/drivers/staging/rtl8723bs/include/rtw_ap.h 
b/drivers/staging/rtl8723bs/include/rtw_ap.h
index fd56c9db..d6f3a3a 100644
--- a/drivers/staging/rtl8723bs/include/rtw_ap.h
+++ b/drivers/staging/rtl8723bs/include/rtw_ap.h
@@ -31,7 +31,7 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, 
struct sta_info *psta);
 void sta_info_update(struct adapter *padapter, struct sta_info *psta);
 void ap_sta_info_defer_update(struct adapter *padapter, struct sta_info *psta);
 u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta, bool active, 
u16 reason);
-int rtw_sta_flush(struct adapter *padapter);
+void rtw_sta_flush(struct adapter *padapter);
 void start_ap_mode(struct adapter *padapter);
 void stop_ap_mode(struct adapter *padapter);
 
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index db553f2..ce57e0e 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -2896,9 +2896,9 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, 
struct net_device *ndev
 
flush_all_cam_entry(padapter);  /* clear CAM */
 
-   ret = rtw_sta_flush(padapter);
+   rtw_sta_flush(padapter);
 
-   return ret;
+   return 0;
}
 
 
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index e3d3569..a4d05f2 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -3754,7 +3754,7 @@ static int rtw_set_beacon(struct net_device *dev, struct 
ieee_param *param, int
 
 }
 
-static int rtw_hostapd_sta_flush(struct net_device *dev)
+static void rtw_hostapd_sta_flush(struct net_device *dev)
 {
/* _irqL irqL; */
/* struct list_head *phead, *plist; */
@@ -3766,8 +3766,7 @@ static int rtw_hostapd_sta_flush(struct net_device *dev)
 
flush_all_cam_entry(padapter);  /* clear CAM */
 
-   return rtw_sta_flush(padapter);
-
+   rtw_sta_flush(padapter);
 }
 
 static int rtw_add_sta(struct net_device *dev, struct ieee_param *param)
@@ -4254,7 +4253,7 @@ static int rtw_hostapd_ioctl(struct net_device *dev, 
struct iw_point *p)
switch (param->cmd) {
case RTL871X_HOSTAPD_FLUSH:
 
-   ret = rtw_hostapd_sta_flush(dev);
+   rtw_hostapd_sta_flush(dev);
 
break;
 
-- 
2.7.4

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


[PATCH] staging: unisys: visornic: Replace GFP_ATOMIC with GFP_KERNEL

2019-05-22 Thread Hariprasad Kelam
As per below information

GFP_KERNEL  FLAG

This is a normal allocation and might block. This is the flag to use in
process context code when it is safe to sleep.

GFP_ATOMIC FLAG

The allocation is high-priority and does not sleep. This is the flag to
use in interrupt handlers, bottom halves and other situations where you
cannot sleep

And we can take advantage of GFP_KERNEL , as when system is in low
memory chances of getting success is high compared to GFP_ATOMIC.

As visornic_probe is in  process context we can use GPF_KERNEL.

Signed-off-by: Hariprasad Kelam 
---
 drivers/staging/unisys/visornic/visornic_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c 
b/drivers/staging/unisys/visornic/visornic_main.c
index 1c1a470..9d4f1da 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -1861,12 +1861,12 @@ static int visornic_probe(struct visor_device *dev)
skb_queue_head_init(>xmitbufhead);
 
/* create a cmdrsp we can use to post and unpost rcv buffers */
-   devdata->cmdrsp_rcv = kmalloc(SIZEOF_CMDRSP, GFP_ATOMIC);
+   devdata->cmdrsp_rcv = kmalloc(SIZEOF_CMDRSP, GFP_KERNEL);
if (!devdata->cmdrsp_rcv) {
err = -ENOMEM;
goto cleanup_rcvbuf;
}
-   devdata->xmit_cmdrsp = kmalloc(SIZEOF_CMDRSP, GFP_ATOMIC);
+   devdata->xmit_cmdrsp = kmalloc(SIZEOF_CMDRSP, GFP_KERNEL);
if (!devdata->xmit_cmdrsp) {
err = -ENOMEM;
goto cleanup_cmdrsp_rcv;
-- 
2.7.4

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


[Patch v3] staging: rtl8723bs: core: rtw_ap: fix Unneeded variable: "ret". Return "0

2019-05-22 Thread Hariprasad Kelam
Function "rtw_sta_flush" always returns 0 value.
So change return type of rtw_sta_flush from int to void.

Same thing applies for rtw_hostapd_sta_flush

Signed-off-by: Hariprasad Kelam 
--
 Changes v2 -
   change return type of rtw_sta_flush
--
 Changes v3 -
   fix indentaion issue

---
 drivers/staging/rtl8723bs/core/rtw_ap.c   | 7 ++-
 drivers/staging/rtl8723bs/include/rtw_ap.h| 2 +-
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 4 ++--
 drivers/staging/rtl8723bs/os_dep/ioctl_linux.c| 7 +++
 4 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c 
b/drivers/staging/rtl8723bs/core/rtw_ap.c
index bc02306..19418ea 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -2189,10 +2189,9 @@ u8 ap_free_sta(
return beacon_updated;
 }
 
-int rtw_sta_flush(struct adapter *padapter)
+void rtw_sta_flush(struct adapter *padapter)
 {
struct list_head*phead, *plist;
-   int ret = 0;
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = >stapriv;
struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
@@ -2202,7 +2201,7 @@ int rtw_sta_flush(struct adapter *padapter)
DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(padapter->pnetdev));
 
if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE)
-   return ret;
+   return;
 
spin_lock_bh(>asoc_list_lock);
phead = >asoc_list;
@@ -2226,8 +2225,6 @@ int rtw_sta_flush(struct adapter *padapter)
issue_deauth(padapter, bc_addr, WLAN_REASON_DEAUTH_LEAVING);
 
associated_clients_update(padapter, true);
-
-   return ret;
 }
 
 /* called > TSR LEVEL for USB or SDIO Interface*/
diff --git a/drivers/staging/rtl8723bs/include/rtw_ap.h 
b/drivers/staging/rtl8723bs/include/rtw_ap.h
index fd56c9db..d6f3a3a 100644
--- a/drivers/staging/rtl8723bs/include/rtw_ap.h
+++ b/drivers/staging/rtl8723bs/include/rtw_ap.h
@@ -31,7 +31,7 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, 
struct sta_info *psta);
 void sta_info_update(struct adapter *padapter, struct sta_info *psta);
 void ap_sta_info_defer_update(struct adapter *padapter, struct sta_info *psta);
 u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta, bool active, 
u16 reason);
-int rtw_sta_flush(struct adapter *padapter);
+void rtw_sta_flush(struct adapter *padapter);
 void start_ap_mode(struct adapter *padapter);
 void stop_ap_mode(struct adapter *padapter);
 
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index db553f2..ce57e0e 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -2896,9 +2896,9 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, 
struct net_device *ndev
 
flush_all_cam_entry(padapter);  /* clear CAM */
 
-   ret = rtw_sta_flush(padapter);
+   rtw_sta_flush(padapter);
 
-   return ret;
+   return 0;
}
 
 
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index e3d3569..a4d05f2 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -3754,7 +3754,7 @@ static int rtw_set_beacon(struct net_device *dev, struct 
ieee_param *param, int
 
 }
 
-static int rtw_hostapd_sta_flush(struct net_device *dev)
+static void rtw_hostapd_sta_flush(struct net_device *dev)
 {
/* _irqL irqL; */
/* struct list_head *phead, *plist; */
@@ -3766,8 +3766,7 @@ static int rtw_hostapd_sta_flush(struct net_device *dev)
 
flush_all_cam_entry(padapter);  /* clear CAM */
 
-   return rtw_sta_flush(padapter);
-
+   rtw_sta_flush(padapter);
 }
 
 static int rtw_add_sta(struct net_device *dev, struct ieee_param *param)
@@ -4254,7 +4253,7 @@ static int rtw_hostapd_ioctl(struct net_device *dev, 
struct iw_point *p)
switch (param->cmd) {
case RTL871X_HOSTAPD_FLUSH:
 
-   ret = rtw_hostapd_sta_flush(dev);
+   rtw_hostapd_sta_flush(dev);
 
break;
 
-- 
2.7.4

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


Re: [PATCH] Staging: rtl8723bs: os_dep: Remove functions that don't perform any task

2019-05-22 Thread Greg KH
On Wed, May 22, 2019 at 09:30:56PM +0530, Puranjay Mohan wrote:
> Remove functions which return 0 without performing any task.
> Fix following warnings issued by coccicheck:
> Unneeded variable: "err". Return "0" on line 4484
> and similar other warnings.
> 
> Signed-off-by: Puranjay Mohan 
> ---
>  .../staging/rtl8723bs/os_dep/ioctl_linux.c| 41 ---
>  1 file changed, 41 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c 
> b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> index bfbbcf0bded3..3b5f3e9ae5f7 100644
> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
> @@ -4476,43 +4476,6 @@ static int rtw_pm_set(struct net_device *dev,
>   return ret;
>  }
>  
> -static int rtw_mp_efuse_get(struct net_device *dev,
> - struct iw_request_info *info,
> - union iwreq_data *wdata, char *extra)
> -{
> - int err = 0;
> - return err;
> -}
> -
> -static int rtw_mp_efuse_set(struct net_device *dev,
> - struct iw_request_info *info,
> - union iwreq_data *wdata, char *extra)
> -{
> - int err = 0;
> - return err;
> -}
> -
> -static int rtw_tdls(struct net_device *dev,
> - struct iw_request_info *info,
> - union iwreq_data *wrqu, char *extra)
> -{
> - int ret = 0;
> - return ret;
> -}
> -
> -
> -static int rtw_tdls_get(struct net_device *dev,
> - struct iw_request_info *info,
> - union iwreq_data *wrqu, char *extra)
> -{
> - int ret = 0;
> - return ret;
> -}
> -
> -
> -
> -
> -
>  static int rtw_test(
>   struct net_device *dev,
>   struct iw_request_info *info,
> @@ -4789,15 +4752,11 @@ static iw_handler rtw_private_handler[] = {
>   NULL,   /* 0x12 */
>   rtw_p2p_get2,   /* 0x13 */
>  
> - rtw_tdls,   /* 0x14 */
> - rtw_tdls_get,   /* 0x15 */
>  
>   rtw_pm_set, /* 0x16 */
>   rtw_wx_priv_null,   /* 0x17 */
>   rtw_rereg_nd_name,  /* 0x18 */
>   rtw_wx_priv_null,   /* 0x19 */
> - rtw_mp_efuse_set,   /* 0x1A */
> - rtw_mp_efuse_get,   /* 0x1B */
>   NULL,   /*  0x1C is 
> reserved for hostapd */
>   rtw_test,   /*  0x1D */
>  };

Are you _SURE_ you can just delete those lines?

{hint I do not think so, prove me wrong...}

thanks,

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


[PATCH] Staging: rtl8723bs: os_dep: Remove functions that don't perform any task

2019-05-22 Thread Puranjay Mohan
Remove functions which return 0 without performing any task.
Fix following warnings issued by coccicheck:
Unneeded variable: "err". Return "0" on line 4484
and similar other warnings.

Signed-off-by: Puranjay Mohan 
---
 .../staging/rtl8723bs/os_dep/ioctl_linux.c| 41 ---
 1 file changed, 41 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index bfbbcf0bded3..3b5f3e9ae5f7 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -4476,43 +4476,6 @@ static int rtw_pm_set(struct net_device *dev,
return ret;
 }
 
-static int rtw_mp_efuse_get(struct net_device *dev,
-   struct iw_request_info *info,
-   union iwreq_data *wdata, char *extra)
-{
-   int err = 0;
-   return err;
-}
-
-static int rtw_mp_efuse_set(struct net_device *dev,
-   struct iw_request_info *info,
-   union iwreq_data *wdata, char *extra)
-{
-   int err = 0;
-   return err;
-}
-
-static int rtw_tdls(struct net_device *dev,
-   struct iw_request_info *info,
-   union iwreq_data *wrqu, char *extra)
-{
-   int ret = 0;
-   return ret;
-}
-
-
-static int rtw_tdls_get(struct net_device *dev,
-   struct iw_request_info *info,
-   union iwreq_data *wrqu, char *extra)
-{
-   int ret = 0;
-   return ret;
-}
-
-
-
-
-
 static int rtw_test(
struct net_device *dev,
struct iw_request_info *info,
@@ -4789,15 +4752,11 @@ static iw_handler rtw_private_handler[] = {
NULL,   /* 0x12 */
rtw_p2p_get2,   /* 0x13 */
 
-   rtw_tdls,   /* 0x14 */
-   rtw_tdls_get,   /* 0x15 */
 
rtw_pm_set, /* 0x16 */
rtw_wx_priv_null,   /* 0x17 */
rtw_rereg_nd_name,  /* 0x18 */
rtw_wx_priv_null,   /* 0x19 */
-   rtw_mp_efuse_set,   /* 0x1A */
-   rtw_mp_efuse_get,   /* 0x1B */
NULL,   /*  0x1C is 
reserved for hostapd */
rtw_test,   /*  0x1D */
 };
-- 
2.21.0

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


Re: [PATCH v6 0/6] staging: kpc2000: another batch of fixes

2019-05-22 Thread Jeremy Sowden
On 2019-05-22, at 14:45:51 +0200, Greg KH wrote:
> On Tue, May 21, 2019 at 11:35:18AM +0100, Jeremy Sowden wrote:
> > There are a number relating to device attributes, one formatting
> > patch, and another that changes how card numbers are assigned.
> >
> > Greg reckoned that the changes to the code in the attribute
> > call-backs that gets the struct kpc2000 object from the struct
> > device object were broken.  I've reviewed them and split them into
> > two patches because I was doing two different things in the previous
> > patch.  I *think* they are correct, but I've moved them to the end
> > of the series in case I really have just got the wrong end of the
> > stick, so they can easily be dropped.
>
> Thanks for sticking with this, now applied.

Cheers. :)

J.


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 3/6] staging: kpc2000: kpc_i2c: newline fixups to meet linux style guide

2019-05-22 Thread Greg Kroah-Hartman
On Wed, May 22, 2019 at 12:13:59PM +, Geordan Neukum wrote:
> The linux coding style document states:
> 
>   1) That braces should not be used where a single single statement
>  will do. Therefore all instances of single block statements
>  wrapped in braces that do not meet the qualifications of any
>  of the exceptions to the rule should be fixed up.
> 
>   2) That the declaration of variables local to a given function
>  should be immediately followed by a blank newline. Therefore,
>  the single instance of this in kpc2000_i2c.c should be fixed
>  up.

This really should be 2 different patches, but given that this file is
so messy, I'll take it for now :)

thanks,

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


Re: [PATCH v6 0/6] staging: kpc2000: another batch of fixes

2019-05-22 Thread Greg KH
On Tue, May 21, 2019 at 11:35:18AM +0100, Jeremy Sowden wrote:
> There are a number relating to device attributes, one formatting patch,
> and another that changes how card numbers are assigned.
> 
> Greg reckoned that the changes to the code in the attribute call-backs
> that gets the struct kpc2000 object from the struct device object were
> broken.  I've reviewed them and split them into two patches because I
> was doing two different things in the previous patch.  I *think* they
> are correct, but I've moved them to the end of the series in case I
> really have just got the wrong end of the stick, so they can easily be
> dropped.

Thanks for sticking with this, now applied.

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


Re: [Patch v2] staging: rtl8723bs: core: rtw_ap: fix Unneeded variable: "ret". Return "0

2019-05-22 Thread Greg Kroah-Hartman
On Wed, May 22, 2019 at 12:30:33AM +0530, Hariprasad Kelam wrote:
> Function "rtw_sta_flush" always returns 0 value.
> So change return type of rtw_sta_flush from int to void.
> 
> Same thing applies for rtw_hostapd_sta_flush
> 
> Signed-off-by: Hariprasad Kelam 
> --
> Changes v2 -
>   change return type of rtw_sta_flush
> 
> -
>  drivers/staging/rtl8723bs/core/rtw_ap.c   | 7 ++-
>  drivers/staging/rtl8723bs/include/rtw_ap.h| 2 +-
>  drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 4 ++--
>  drivers/staging/rtl8723bs/os_dep/ioctl_linux.c| 7 +++
>  4 files changed, 8 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c 
> b/drivers/staging/rtl8723bs/core/rtw_ap.c
> index bc02306..19418ea 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_ap.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
> @@ -2189,10 +2189,9 @@ u8 ap_free_sta(
>   return beacon_updated;
>  }
>  
> -int rtw_sta_flush(struct adapter *padapter)
> +void rtw_sta_flush(struct adapter *padapter)
>  {
>   struct list_head*phead, *plist;
> - int ret = 0;
>   struct sta_info *psta = NULL;
>   struct sta_priv *pstapriv = >stapriv;
>   struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
> @@ -2202,7 +2201,7 @@ int rtw_sta_flush(struct adapter *padapter)
>   DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(padapter->pnetdev));
>  
>   if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE)
> - return ret;
> + return ;

Odd use of a ' ' character here :(

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


Re: [PATCH v3 3/6] staging: kpc2000: simplified kp2000_device retrieval in device attributes call-backs.

2019-05-22 Thread Greg KH
On Tue, May 21, 2019 at 02:23:13PM +0300, Dan Carpenter wrote:
> On Fri, May 17, 2019 at 01:54:51PM +0200, Greg KH wrote:
> > On Fri, May 17, 2019 at 12:03:12PM +0100, Jeremy Sowden wrote:
> > >  static ssize_t  show_attr(struct device *dev, struct device_attribute 
> > > *attr, char *buf)
> > >  {
> > > -struct pci_dev *pdev = to_pci_dev(dev);
> > > -struct kp2000_device *pcard;
> > > -
> > > -if (!pdev)  return -ENXIO;
> > > -pcard = pci_get_drvdata(pdev);
> > > -if (!pcard)  return -ENXIO;
> > > +struct kp2000_device *pcard = dev_get_drvdata(dev);
> > 
> > Wait, dev_get_drvdata() is not returning you the same pointer that
> > pci_get_drvdata() does.  So I think this is now broken :(
> > 
> 
> It looks sort of weird but it's fine.
> 
> > What this should look like is this:
> > struct pci_dev *pdev = to_pci_dev(dev);
> > struct kp200_device *pcard = pci_get_drvdata(pdev);
> > 
> > if (!pcard)
> > return -ENODEV;
> > 
> > that is IF the driver really is setting the pci dev data to NULL when
> > the device is removed from the driver.  Is it?
> 
> Yes.  The pci_get_drvdata() is only set to NULL after we remove the
> sysfs files so pci_get_drvdata() always returns a valid pointer.

Ugh, I am wrong, it's not as if I didn't actually write the
dev_get_drvdata() and pci_get_drvdata() code 15+ years ago, you would
think I would have remembered something like this :(

Anyway, patches look good, sorry for the noise...

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


Re: [PATCH 0/6] Minor updates to kpc_i2c driver and kpc2000 core

2019-05-22 Thread Greg Kroah-Hartman
On Wed, May 22, 2019 at 12:13:56PM +, Geordan Neukum wrote:
> Attached are an assortment of minor updates to the kpc_i2c driver as
> well as a build fix for all of those who will need the KPC2000 core.

Nit, please put "staging" in your 0/6 patch to make it easier for
scripts to pick this up properly.  For next time please.

thanks,

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


Re: [PATCH 1/6] staging: kpc2000: make kconfig symbol 'KPC2000' select dependencies

2019-05-22 Thread Greg Kroah-Hartman
On Wed, May 22, 2019 at 12:13:57PM +, Geordan Neukum wrote:
> The kpc2000 core makes calls against functions which are conditionally
> exported upon the kconfig symbols 'MFD_CORE' and 'UIO' being selected
> Therefore, in order to guarantee correct compilation, the 'KPC2000'
> kconfig symbol (which brings in that code) must explicitly select its
> hard dependencies.
> 
> Signed-off-by: Geordan Neukum 
> ---
>  drivers/staging/kpc2000/Kconfig | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/staging/kpc2000/Kconfig b/drivers/staging/kpc2000/Kconfig
> index fb5922928f47..8992dc67ff37 100644
> --- a/drivers/staging/kpc2000/Kconfig
> +++ b/drivers/staging/kpc2000/Kconfig
> @@ -3,6 +3,8 @@
>  config KPC2000
>   bool "Daktronics KPC Device support"
>   depends on PCI
> + select MFD_CORE
> + select UIO

depends on is better than select.  There's a change to depend on UIO for
this code already in my -linus branch which will show up in Linus's tree
in a week or so.

Are you sure we need MFD_CORE as well for this code?  Why hasn't that
been seen on any build errors?

thanks,

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


[PATCH 2/6] staging: kpc2000: kpc_i2c: remove unused module param disable_features

2019-05-22 Thread Geordan Neukum
The module parameter 'disable_features' is currently unused. Therefore,
it should be removed.

Signed-off-by: Geordan Neukum 
---
 drivers/staging/kpc2000/kpc2000_i2c.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000_i2c.c 
b/drivers/staging/kpc2000/kpc2000_i2c.c
index 42061318d2d4..40a89998726e 100644
--- a/drivers/staging/kpc2000/kpc2000_i2c.c
+++ b/drivers/staging/kpc2000/kpc2000_i2c.c
@@ -126,10 +126,6 @@ struct i2c_device {
 /* Not really a feature, but it's convenient to handle it as such */
 #define FEATURE_IDF (1 << 15)
 
-static unsigned int disable_features;
-module_param(disable_features, uint, S_IRUGO | S_IWUSR);
-MODULE_PARM_DESC(disable_features, "Disable selected driver features");
-
 // FIXME!
 #undef inb_p
 #define inb_p(a) readq((void*)a)
-- 
2.21.0

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


[PATCH 0/6] Minor updates to kpc_i2c driver and kpc2000 core

2019-05-22 Thread Geordan Neukum
Attached are an assortment of minor updates to the kpc_i2c driver as
well as a build fix for all of those who will need the KPC2000 core.

Thanks,
Geordan

Geordan Neukum (6):
  staging: kpc2000: make kconfig symbol 'KPC2000' select dependencies
  staging: kpc2000: kpc_i2c: remove unused module param disable_features
  staging: kpc2000: kpc_i2c: newline fixups to meet linux style guide
  staging: kpc2000: kpc_i2c: use  instead of 
  staging: kpc2000: kpc_i2c: Remove unnecessary function tracing prints
  staging: kpc2000: kpc_i2c: add static qual to local symbols in
kpc_i2c.c

 drivers/staging/kpc2000/Kconfig   |   2 +
 drivers/staging/kpc2000/kpc2000_i2c.c | 118 +++---
 2 files changed, 34 insertions(+), 86 deletions(-)

-- 
2.21.0

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


[PATCH 5/6] staging: kpc2000: kpc_i2c: Remove unnecessary function tracing prints

2019-05-22 Thread Geordan Neukum
Many of the functions in kpc_i2c log debug-level messages to the
kernel log message buffer upon invocation. This is unnecessary, as
debugging tools like kgdb, kdb, etc. or the tracing tool ftrace
should be able to provide this same information. Therefore, remove
these print statements.

Signed-off-by: Geordan Neukum 
---
 drivers/staging/kpc2000/kpc2000_i2c.c | 26 --
 1 file changed, 26 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000_i2c.c 
b/drivers/staging/kpc2000/kpc2000_i2c.c
index 5d98ed54c05c..f9259c06b605 100644
--- a/drivers/staging/kpc2000/kpc2000_i2c.c
+++ b/drivers/staging/kpc2000/kpc2000_i2c.c
@@ -139,8 +139,6 @@ static int i801_check_pre(struct i2c_device *priv)
 {
int status;
 
-   dev_dbg(>adapter.dev, "%s\n", __func__);
-
status = inb_p(SMBHSTSTS(priv));
if (status & SMBHSTSTS_HOST_BUSY) {
dev_err(>adapter.dev, "SMBus is busy, can't use it! 
(status=%x)\n", status);
@@ -165,8 +163,6 @@ static int i801_check_post(struct i2c_device *priv, int 
status, int timeout)
 {
int result = 0;
 
-   dev_dbg(>adapter.dev, "%s\n", __func__);
-
/* If the SMBus is still busy, we give up */
if (timeout) {
dev_err(>adapter.dev, "Transaction timeout\n");
@@ -214,8 +210,6 @@ static int i801_transaction(struct i2c_device *priv, int 
xact)
int result;
int timeout = 0;
 
-   dev_dbg(>adapter.dev, "%s\n", __func__);
-
result = i801_check_pre(priv);
if (result < 0)
return result;
@@ -244,8 +238,6 @@ static void i801_wait_hwpec(struct i2c_device *priv)
int timeout = 0;
int status;
 
-   dev_dbg(>adapter.dev, "%s\n", __func__);
-
do {
usleep_range(250, 500);
status = inb_p(SMBHSTSTS(priv));
@@ -262,8 +254,6 @@ static int i801_block_transaction_by_block(struct 
i2c_device *priv, union i2c_sm
int i, len;
int status;
 
-   dev_dbg(>adapter.dev, "%s\n", __func__);
-
inb_p(SMBHSTCNT(priv)); /* reset the data buffer index */
 
/* Use 32-byte buffer to process this transaction */
@@ -298,8 +288,6 @@ static int i801_block_transaction_byte_by_byte(struct 
i2c_device *priv, union i2
int result;
int timeout;
 
-   dev_dbg(>adapter.dev, "%s\n", __func__);
-
result = i801_check_pre(priv);
if (result < 0)
return result;
@@ -364,8 +352,6 @@ static int i801_block_transaction_byte_by_byte(struct 
i2c_device *priv, union i2
 
 static int i801_set_block_buffer_mode(struct i2c_device *priv)
 {
-   dev_dbg(>adapter.dev, "%s\n", __func__);
-
outb_p(inb_p(SMBAUXCTL(priv)) | SMBAUXCTL_E32B, SMBAUXCTL(priv));
if ((inb_p(SMBAUXCTL(priv)) & SMBAUXCTL_E32B) == 0)
return -EIO;
@@ -378,8 +364,6 @@ static int i801_block_transaction(struct i2c_device *priv, 
union i2c_smbus_data
int result = 0;
//unsigned char hostc;
 
-   dev_dbg(>adapter.dev, "%s\n", __func__);
-
if (command == I2C_SMBUS_I2C_BLOCK_DATA) {
if (read_write == I2C_SMBUS_WRITE) {
/* set I2C_EN bit in configuration register */
@@ -427,10 +411,6 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr, 
unsigned short flags,
int ret, xact = 0;
struct i2c_device *priv = i2c_get_adapdata(adap);
 
-   dev_dbg(>adapter.dev,
-   "%s (addr=%0d)  flags=%x  read_write=%x  command=%x  size=%x",
-   __func__, addr, flags, read_write, command, size);
-
hwpec = (priv->features & FEATURE_SMBUS_PEC) && (flags & 
I2C_CLIENT_PEC) && size != I2C_SMBUS_QUICK && size != I2C_SMBUS_I2C_BLOCK_DATA;
 
switch (size) {
@@ -605,9 +585,6 @@ int pi2c_probe(struct platform_device *pldev)
struct i2c_device *priv;
struct resource *res;
 
-   dev_dbg(>dev, "%s(pldev = %p '%s')\n", __func__, pldev,
-   pldev->name);
-
priv = devm_kzalloc(>dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
@@ -653,9 +630,6 @@ int pi2c_remove(struct platform_device *pldev)
 {
struct i2c_device *lddev;
 
-   dev_dbg(>dev, "%s(pldev = %p '%s')\n", __func__, pldev,
-   pldev->name);
-
lddev = (struct i2c_device *)pldev->dev.platform_data;
 
i2c_del_adapter(>adapter);
-- 
2.21.0

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


[PATCH 4/6] staging: kpc2000: kpc_i2c: use instead of

2019-05-22 Thread Geordan Neukum
Rather than include asm/io.h, include linux/io.h. Issue reported
by the script checkpatch.pl.

Signed-off-by: Geordan Neukum 
---
 drivers/staging/kpc2000/kpc2000_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/kpc2000/kpc2000_i2c.c 
b/drivers/staging/kpc2000/kpc2000_i2c.c
index a1ebc2386d70..5d98ed54c05c 100644
--- a/drivers/staging/kpc2000/kpc2000_i2c.c
+++ b/drivers/staging/kpc2000/kpc2000_i2c.c
@@ -19,7 +19,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
-- 
2.21.0

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


[PATCH 6/6] staging: kpc2000: kpc_i2c: add static qual to local symbols in kpc_i2c.c

2019-05-22 Thread Geordan Neukum
kpc_i2c.c declares:
  - two functions
- pi2c_probe()
- pi2c_remove()
  - one struct
- i2c_plat_driver_i
which are local to the file, yet missing the static qualifier. Add the
static qualifier to these symbols.

Signed-off-by: Geordan Neukum 
---
 drivers/staging/kpc2000/kpc2000_i2c.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000_i2c.c 
b/drivers/staging/kpc2000/kpc2000_i2c.c
index f9259c06b605..97e738349ba2 100644
--- a/drivers/staging/kpc2000/kpc2000_i2c.c
+++ b/drivers/staging/kpc2000/kpc2000_i2c.c
@@ -579,7 +579,7 @@ static const struct i2c_algorithm smbus_algorithm = {
 /
  *** Part 2 - Driver Handlers ***
  /
-int pi2c_probe(struct platform_device *pldev)
+static int pi2c_probe(struct platform_device *pldev)
 {
int err;
struct i2c_device *priv;
@@ -626,7 +626,7 @@ int pi2c_probe(struct platform_device *pldev)
return 0;
 }
 
-int pi2c_remove(struct platform_device *pldev)
+static int pi2c_remove(struct platform_device *pldev)
 {
struct i2c_device *lddev;
 
@@ -644,7 +644,7 @@ int pi2c_remove(struct platform_device *pldev)
return 0;
 }
 
-struct platform_driver i2c_plat_driver_i = {
+static struct platform_driver i2c_plat_driver_i = {
.probe  = pi2c_probe,
.remove = pi2c_remove,
.driver = {
-- 
2.21.0

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


[PATCH 3/6] staging: kpc2000: kpc_i2c: newline fixups to meet linux style guide

2019-05-22 Thread Geordan Neukum
The linux coding style document states:

  1) That braces should not be used where a single single statement
 will do. Therefore all instances of single block statements
 wrapped in braces that do not meet the qualifications of any
 of the exceptions to the rule should be fixed up.

  2) That the declaration of variables local to a given function
 should be immediately followed by a blank newline. Therefore,
 the single instance of this in kpc2000_i2c.c should be fixed
 up.

Signed-off-by: Geordan Neukum 
---
 drivers/staging/kpc2000/kpc2000_i2c.c | 82 ++-
 1 file changed, 29 insertions(+), 53 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000_i2c.c 
b/drivers/staging/kpc2000/kpc2000_i2c.c
index 40a89998726e..a1ebc2386d70 100644
--- a/drivers/staging/kpc2000/kpc2000_i2c.c
+++ b/drivers/staging/kpc2000/kpc2000_i2c.c
@@ -178,9 +178,8 @@ static int i801_check_post(struct i2c_device *priv, int 
status, int timeout)
 
/* Check if it worked */
status = inb_p(SMBHSTSTS(priv));
-   if ((status & SMBHSTSTS_HOST_BUSY) || !(status & 
SMBHSTSTS_FAILED)) {
+   if ((status & SMBHSTSTS_HOST_BUSY) || !(status & 
SMBHSTSTS_FAILED))
dev_err(>adapter.dev, "Failed terminating the 
transaction\n");
-   }
outb_p(STATUS_FLAGS, SMBHSTSTS(priv));
return -ETIMEDOUT;
}
@@ -202,9 +201,8 @@ static int i801_check_post(struct i2c_device *priv, int 
status, int timeout)
/* Clear error flags */
outb_p(status & STATUS_FLAGS, SMBHSTSTS(priv));
status = inb_p(SMBHSTSTS(priv)) & STATUS_FLAGS;
-   if (status) {
+   if (status)
dev_warn(>adapter.dev, "Failed clearing status 
flags at end of transaction (%02x)\n", status);
-   }
}
 
return result;
@@ -219,9 +217,8 @@ static int i801_transaction(struct i2c_device *priv, int 
xact)
dev_dbg(>adapter.dev, "%s\n", __func__);
 
result = i801_check_pre(priv);
-   if (result < 0) {
+   if (result < 0)
return result;
-   }
/* the current contents of SMBHSTCNT can be overwritten, since PEC,
 * INTREN, SMBSCMD are passed in xact
 */
@@ -234,9 +231,8 @@ static int i801_transaction(struct i2c_device *priv, int 
xact)
} while ((status & SMBHSTSTS_HOST_BUSY) && (timeout++ < MAX_RETRIES));
 
result = i801_check_post(priv, status, timeout > MAX_RETRIES);
-   if (result < 0) {
+   if (result < 0)
return result;
-   }
 
outb_p(SMBHSTSTS_INTR, SMBHSTSTS(priv));
return 0;
@@ -255,9 +251,8 @@ static void i801_wait_hwpec(struct i2c_device *priv)
status = inb_p(SMBHSTSTS(priv));
} while ((!(status & SMBHSTSTS_INTR)) && (timeout++ < MAX_RETRIES));
 
-   if (timeout > MAX_RETRIES) {
+   if (timeout > MAX_RETRIES)
dev_dbg(>adapter.dev, "PEC Timeout!\n");
-   }
 
outb_p(status, SMBHSTSTS(priv));
 }
@@ -275,26 +270,22 @@ static int i801_block_transaction_by_block(struct 
i2c_device *priv, union i2c_sm
if (read_write == I2C_SMBUS_WRITE) {
len = data->block[0];
outb_p(len, SMBHSTDAT0(priv));
-   for (i = 0; i < len; i++) {
+   for (i = 0; i < len; i++)
outb_p(data->block[i+1], SMBBLKDAT(priv));
-   }
}
 
status = i801_transaction(priv, I801_BLOCK_DATA | ENABLE_INT9 | 
I801_PEC_EN * hwpec);
-   if (status) {
+   if (status)
return status;
-   }
 
if (read_write == I2C_SMBUS_READ) {
len = inb_p(SMBHSTDAT0(priv));
-   if (len < 1 || len > I2C_SMBUS_BLOCK_MAX) {
+   if (len < 1 || len > I2C_SMBUS_BLOCK_MAX)
return -EPROTO;
-   }
 
data->block[0] = len;
-   for (i = 0; i < len; i++) {
+   for (i = 0; i < len; i++)
data->block[i + 1] = inb_p(SMBBLKDAT(priv));
-   }
}
return 0;
 }
@@ -310,9 +301,8 @@ static int i801_block_transaction_byte_by_byte(struct 
i2c_device *priv, union i2
dev_dbg(>adapter.dev, "%s\n", __func__);
 
result = i801_check_pre(priv);
-   if (result < 0) {
+   if (result < 0)
return result;
-   }
 
len = data->block[0];
 
@@ -323,23 +313,20 @@ static int i801_block_transaction_byte_by_byte(struct 
i2c_device *priv, union i2
 
for (i = 1; i <= len; i++) {
if (i == len && read_write == I2C_SMBUS_READ) {
-   if (command == I2C_SMBUS_I2C_BLOCK_DATA) {
+   if (command == I2C_SMBUS_I2C_BLOCK_DATA)
smbcmd = I801_I2C_BLOCK_LAST;
-   } else {
+  

[PATCH 1/6] staging: kpc2000: make kconfig symbol 'KPC2000' select dependencies

2019-05-22 Thread Geordan Neukum
The kpc2000 core makes calls against functions which are conditionally
exported upon the kconfig symbols 'MFD_CORE' and 'UIO' being selected
Therefore, in order to guarantee correct compilation, the 'KPC2000'
kconfig symbol (which brings in that code) must explicitly select its
hard dependencies.

Signed-off-by: Geordan Neukum 
---
 drivers/staging/kpc2000/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/kpc2000/Kconfig b/drivers/staging/kpc2000/Kconfig
index fb5922928f47..8992dc67ff37 100644
--- a/drivers/staging/kpc2000/Kconfig
+++ b/drivers/staging/kpc2000/Kconfig
@@ -3,6 +3,8 @@
 config KPC2000
bool "Daktronics KPC Device support"
depends on PCI
+   select MFD_CORE
+   select UIO
help
  Select this if you wish to use the Daktronics KPC PCI devices
 
-- 
2.21.0

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


Re: [PATCH] staging: rtl8723bs: Add missing blank lines

2019-05-22 Thread Dan Carpenter
On Tue, May 21, 2019 at 09:46:55PM -0300, Fabio Lima wrote:
> This patch resolves the following warning from checkpatch.pl
> WARNING: Missing a blank line after declarations
> 
> Signed-off-by: Fabio Lima 
> ---
>  drivers/staging/rtl8723bs/core/rtw_debug.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_debug.c 
> b/drivers/staging/rtl8723bs/core/rtw_debug.c
> index 9f8446ccf..853362381 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_debug.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_debug.c
> @@ -382,6 +382,7 @@ ssize_t proc_set_roam_tgt_addr(struct file *file, const 
> char __user *buffer, siz
>   if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
>  
>   int num = sscanf(tmp, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", addr, 
> addr+1, addr+2, addr+3, addr+4, addr+5);
> +
>   if (num == 6)
>   memcpy(adapter->mlmepriv.roam_tgt_addr, addr, ETH_ALEN);
>  

I'm sorry but this function is really such nonsense.  Can you send a
patch to re-write it instead?

drivers/staging/rtl8723bs/core/rtw_debug.c
   371  ssize_t proc_set_roam_tgt_addr(struct file *file, const char __user 
*buffer, size_t count, loff_t *pos, void *data)
   372  {
   373  struct net_device *dev = data;
   374  struct adapter *adapter = (struct adapter 
*)rtw_netdev_priv(dev);
   375  
   376  char tmp[32];
   377  u8 addr[ETH_ALEN];
   378  
   379  if (count < 1)

This check is silly.  I guess the safest thing is to change it to:
if (count < sizeof(tmp))

   380  return -EFAULT;

It should be return -EINVAL;

   381  
   382  if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {

Remove the check for if the user passes a NULL buffer, because that's
already handled in copy_from_user().  Return -EFAULT if copy_from_user()
fails.

if (copy_from_user(tmp, buffer, sizeof(tmp)))
return -EFAULT;


   383  

Extra blank line.

   384  int num = sscanf(tmp, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", 
addr, addr+1, addr+2, addr+3, addr+4, addr+5);

You will need to move the num declaration to the start of the function.

   385  if (num == 6)
   386  memcpy(adapter->mlmepriv.roam_tgt_addr, addr, 
ETH_ALEN);

If num != 6 then return -EINVAL;

   387  
   388  DBG_871X("set roam_tgt_addr to "MAC_FMT"\n", 
MAC_ARG(adapter->mlmepriv.roam_tgt_addr));
   389  }
   390  
   391  return count;
   392  }

regards,
dan carpenter
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtl8192u: Remove an unnecessary NULL check

2019-05-22 Thread Dan Carpenter
On Tue, May 21, 2019 at 03:57:46PM -0700, Nick Desaulniers wrote:
> > > -   if (param->u.wpa_ie.len > MAX_WPA_IE_LEN ||
> > > -   (param->u.wpa_ie.len && !param->u.wpa_ie.data))
> >
> > Right so, the types in this expression:
> >
> > param: struct ieee_param*
> > param->u: *anonymous union*
> > param->u.wpa_ie: *anonymous struct*
> > param->u.wpa_ie.len: u32
> > param->u.wpa_ie.data: u8 [0]
> > as defined in drivers/staging/rtl8192u/ieee80211/ieee80211.h#L295
> > https://github.com/ClangBuiltLinux/linux/blob/9c7db5004280767566e91a33445bf93aa479ef02/drivers/staging/rtl8192u/ieee80211/ieee80211.h#L295-L322
> >
> > so this is a tricky case, because in general array members can never
> > themselves be NULL,


Unless they array was the first struct member, obviously.


> >  and usually I trust -Wpointer-bool-conversion, but
> > this is a special case because of the flexible array member:

Nah.  It's the same thing.  That patch is fine.

regards,
dan carpenter

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


Re: [PATCH] staging: rtl8723bs: Add missing blank lines

2019-05-22 Thread Jeremy Sowden
On 2019-05-21, at 21:46:55 -0300, Fabio Lima wrote:
> This patch resolves the following warning from checkpatch.pl
> WARNING: Missing a blank line after declarations
>
> Signed-off-by: Fabio Lima 
> ---
>  drivers/staging/rtl8723bs/core/rtw_debug.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_debug.c 
> b/drivers/staging/rtl8723bs/core/rtw_debug.c
> index 9f8446ccf..853362381 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_debug.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_debug.c
> @@ -382,6 +382,7 @@ ssize_t proc_set_roam_tgt_addr(struct file *file, const 
> char __user *buffer, siz
>   if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
>
>   int num = sscanf(tmp, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", addr, 
> addr+1, addr+2, addr+3, addr+4, addr+5);
> +
>   if (num == 6)
>   memcpy(adapter->mlmepriv.roam_tgt_addr, addr, ETH_ALEN);
>
> @@ -1348,6 +1349,7 @@ int proc_get_btcoex_dbg(struct seq_file *m, void *v)
>   struct net_device *dev = m->private;
>   struct adapter *padapter;
>   char buf[512] = {0};
> +
>   padapter = (struct adapter *)rtw_netdev_priv(dev);
>
>   rtw_btcoex_GetDBG(padapter, buf, 512);
> --
> 2.11.0

Looks good to me.

J.


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtl8192u: Remove an unnecessary NULL check

2019-05-22 Thread Dan Carpenter
On Tue, May 21, 2019 at 10:42:21AM -0700, Nathan Chancellor wrote:
> Clang warns:
> 
> drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:2663:47: warning:
> address of array 'param->u.wpa_ie.data' will always evaluate to 'true'
> [-Wpointer-bool-conversion]
> (param->u.wpa_ie.len && !param->u.wpa_ie.data))
> ~^~~~
> 
> This was exposed by commit deabe03523a7 ("Staging: rtl8192u: ieee80211:
> Use !x in place of NULL comparisons") because we disable the warning
> that would have pointed out the comparison against NULL is also false:
> 

Heh.  Weird.  Why would people disable one and not the other?

regards,
dan carpenter

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


Re: staging: mt7621-pci: factor out 'mt7621_pcie_enable_port' function

2019-05-22 Thread Sergio Paracuellos
Hi Greg,

On Wed, May 22, 2019 at 2:20 AM Greg Ungerer  wrote:
>
> Hi Sergio,
>
> Thanks for the quick response.
>
> On 21/5/19 6:14 pm, Sergio Paracuellos wrote:
> > On Tue, May 21, 2019 at 8:44 AM Greg Ungerer  wrote:
> >> I am working on a couple of different MedaiTek MT7621 based platforms
> >> and am having problems with the PCI bus on those.
> >>
> >> Big picture is that the PCI bus on my boards worked in linux-4.20
> >> (with the obvious compilation breakage fixed), and it does not work
> >> in linux-5.0 or linux-5.1.
> >>
> >> On linux-4.20 the PCI bus probe at kernel boot looks like this:
> >>
> >> * Xtal 40MHz *
> >> PCIE1 no card, disable it(RST)
> >> PCIE2 no card, disable it(RST)
> >> PCIE0 enabled
> >> PCI coherence region base: 0x6000, mask/settings: 0xf002
> >> mt7621-pci 1e14.pcie: PCI host bridge to bus :00
> >> pci_bus :00: root bus resource [io  0x]
> >> pci_bus :00: root bus resource [mem 0x6000-0x6fff]
> >> pci_bus :00: root bus resource [bus 00-ff]
> >> pci :00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
> >> pci :00:00.0: PCI bridge to [bus 01-ff]
> >> pci :00:00.0: BAR 0: no space for [mem size 0x8000]
> >> pci :00:00.0: BAR 0: failed to assign [mem size 0x8000]
> >> pci :00:00.0: BAR 8: assigned [mem 0x6000-0x601f]
> >> pci :00:00.0: BAR 9: assigned [mem 0x6020-0x602f pref]
> >> pci :00:00.0: BAR 1: assigned [mem 0x6030-0x6030]
> >> pci :00:00.0: BAR 7: no space for [io  size 0x1000]
> >> pci :00:00.0: BAR 7: failed to assign [io  size 0x1000]
> >> pci :01:00.0: BAR 0: assigned [mem 0x6000-0x601f 64bit]
> >> pci :01:00.0: BAR 6: assigned [mem 0x6020-0x6020 pref]
> >> pci :00:00.0: PCI bridge to [bus 01]
> >> pci :00:00.0:   bridge window [mem 0x6000-0x601f]
> >> pci :00:00.0:   bridge window [mem 0x6020-0x602f pref]
> >>
> >> The PCI bus works, and devices on it are found and work as expected.
> >>
> >> On linux-5.1 the PCI initialization and probe fails, with the kernel
> >> locking up:
> >>
> >> ...
> >> mt7621-pci 1e14.pcie: Port 454043648 N_FTS = 0
> >> mt7621-pci-phy 1e149000.pcie-phy: Xtal is 40MHz
> >> mt7621-pci 1e14.pcie: pcie0 no card, disable it (RST & CLK)
> >> mt7621-pci 1e14.pcie: Initiating port 0 failed
> >> mt7621-pci 1e14.pcie: Port 454043648 N_FTS = 1
> >> mt7621-pci-phy 1e149000.pcie-phy: Xtal is 40MHz
> >> mt7621-pci 1e14.pcie: pcie1 no card, disable it (RST & CLK)
> >> mt7621-pci 1e14.pcie: Initiating port 1 failed
> >> mt7621-pci 1e14.pcie: Port 454043648 N_FTS = 2
> >> mt7621-pci-phy 1e14a000.pcie-phy: Xtal is 40MHz
> >> mt7621-pci 1e14.pcie: pcie2 no card, disable it (RST & CLK)
> >>
> >> The lockup is in mt7621_pci_phy_power_off(), at the phy_read() call.
> >> If I modify that code and return immediately in that 
> >> mt7621_pci_phy_power_off()
> >> the systemboots - but obviously from the above you can see that the PCI bus
> >> and no devices were detected.
> >
> > There are two changes with this two commits:
> >
> > commit 36d657b011ef49b549aae44d0fe49ce845beb975
> > Author: Sergio Paracuellos 
> > Date:   Wed Apr 17 13:58:38 2019 +0200
> >
> >  staging: mt7621-pci-phy: convert driver to use kernel regmap API's
> >
> >  Instead of using writel and readl use regmap API which makes
> >  the driver maintainability easier.
> >
> >  Signed-off-by: Sergio Paracuellos 
> >  Signed-off-by: Greg Kroah-Hartman 
> >
> > commit 9445ccb3714c78c26a3a25fafed4d9d965080431
> > Author: Sergio Paracuellos 
> > Date:   Wed Apr 17 13:58:37 2019 +0200
> >
> >  staging: mt7621-pci-phy: add quirks for 'E2' revision using
> > 'soc_device_attribute'
> >
> >  Depending on revision of the chip, 'mt7621_bypass_pipe_rst' function
> >  must be executed. Add better support for this using 'soc_device_match'
> >  in driver probe function.
> >
> >  Signed-off-by: Sergio Paracuellos 
> >  Signed-off-by: Greg Kroah-Hartman 
> >
> > So, I added a quirk for E2 revision of the board as I was suggested to
> > do by the phy
> > tree maintainer, and this is the only place I can think the problem could 
> > be.
>
> I took the pci-mt7621.c and pci-mt7621-phy.c from a linux-5.2-rc1,
> which has both those commits. Same behavior, PCI probing locks up
> kernel in mt7621_pci_phy_power_off().
>

I see, thanks for testing these two also.

>
> > I think all te changes before this was properly tested by Neil and
> > results in a working
> > PCI.
>
> Not sure what board Neil is using.
> I am using a Digi/EX15 and I also tried a Digi/TX54 (very different
> boards, very different designs).

Neil's board Is a gnubee board.

>
>
> >> Copying in the working linux-4.20 pci-mt7621.c into place on
> >> linux-5.1 results in a working PCI bus also. I have 2 very different
> >> MT7621 based boards, and they both exhibit this same problem.
> >>
> >> I