[PATCH ] staging: vt6656: refactor power save operation

2020-05-02 Thread Malcolm Priestley
At present the power save wake uses the listening interval and
the slow path to wake up.

The following using a beacon interval of 100 and
listen interval of 5.

The TBTT set at 100 wake-up sequence;
100 TTBT wake-up set to listen interval.
200 TTBT
300 TTBT
400 TTBT --> call vnt_next_tbtt_wakeup on slow path
Beacon heard and passed through at the approx 500 interval.
500 TTBT
600 TTBT wakeup set to listen interval

The TTBT set at 500 wake-up sequence and always listen flagged on;
100 No TTBT
200 No TTBT
300 No TTBT
400 No TTBT
500 TTBT - beacon heard and passed through
600 No TTBT

A further enhancement because the TTBT is more precise
the dtim_period can be used instead.

When Power save is off the TTBT continues to run at the listen
interval but all the other beacons are passed.

The code in vnt_int_process_data is no longer required. 

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6656/device.h   |  2 --
 drivers/staging/vt6656/main_usb.c | 11 +--
 drivers/staging/vt6656/power.c| 12 ++--
 drivers/staging/vt6656/usbpipe.c  | 13 -
 4 files changed, 11 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index 4d596853a3ee..d19d802b5d4f 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -383,8 +383,6 @@ struct vnt_private {
u8 bb_pre_ed_rssi;
u8 bb_pre_ed_index;
 
-   u16 wake_up_count;
-
/* command timer */
struct delayed_work run_command_work;
 
diff --git a/drivers/staging/vt6656/main_usb.c 
b/drivers/staging/vt6656/main_usb.c
index 7db1e044ad26..b5790d4d7152 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -824,10 +824,17 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw,
if (changed & (BSS_CHANGED_ASSOC | BSS_CHANGED_BEACON_INFO) &&
priv->op_mode != NL80211_IFTYPE_AP) {
if (conf->assoc && conf->beacon_rate) {
+   u16 ps_beacon_int = conf->beacon_int;
+
+   if (conf->dtim_period)
+   ps_beacon_int *= conf->dtim_period;
+   else if (hw->conf.listen_interval)
+   ps_beacon_int *= hw->conf.listen_interval;
+
vnt_mac_reg_bits_on(priv, MAC_REG_TFTCTL,
TFTCTL_TSFCNTREN);
 
-   vnt_mac_set_beacon_interval(priv, conf->beacon_int);
+   vnt_mac_set_beacon_interval(priv, ps_beacon_int);
 
vnt_reset_next_tbtt(priv, conf->beacon_int);
 
@@ -835,7 +842,7 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw,
   conf->sync_tsf, priv->current_tsf);
 
vnt_update_next_tbtt(priv,
-conf->sync_tsf, conf->beacon_int);
+conf->sync_tsf, ps_beacon_int);
} else {
vnt_clear_current_tsf(priv);
 
diff --git a/drivers/staging/vt6656/power.c b/drivers/staging/vt6656/power.c
index d160a0773943..2f49c870272a 100644
--- a/drivers/staging/vt6656/power.c
+++ b/drivers/staging/vt6656/power.c
@@ -63,16 +63,8 @@ void vnt_enable_power_saving(struct vnt_private *priv, u16 
listen_interval)
 */
vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_GO2DOZE);
 
-   if (listen_interval >= 2) {
-   /* clear always listen beacon */
-   vnt_mac_reg_bits_off(priv, MAC_REG_PSCTL, PSCTL_ALBCN);
-
-   /* first time set listen next beacon */
-   vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_LNBCN);
-   } else {
-   /* always listen beacon */
-   vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_ALBCN);
-   }
+   /* always listen beacon */
+   vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_ALBCN);
 
dev_dbg(&priv->usb->dev,  "PS:Power Saving Mode Enable...\n");
 }
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index e8efdeadb1a7..5603f3cbb33c 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -202,19 +202,6 @@ static void vnt_int_process_data(struct vnt_private *priv)
if (int_data->isr0 & ISR_BNTX && priv->op_mode == NL80211_IFTYPE_AP)
vnt_schedule_command(priv, WLAN_CMD_BECON_SEND);
 
-   if (int_data->isr0 & ISR_TBTT &&
-   priv->hw->conf.flags & IEEE80211_CONF_PS) {
-   if (!priv->wake_up_count)
-   priv->wake_up_count = priv->hw->conf.listen_interval;
-
-   if (priv->wake_up_count)
-   --priv->wake_up_count;
-
-   /* Turn on wake up to listen next beacon */
-   if (priv->wake_up_count == 1)
-   vnt_schedule_command(priv, WLAN_CMD_TBTT_WAK

[PATCH v2] staging: vt6656: refactor power save operation

2020-05-02 Thread Malcolm Priestley
At present the power save wake uses the listening interval and
the slow path to wake up.

The following using a beacon interval of 100 and
listen interval of 5.

The TBTT set at 100 wake-up sequence;
100 TBTT wake-up set to listen interval.
200 TBTT
300 TBTT
400 TBTT --> call vnt_next_tbtt_wakeup on slow path
Beacon heard and passed through at the approx 500 interval.
500 TBTT
600 TBTT wake-up set to listen interval

The TBTT set at 500 wake-up sequence and always listen flagged on;
100 No TBTT
200 No TBTT
300 No TBTT
400 No TBTT
500 TBTT - beacon heard and passed through
600 No TBTT

A further enhancement because the TBTT is more precise
the dtim_period can be used instead.

When Power save is off the TBTT continues to run at the listen
interval but all the other beacons are passed.

The code in vnt_int_process_data is no longer required. 

Signed-off-by: Malcolm Priestley 
---
v2 Corrected TTBT to TBTT
 
 drivers/staging/vt6656/device.h   |  2 --
 drivers/staging/vt6656/main_usb.c | 11 +--
 drivers/staging/vt6656/power.c| 12 ++--
 drivers/staging/vt6656/usbpipe.c  | 13 -
 4 files changed, 11 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index 4d596853a3ee..d19d802b5d4f 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -383,8 +383,6 @@ struct vnt_private {
u8 bb_pre_ed_rssi;
u8 bb_pre_ed_index;
 
-   u16 wake_up_count;
-
/* command timer */
struct delayed_work run_command_work;
 
diff --git a/drivers/staging/vt6656/main_usb.c 
b/drivers/staging/vt6656/main_usb.c
index 7db1e044ad26..b5790d4d7152 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -824,10 +824,17 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw,
if (changed & (BSS_CHANGED_ASSOC | BSS_CHANGED_BEACON_INFO) &&
priv->op_mode != NL80211_IFTYPE_AP) {
if (conf->assoc && conf->beacon_rate) {
+   u16 ps_beacon_int = conf->beacon_int;
+
+   if (conf->dtim_period)
+   ps_beacon_int *= conf->dtim_period;
+   else if (hw->conf.listen_interval)
+   ps_beacon_int *= hw->conf.listen_interval;
+
vnt_mac_reg_bits_on(priv, MAC_REG_TFTCTL,
TFTCTL_TSFCNTREN);
 
-   vnt_mac_set_beacon_interval(priv, conf->beacon_int);
+   vnt_mac_set_beacon_interval(priv, ps_beacon_int);
 
vnt_reset_next_tbtt(priv, conf->beacon_int);
 
@@ -835,7 +842,7 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw,
   conf->sync_tsf, priv->current_tsf);
 
vnt_update_next_tbtt(priv,
-conf->sync_tsf, conf->beacon_int);
+conf->sync_tsf, ps_beacon_int);
} else {
vnt_clear_current_tsf(priv);
 
diff --git a/drivers/staging/vt6656/power.c b/drivers/staging/vt6656/power.c
index d160a0773943..2f49c870272a 100644
--- a/drivers/staging/vt6656/power.c
+++ b/drivers/staging/vt6656/power.c
@@ -63,16 +63,8 @@ void vnt_enable_power_saving(struct vnt_private *priv, u16 
listen_interval)
 */
vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_GO2DOZE);
 
-   if (listen_interval >= 2) {
-   /* clear always listen beacon */
-   vnt_mac_reg_bits_off(priv, MAC_REG_PSCTL, PSCTL_ALBCN);
-
-   /* first time set listen next beacon */
-   vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_LNBCN);
-   } else {
-   /* always listen beacon */
-   vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_ALBCN);
-   }
+   /* always listen beacon */
+   vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_ALBCN);
 
dev_dbg(&priv->usb->dev,  "PS:Power Saving Mode Enable...\n");
 }
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index e8efdeadb1a7..5603f3cbb33c 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -202,19 +202,6 @@ static void vnt_int_process_data(struct vnt_private *priv)
if (int_data->isr0 & ISR_BNTX && priv->op_mode == NL80211_IFTYPE_AP)
vnt_schedule_command(priv, WLAN_CMD_BECON_SEND);
 
-   if (int_data->isr0 & ISR_TBTT &&
-   priv->hw->conf.flags & IEEE80211_CONF_PS) {
-   if (!priv->wake_up_count)
-   priv->wake_up_count = priv->hw->conf.listen_interval;
-
-   if (priv->wake_up_count)
-   --priv->wake_up_count;
-
-   /* Turn on wake up to listen next beacon */
-   if (priv->wake_up_count == 1)
-   vnt_schedule_co

Re: [PATCH ] staging: vt6656: refactor power save operation

2020-05-02 Thread Malcolm Priestley
Drop this patch v2 sent corrected TTBT.

Regards


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


[PATCH] staging: ks7010: remove me from CC list

2020-05-02 Thread Wolfram Sang
I lost interest in this driver years ago because I could't keep up with
testing the incoming janitorial patches. So, drop me from CC.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/TODO | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/ks7010/TODO b/drivers/staging/ks7010/TODO
index 87a6dac4890d..ab6f39175d99 100644
--- a/drivers/staging/ks7010/TODO
+++ b/drivers/staging/ks7010/TODO
@@ -30,5 +30,4 @@ Now the TODOs:
 
 Please send any patches to:
 Greg Kroah-Hartman 
-Wolfram Sang 
 Linux Driver Project Developer List 
-- 
2.20.1

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


Re: Thanks For Your Kindness

2020-05-02 Thread Reem al-Hashimi
My name is Reem E. Al-Hashimi, the Emirates Minister of State and Managing 
Director of United Arab Emirates (Dubai) World Expo 2020 Committee. I am 
writing you to stand as my partner to receive my share of gratification from 
foreign companies whom I helped during the bidding exercise towards the Dubai 
World Expo 2020 Committee and also i want to use this funds assist Corona virus 
Symptoms and Causes.

Am a single Arab women and serving as a minister, there is a limit to my 
personal income and investment level and  For this reason, I cannot receive 
such a huge sum back to my country or my personal account, so an agreement was 
reached with the foreign companies to direct the gratifications to an open 
beneficiary account with a financial institution where it will be possible for 
me to instruct further transfer of the fund to a third party account for 
investment purpose which is the reason i contacted you to receive the fund as 
my partner for investment in your country.

The amount is valued at Euro 47,745,533.00 with a financial institution waiting 
my instruction for further transfer to a destination account as soon as I have 
your information indicating interest to receive and invest the fund, I will 
compensate you with 30% of the total amount and you will also get benefit from 
the investment.

If you can handle the fund in a good investment. reply on this email only: 
reemalhash...@daum.net
Regards,
Ms. Reem
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Product inquiry

2020-05-02 Thread Mr. Okrapah Adjei

Dear Sir,

We got your company information through an exhaustive search.

Our scope is basically to search for foreign companies to bid for 
contract supply on commission basis.


We are interested in buying your products in a larger quantity if only 
you can supply and open for business.


Best Regard,
Mr. Okrapah Adjei
CEO
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Product inquiry

2020-05-02 Thread Mr. Okrapah Adjei

Dear Sir,

We got your company information through an exhaustive search.

Our scope is basically to search for foreign companies to bid for 
contract supply on commission basis.


We are interested in buying your products in a larger quantity if only 
you can supply and open for business.


Best Regard,
Mr. Okrapah Adjei
CEO
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging:rtl8723bs: eliminate usage of skb_clone after skb allocation fail

2020-05-02 Thread Ivan Safonov
The skb allocated when out of memory
is likely to be discarded during subsequent processing.

Signed-off-by: Ivan Safonov 
---
 .../staging/rtl8723bs/hal/rtl8723bs_recv.c| 44 ++-
 drivers/staging/rtl8723bs/os_dep/recv_linux.c | 19 +++-
 2 files changed, 19 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c 
b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
index c3051ebaeb78..29c29e2e125b 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
@@ -311,39 +311,21 @@ static void rtl8723bs_recv_tasklet(unsigned long priv)
}
 
pkt_copy = rtw_skb_alloc(alloc_sz);
-
-   if (pkt_copy) {
-   pkt_copy->dev = padapter->pnetdev;
-   precvframe->u.hdr.pkt = pkt_copy;
-   skb_reserve(pkt_copy, 8 - 
((SIZE_PTR)(pkt_copy->data) & 7));/* force pkt_copy->data at 8-byte alignment 
address */
-   skb_reserve(pkt_copy, shift_sz);/* 
force ip_hdr at 8-byte alignment address according to shift_sz. */
-   memcpy(pkt_copy->data, (ptr + 
rx_report_sz + pattrib->shift_sz), skb_len);
-   precvframe->u.hdr.rx_head = 
pkt_copy->head;
-   precvframe->u.hdr.rx_data = 
precvframe->u.hdr.rx_tail = pkt_copy->data;
-   precvframe->u.hdr.rx_end = 
skb_end_pointer(pkt_copy);
-   } else {
-   if ((pattrib->mfrag == 1) && 
(pattrib->frag_num == 0)) {
-   DBG_8192C("%s: alloc_skb fail, 
drop frag frame\n", __func__);
-   rtw_free_recvframe(precvframe, 
&precvpriv->free_recv_queue);
-   break;
-   }
-
-   precvframe->u.hdr.pkt = 
rtw_skb_clone(precvbuf->pskb);
-   if (precvframe->u.hdr.pkt) {
-   _pkt *pkt_clone = 
precvframe->u.hdr.pkt;
-
-   pkt_clone->data = ptr + 
rx_report_sz + pattrib->shift_sz;
-   
skb_reset_tail_pointer(pkt_clone);
-   precvframe->u.hdr.rx_head = 
precvframe->u.hdr.rx_data = precvframe->u.hdr.rx_tail
-   = pkt_clone->data;
-   precvframe->u.hdr.rx_end = 
pkt_clone->data + skb_len;
-   } else {
-   DBG_8192C("%s: rtw_skb_clone 
fail\n", __func__);
-   rtw_free_recvframe(precvframe, 
&precvpriv->free_recv_queue);
-   break;
-   }
+   if (!pkt_copy) {
+   DBG_8192C("%s: alloc_skb fail, drop 
frame\n", __func__);
+   rtw_free_recvframe(precvframe, 
&precvpriv->free_recv_queue);
+   break;
}
 
+   pkt_copy->dev = padapter->pnetdev;
+   precvframe->u.hdr.pkt = pkt_copy;
+   skb_reserve(pkt_copy, 8 - 
((SIZE_PTR)(pkt_copy->data) & 7));/* force pkt_copy->data at 8-byte alignment 
address */
+   skb_reserve(pkt_copy, shift_sz);/* force ip_hdr 
at 8-byte alignment address according to shift_sz. */
+   memcpy(pkt_copy->data, (ptr + rx_report_sz + 
pattrib->shift_sz), skb_len);
+   precvframe->u.hdr.rx_head = pkt_copy->head;
+   precvframe->u.hdr.rx_data = 
precvframe->u.hdr.rx_tail = pkt_copy->data;
+   precvframe->u.hdr.rx_end = 
skb_end_pointer(pkt_copy);
+
recvframe_put(precvframe, skb_len);
/* recvframe_pull(precvframe, drvinfo_sz + 
RXDESC_SIZE); */
 
diff --git a/drivers/staging/rtl8723bs/os_dep/recv_linux.c 
b/drivers/staging/rtl8723bs/os_dep/recv_linux.c
index 60c35d92ba29..560221723d70 100644
--- a/drivers/staging/rtl8723bs/os_dep/recv_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/recv_linux.c
@@ -60,21 +60,14 @@ _pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, u16 
nSubframe_Length, u8
pattrib = &prframe->u.hdr.attrib;
 
sub_skb = rtw_skb_alloc(nSubframe_Length + 12);
-   if (sub_skb) {
-

[PATCH] media: atomisp: fix querycap initialization logic

2020-05-02 Thread Mauro Carvalho Chehab
Some recent changes at V4L2 core changed the way querycap is handled.

Due to that, this warning is generated:

WARNING: CPU: 1 PID: 503 at drivers/media/v4l2-core/v4l2-dev.c:885 
__video_register_device+0x93e/0x1120 [videodev]

as introduced by this commit:

commit 3c1350501c21db8e3b1a38d9e97db29694305c3b
Author: Hans Verkuil 
Date:   Tue Jul 23 04:21:25 2019 -0400

media: v4l2-dev/ioctl: require non-zero device_caps, verify sane 
querycap results

Now that all V4L2 drivers set device_caps in struct video_device, 
we can add
a check for this to ensure all future drivers fill this in.

The fix is simple: we just need to initialize dev_caps before
registering the V4L2 dev.

While here, solve other problems at VIDIOC_QUERYCAP ioctl.

Reported-by: Patrik Gfeller 
Signed-off-by: Mauro Carvalho Chehab 
---
 .../staging/media/atomisp/pci/atomisp_ioctl.c | 21 ++-
 .../staging/media/atomisp/pci/atomisp_v4l2.c  |  4 
 2 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c 
b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
index 3417cd547ae7..a5e71e5b714e 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
@@ -41,10 +41,8 @@
 
 #include "hrt/hive_isp_css_mm_hrt.h"
 
-/* for v4l2_capability */
 static const char *DRIVER = "atomisp"; /* max size 15 */
 static const char *CARD = "ATOM ISP";  /* max size 31 */
-static const char *BUS_INFO = "PCI-3"; /* max size 31 */
 
 /*
  * FIXME: ISP should not know beforehand all CIDs supported by sensor.
@@ -543,25 +541,18 @@ const struct atomisp_format_bridge 
*atomisp_get_format_bridge_from_mbus(
 /*
  * v4l2 ioctls
  * return ISP capabilities
- *
- * FIXME: capabilities should be different for video0/video2/video3
  */
 static int atomisp_querycap(struct file *file, void *fh,
struct v4l2_capability *cap)
 {
-   memset(cap, 0, sizeof(struct v4l2_capability));
+   struct video_device *vdev = video_devdata(file);
+   struct atomisp_device *isp = video_get_drvdata(vdev);
 
-   WARN_ON(sizeof(DRIVER) > sizeof(cap->driver) ||
-   sizeof(CARD) > sizeof(cap->card) ||
-   sizeof(BUS_INFO) > sizeof(cap->bus_info));
+   strscpy(cap->driver, DRIVER, sizeof(cap->driver) - 1);
+   strscpy(cap->card, CARD, sizeof(cap->card) - 1);
+   snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s",
+pci_name(isp->pdev));
 
-   strncpy(cap->driver, DRIVER, sizeof(cap->driver) - 1);
-   strncpy(cap->card, CARD, sizeof(cap->card) - 1);
-   strncpy(cap->bus_info, BUS_INFO, sizeof(cap->card) - 1);
-
-   cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
-  V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_OUTPUT;
-   cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
return 0;
 }
 
diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c 
b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
index f1bae9712720..ce16e7824d33 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
@@ -548,6 +548,10 @@ int atomisp_video_register(struct atomisp_video_pipe 
*video,
 
video->vdev.v4l2_dev = vdev;
 
+   video->vdev.device_caps = V4L2_CAP_VIDEO_CAPTURE |
+ V4L2_CAP_STREAMING |
+ V4L2_CAP_VIDEO_OUTPUT;
+
ret = video_register_device(&video->vdev, VFL_TYPE_VIDEO, -1);
if (ret < 0)
dev_err(vdev->dev, "%s: could not register video device (%d)\n",
-- 
2.25.4

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


Re: [PATCH] staging: iio: ad5933: rework probe to use devm_ function variants

2020-05-02 Thread Jonathan Cameron
On Tue, 28 Apr 2020 12:31:28 +0300
Alexandru Ardelean  wrote:

> This change cleans up the driver's probe function to use only devm_
> function variants. This also gets rid of the remove function and moves the
> clock & regulator de-initializations to the 'ad5933_cleanup()' callback.
> 
> Signed-off-by: Alexandru Ardelean 

Basic rule of thumb. Whatever you register with devm_add_action_or_reset
should only cleanup one one thing done in the probe path.
There is almost always a race if you do more than one bit of cleanup
per such callback + it's harder to review as it fails the 'obviously correct
test'.

Jonathan

> ---
>  .../staging/iio/impedance-analyzer/ad5933.c   | 59 ---
>  1 file changed, 23 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c 
> b/drivers/staging/iio/impedance-analyzer/ad5933.c
> index af0bcf95ee8a..06a6dcd7883b 100644
> --- a/drivers/staging/iio/impedance-analyzer/ad5933.c
> +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
> @@ -602,11 +602,12 @@ static const struct iio_buffer_setup_ops 
> ad5933_ring_setup_ops = {
>   .postdisable = ad5933_ring_postdisable,
>  };
>  
> -static int ad5933_register_ring_funcs_and_init(struct iio_dev *indio_dev)
> +static int ad5933_register_ring_funcs_and_init(struct device *dev,
> +struct iio_dev *indio_dev)
>  {
>   struct iio_buffer *buffer;
>  
> - buffer = iio_kfifo_allocate();
> + buffer = devm_iio_kfifo_allocate(dev);
>   if (!buffer)
>   return -ENOMEM;
>  
> @@ -676,6 +677,14 @@ static void ad5933_work(struct work_struct *work)
>   }
>  }
>  
> +static void ad5933_cleanup(void *data)
> +{
> + struct ad5933_state *st = data;
> +
> + clk_disable_unprepare(st->mclk);
> + regulator_disable(st->reg);

Please do two separate callbacks so that these can be handled
in the correct places.  I.e. you do something then immediately
register the handler to undo it.

Currently you can end up disabling a clock you haven't enabled
(which I am fairly sure will give you an error message).

> +}
> +
>  static int ad5933_probe(struct i2c_client *client,
>   const struct i2c_device_id *id)
>  {
> @@ -703,23 +712,28 @@ static int ad5933_probe(struct i2c_client *client,
>   dev_err(&client->dev, "Failed to enable specified VDD 
> supply\n");
>   return ret;
>   }
> +
> + ret = devm_add_action_or_reset(&client->dev, ad5933_cleanup, st);
> + if (ret)
> + return ret;
> +
>   ret = regulator_get_voltage(st->reg);
>  
>   if (ret < 0)
> - goto error_disable_reg;
> + return ret;
>  
>   st->vref_mv = ret / 1000;
>  
>   st->mclk = devm_clk_get(&client->dev, "mclk");
>   if (IS_ERR(st->mclk) && PTR_ERR(st->mclk) != -ENOENT) {
>   ret = PTR_ERR(st->mclk);
> - goto error_disable_reg;
> + return ret;
>   }
>  
>   if (!IS_ERR(st->mclk)) {
>   ret = clk_prepare_enable(st->mclk);
>   if (ret < 0)
> - goto error_disable_reg;
> + return ret;
>   ext_clk_hz = clk_get_rate(st->mclk);
>   }
>  
> @@ -742,41 +756,15 @@ static int ad5933_probe(struct i2c_client *client,
>   indio_dev->channels = ad5933_channels;
>   indio_dev->num_channels = ARRAY_SIZE(ad5933_channels);
>  
> - ret = ad5933_register_ring_funcs_and_init(indio_dev);
> + ret = ad5933_register_ring_funcs_and_init(&client->dev, indio_dev);
>   if (ret)
> - goto error_disable_mclk;
> + return ret;
>  
>   ret = ad5933_setup(st);
>   if (ret)
> - goto error_unreg_ring;
> -
> - ret = iio_device_register(indio_dev);
> - if (ret)
> - goto error_unreg_ring;
> -
> - return 0;
> -
> -error_unreg_ring:
> - iio_kfifo_free(indio_dev->buffer);
> -error_disable_mclk:
> - clk_disable_unprepare(st->mclk);
> -error_disable_reg:
> - regulator_disable(st->reg);
> -
> - return ret;
> -}
> -
> -static int ad5933_remove(struct i2c_client *client)
> -{
> - struct iio_dev *indio_dev = i2c_get_clientdata(client);
> - struct ad5933_state *st = iio_priv(indio_dev);
> -
> - iio_device_unregister(indio_dev);
> - iio_kfifo_free(indio_dev->buffer);
> - regulator_disable(st->reg);
> - clk_disable_unprepare(st->mclk);
> + return ret;
>  
> - return 0;
> + return devm_iio_device_register(&client->dev, indio_dev);
>  }
>  
>  static const struct i2c_device_id ad5933_id[] = {
> @@ -801,7 +789,6 @@ static struct i2c_driver ad5933_driver = {
>   .of_match_table = ad5933_of_match,
>   },
>   .probe = ad5933_probe,
> - .remove = ad5933_remove,
>   .id_table = ad5933_id,
>  };
>  module_i2c_driver(ad5933_driver);

___
devel mailing list
de...@linuxdriverproje

Re: Thanks For Your Reply

2020-05-02 Thread Reem al-Hashimi
My name is Reem E. Al-Hashimi, the Emirates Minister of State and Managing 
Director of United Arab Emirates (Dubai) World Expo 2020 Committee. I am 
writing you to stand as my partner to receive my share of gratification from 
foreign companies whom I helped during the bidding exercise towards the Dubai 
World Expo 2020 Committee and also i want to use this funds assist Corona virus 
Symptoms and Causes.

Am a single Arab women and serving as a minister, there is a limit to my 
personal income and investment level and  For this reason, I cannot receive 
such a huge sum back to my country or my personal account, so an agreement was 
reached with the foreign companies to direct the gratifications to an open 
beneficiary account with a financial institution where it will be possible for 
me to instruct further transfer of the fund to a third party account for 
investment purpose which is the reason i contacted you to receive the fund as 
my partner for investment in your country.

The amount is valued at Euro 47,745,533.00 with a financial institution waiting 
my instruction for further transfer to a destination account as soon as I have 
your information indicating interest to receive and invest the fund, I will 
compensate you with 30% of the total amount and you will also get benefit from 
the investment.

If you can handle the fund in a good investment. reply on this email only: 
reemalhash...@daum.net
Regards,
Ms. Reem
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


CURSOS BONIFICABLES DESDE CASA (Empleados activos y en ERTE)

2020-05-02 Thread foesco14
Buenos días



Se encuentra abierto el plazo de inscripción de Cursos Bonificables para 
empleados en activo y en situación de ERTE.


Todos los cursos son totalmente Bonificables con cargo al Crédito de Formación 
2020 que dispone las empresa.

Se realizan desde casa en modalidad individual E-learning a través de la 
plataforma web y con total flexibilidad horaria.


Deseáis que os mandemos la información?


Saludos cordiales.


Alex Pons
Director departamento formación.

FOESCO Formación Estatal Continua.
Entidad Organizadora: B171823AP
www.foesco.com

e-mail: cur...@foesco.net
Tel: 910 323 794


(Horario de 9h a 15h y de 17h a 20h de Lunes a Viernes)


FOESCO ofrece formación a empresas y trabajadores en activo a través de cursos 
bonificados por la Fundación Estatal para la Formación en el Empleo (antiguo 
FORCEM) que gestiona las acciones formativas de FORMACIÓN CONTINUA para 
trabajadores y se rige por la ley 30/2015 de 9 de Septiembre.

Si no desea recibir mas información de FOESCO responda a este correo con la 
palabra BAJA en el asunto.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] staging: vt6655: fix LONG_LINE warning

2020-05-02 Thread Matej Dujava
This patch will fix LONG_LINE error from checkpatch, by createing temporary
variable so call to the function is not in if/else block.

Signed-off-by: Matej Dujava 
---
 drivers/staging/vt6655/rxtx.c | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index dda578436e64..782177dfd67e 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -164,16 +164,24 @@ s_uGetTxRsvTime(
 )
 {
unsigned int uDataTime, uAckTime;
+   unsigned short basic_rate;
 
uDataTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 
cbFrameLength, wRate);
 
if (!bNeedAck)
return uDataTime;
 
-   if (byPktType == PK_TYPE_11B) /* llb,CCK mode */
-   uAckTime = bb_get_frame_time(pDevice->byPreambleType, 
byPktType, 14, (unsigned short)pDevice->byTopCCKBasicRate);
-   else /* 11g 2.4G OFDM mode & 11a 5G OFDM mode */
-   uAckTime = bb_get_frame_time(pDevice->byPreambleType, 
byPktType, 14, (unsigned short)pDevice->byTopOFDMBasicRate);
+   /*
+* CCK mode  - 11b
+* OFDM mode - 11g 2.4G & 11a 5G
+*/
+   if (byPktType == PK_TYPE_11B)
+   basic_rate = (unsigned short)pDevice->byTopCCKBasicRate;
+   else
+   basic_rate = (unsigned short)pDevice->byTopOFDMBasicRate;
+
+   uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14,
+basic_rate);
 
return uDataTime + pDevice->uSIFS + uAckTime;
 }
-- 
2.26.2

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


[PATCH 1/2] staging: vt6655: return early if not bNeedAck

2020-05-02 Thread Matej Dujava
This patch will check for bNeedAck before making bb_get_frame_time call, so
in case we dont need uAckTime, we can return early.

Signed-off-by: Matej Dujava 
---
 drivers/staging/vt6655/rxtx.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 2f9c2ead3cb8..dda578436e64 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -166,15 +166,16 @@ s_uGetTxRsvTime(
unsigned int uDataTime, uAckTime;
 
uDataTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 
cbFrameLength, wRate);
+
+   if (!bNeedAck)
+   return uDataTime;
+
if (byPktType == PK_TYPE_11B) /* llb,CCK mode */
uAckTime = bb_get_frame_time(pDevice->byPreambleType, 
byPktType, 14, (unsigned short)pDevice->byTopCCKBasicRate);
else /* 11g 2.4G OFDM mode & 11a 5G OFDM mode */
uAckTime = bb_get_frame_time(pDevice->byPreambleType, 
byPktType, 14, (unsigned short)pDevice->byTopOFDMBasicRate);
 
-   if (bNeedAck)
-   return uDataTime + pDevice->uSIFS + uAckTime;
-   else
-   return uDataTime;
+   return uDataTime + pDevice->uSIFS + uAckTime;
 }
 
 static __le16 vnt_rxtx_rsvtime_le16(struct vnt_private *priv, u8 pkt_type,
-- 
2.26.2

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


Kreditangebot

2020-05-02 Thread ELITE LOANS
Brauchen Sie einen Kredit? Wir sind ein zertifiziertes und akkreditiertes 
privates Darlehensunternehmen. Elite-Darlehen bietet Geschäftsdarlehen, 
Wohnungsbaudarlehen, Schuldenkonsolidierung. 
Kontakt für weitere Informationen.

-- 
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


[PATCH] Staging: comedi: drivers: ni_pcimio: Fix variable name

2020-05-02 Thread Eric Yu
Fixed a variable name that was Camel case

Signed-off-by: Eric Yu 
---
 drivers/staging/comedi/drivers/ni_pcimio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c 
b/drivers/staging/comedi/drivers/ni_pcimio.c
index 7c82d5f9778f..c1d70eec24ab 100644
--- a/drivers/staging/comedi/drivers/ni_pcimio.c
+++ b/drivers/staging/comedi/drivers/ni_pcimio.c
@@ -1214,7 +1214,7 @@ static void m_series_init_eeprom_buffer(struct 
comedi_device *dev)
struct ni_private *devpriv = dev->private;
struct mite *mite = devpriv->mite;
resource_size_t daq_phys_addr;
-   static const int Start_Cal_EEPROM = 0x400;
+   static const int start_cal_eeprom = 0x400;
static const unsigned int window_size = 10;
unsigned int old_iodwbsr_bits;
unsigned int old_iodwbsr1_bits;
@@ -1234,7 +1234,7 @@ static void m_series_init_eeprom_buffer(struct 
comedi_device *dev)
writel(0xf, mite->mmio + 0x30);
 
for (i = 0; i < M_SERIES_EEPROM_SIZE; ++i)
-   devpriv->eeprom_buffer[i] = ni_readb(dev, Start_Cal_EEPROM + i);
+   devpriv->eeprom_buffer[i] = ni_readb(dev, start_cal_eeprom + i);
 
writel(old_iodwbsr1_bits, mite->mmio + MITE_IODWBSR_1);
writel(old_iodwbsr_bits, mite->mmio + MITE_IODWBSR);
-- 
2.26.2

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


Re: [PATCH 2/2] staging: vt6655: fix LONG_LINE warning

2020-05-02 Thread Joe Perches
On Sun, 2020-05-03 at 00:16 +0200, Matej Dujava wrote:
> This patch will fix LONG_LINE error from checkpatch, by createing temporary
> variable so call to the function is not in if/else block.
[]
> diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
[]
> @@ -164,16 +164,24 @@ s_uGetTxRsvTime(
>  )
>  {
>   unsigned int uDataTime, uAckTime;
> + unsigned short basic_rate;
>  
>   uDataTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 
> cbFrameLength, wRate);
>  
>   if (!bNeedAck)
>   return uDataTime;
>  
> - if (byPktType == PK_TYPE_11B) /* llb,CCK mode */
> - uAckTime = bb_get_frame_time(pDevice->byPreambleType, 
> byPktType, 14, (unsigned short)pDevice->byTopCCKBasicRate);
> - else /* 11g 2.4G OFDM mode & 11a 5G OFDM mode */
> - uAckTime = bb_get_frame_time(pDevice->byPreambleType, 
> byPktType, 14, (unsigned short)pDevice->byTopOFDMBasicRate);
> + /*
> +  * CCK mode  - 11b
> +  * OFDM mode - 11g 2.4G & 11a 5G
> +  */
> + if (byPktType == PK_TYPE_11B)
> + basic_rate = (unsigned short)pDevice->byTopCCKBasicRate;
> + else
> + basic_rate = (unsigned short)pDevice->byTopOFDMBasicRate;
> +
> + uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14,
> +  basic_rate);
>  
>   return uDataTime + pDevice->uSIFS + uAckTime;
>  }

perhaps simpler using a ?:

uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14,
 byPktType == PK_TYPE_11B
 ? pDevice->byTopCCKBasicRate
 : pDevice->byTopOFDMBasicRate);

the casts aren't necessary either as both by... fields are u8


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