Re: [PATCH 0/4] irda: move it to drivers/staging so we can delete it

2017-08-28 Thread Greg KH
On Mon, Aug 28, 2017 at 04:46:07PM -0700, Joe Perches wrote:
> On Mon, 2017-08-28 at 16:42 -0700, David Miller wrote:
> > From: Greg Kroah-Hartman 
> > Date: Sun, 27 Aug 2017 17:03:30 +0200
> > 
> > > The IRDA code has long been obsolete and broken.  So, to keep people
> > > from trying to use it, and to prevent people from having to maintain it,
> > > let's move it to drivers/staging/ so that we can delete it entirely from
> > > the kernel in a few releases.
> > 
> > No objection, I'll apply this to net-next, thanks Greg.
> 
> Still needs an update to MAINTAINERS.

Oops, forgot those directories, will send a follow-on patch for that.

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


RE: [PATCH] vsock: only load vmci transport on VMware hypervisor by default

2017-08-28 Thread Dexuan Cui
> From: Dexuan Cui
> Sent: Tuesday, August 22, 2017 21:21
> > ...
> > ...
> > The only problem here would be the potential for a guest and a host app
> to
> > have a conflict wrt port numbers, even though they would be able to
> > operate fine, if restricted to their appropriate transport.
> >
> > Thanks,
> > Jorgen
> 
> Hi Jorgen, Stefan,
> Thank you for the detailed analysis!
> You have a much better understanding than me about the complex
> scenarios. Can you please work out a patch? :-)

Hi Jorgen, Stefan,
May I know your plan for this? 
 
> IMO Linux driver of Hyper-V sockets is the simplest case, as we only have
> the "to host" option (the host side driver of Hyper-V sockets runs on
> Windows kernel and I don't think the other hypervisors emulate
> the full Hyper-V VMBus 4.0, which is required to support Hyper-V sockets).
> 
> -- Dexuan

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


[PATCH] storvsc: fix memory leak on ring buffer busy

2017-08-28 Thread Long Li
From: Long Li 

When storvsc is sending I/O to Hyper-v, it may allocate a bigger buffer
descriptor for large data payload that can't fit into a pre-allocated
buffer descriptor. This bigger buffer is freed on return path.

If I/O request to Hyper-v fails due to ring buffer busy, the storvsc allocated
buffer descriptor should also be freed.

Signed-off-by: Long Li 
---
 drivers/scsi/storvsc_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 009adb0..db52882 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1657,6 +1657,8 @@ static int storvsc_queuecommand(struct Scsi_Host *host, 
struct scsi_cmnd *scmnd)
ret = storvsc_do_io(dev, cmd_request, smp_processor_id());
 
if (ret == -EAGAIN) {
+   if (payload_sz > sizeof(cmd_request->mpb))
+   kfree(payload);
/* no more space */
return SCSI_MLQUEUE_DEVICE_BUSY;
}
-- 
2.7.4

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


Re: [PATCH 0/4] irda: move it to drivers/staging so we can delete it

2017-08-28 Thread Joe Perches
On Mon, 2017-08-28 at 16:42 -0700, David Miller wrote:
> From: Greg Kroah-Hartman 
> Date: Sun, 27 Aug 2017 17:03:30 +0200
> 
> > The IRDA code has long been obsolete and broken.  So, to keep people
> > from trying to use it, and to prevent people from having to maintain it,
> > let's move it to drivers/staging/ so that we can delete it entirely from
> > the kernel in a few releases.
> 
> No objection, I'll apply this to net-next, thanks Greg.

Still needs an update to MAINTAINERS.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 0/4] irda: move it to drivers/staging so we can delete it

2017-08-28 Thread David Miller
From: Greg Kroah-Hartman 
Date: Sun, 27 Aug 2017 17:03:30 +0200

> The IRDA code has long been obsolete and broken.  So, to keep people
> from trying to use it, and to prevent people from having to maintain it,
> let's move it to drivers/staging/ so that we can delete it entirely from
> the kernel in a few releases.

No objection, I'll apply this to net-next, thanks Greg.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: ks7010: Fix alignment should match open parenthesis.

2017-08-28 Thread Jonathan Whitaker
This commit fixes alignment styling as reported by checkpatch.pl.

Signed-off-by: Jonathan Whitaker 
---
 drivers/staging/ks7010/ks_hostif.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index 24a6316..975dbbb 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -1658,8 +1658,8 @@ void hostif_phy_information_request(struct 
ks_wlan_private *priv)
 
 static
 void hostif_power_mgmt_request(struct ks_wlan_private *priv,
-   unsigned long mode, unsigned long wake_up,
-   unsigned long receive_dtims)
+  unsigned long mode, unsigned long wake_up,
+  unsigned long receive_dtims)
 {
struct hostif_power_mgmt_request_t *pp;
 
-- 
2.7.4

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


[PATCH] Staging: ks7010: Fix hardcoded function names in strings. Warnings reported by checkpatch.pl.

2017-08-28 Thread Jonathan Whitaker
This commit replaces hardcoded function name strings to the more preferred 
'"%s...", __func__'
style. These warnings were reported by checkpatch.pl.

Signed-off-by: Jonathan Whitaker 
---
 drivers/staging/ks7010/ks7010_sdio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 9b28ee1..c0e91c3 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -834,7 +834,7 @@ static int ks7010_sdio_probe(struct sdio_func *func,
unsigned char byte;
int ret;
 
-   DPRINTK(5, "ks7010_sdio_probe()\n");
+   DPRINTK(5, "%s()\n", __func__);
 
priv = NULL;
netdev = NULL;
@@ -1008,7 +1008,7 @@ static void ks7010_sdio_remove(struct sdio_func *func)
struct ks_sdio_card *card;
struct ks_wlan_private *priv;
 
-   DPRINTK(1, "ks7010_sdio_remove()\n");
+   DPRINTK(1, "%s()\n", __func__);
 
card = sdio_get_drvdata(func);
 
-- 
2.7.4

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


RE: [PATCH v3 net-next 1/1] hv_sock: implements Hyper-V transport for Virtual Sockets (AF_VSOCK)

2017-08-28 Thread Dexuan Cui
> From: David Miller [mailto:da...@davemloft.net]
> Sent: Monday, August 28, 2017 15:39
> From: Dexuan Cui 
> Date: Sat, 26 Aug 2017 04:52:43 +
> 
> >
> > Hyper-V Sockets (hv_sock) supplies a byte-stream based communication
> > mechanism between the host and the guest. It uses VMBus ringbuffer as
> the
> > transportation layer.
> >
> > With hv_sock, applications between the host (Windows 10, Windows
> Server
> > 2016 or newer) and the guest can talk with each other using the traditional
> > socket APIs.
> >
> > Signed-off-by: Dexuan Cui 
> 
> Applied, thank you.

Thanks a lot!

There are some supporting patches still pending in the VMBus driver.
I'll make sure they go in through the char-misc tree.

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


Re: [PATCH v3 net-next 1/1] hv_sock: implements Hyper-V transport for Virtual Sockets (AF_VSOCK)

2017-08-28 Thread David Miller
From: Dexuan Cui 
Date: Sat, 26 Aug 2017 04:52:43 +

> 
> Hyper-V Sockets (hv_sock) supplies a byte-stream based communication
> mechanism between the host and the guest. It uses VMBus ringbuffer as the
> transportation layer.
> 
> With hv_sock, applications between the host (Windows 10, Windows Server
> 2016 or newer) and the guest can talk with each other using the traditional
> socket APIs.
> 
> More info about Hyper-V Sockets is available here:
> 
> "Make your own integration services":
> https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/make-integration-service
> 
> The patch implements the necessary support in Linux guest by introducing a new
> vsock transport for AF_VSOCK.
> 
> Signed-off-by: Dexuan Cui 

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


Re: [PATCH v2 11/14] power: supply: bq24190_charger: Get input_current_limit from our supplier

2017-08-28 Thread Hans de Goede

Hi,

On 28-08-17 20:07, Liam Breck wrote:

Hi Hans, I sent too soon...

On Mon, Aug 28, 2017 at 9:04 AM, Hans de Goede  wrote:

Hi,


On 16-08-17 22:28, Liam Breck wrote:


Hi Hans,

On Tue, Aug 15, 2017 at 1:04 PM, Hans de Goede 
wrote:


On some devices the USB Type-C port power (USB PD 2.0) negotiation is
done by a separate port-controller IC, while the current limit is
controlled through another (charger) IC.

It has been decided to model this by modelling the external Type-C
power brick (adapter/charger) as a power-supply class device which
supplies the charger-IC, with its voltage-now and current-max
representing
the negotiated voltage and max current draw.

This commit adds support for this to the bq24190_charger driver by
calling
power_supply_set_input_current_limit_from_supplier helper if the
"input-current-limit-from-supplier" device-property is set.

Note this replaces the functionality to get the current-limit from an
extcon device, which will be removed in a follow-up commit.

Signed-off-by: Hans de Goede 
---
Changes in v2:
-Wait a bit before applying current-max from our supplier as
input-current-limit
   the bq24190 may still be in its power-good wait-state while our
supplier is
   done negotating current-max and if we apply the limit to early then the
   input-current-limit will be reset to 0.5A by the bq24190 after its
   power-good wait is done.
---
   drivers/power/supply/bq24190_charger.c | 35
++
   1 file changed, 35 insertions(+)

diff --git a/drivers/power/supply/bq24190_charger.c
b/drivers/power/supply/bq24190_charger.c
index f13f892..6f75c8e 100644
--- a/drivers/power/supply/bq24190_charger.c
+++ b/drivers/power/supply/bq24190_charger.c
@@ -159,9 +159,11 @@ struct bq24190_dev_info {
  struct extcon_dev   *extcon;
  struct notifier_block   extcon_nb;
  struct delayed_work extcon_work;
+   struct delayed_work input_current_limit_work;
  charmodel_name[I2C_NAME_SIZE];
  boolinitialized;
  boolirq_event;
+   bool
input_current_limit_from_supplier;
  struct mutexf_reg_lock;
  u8  f_reg;
  u8  ss_reg;
@@ -1142,6 +1144,32 @@ static int
bq24190_charger_property_is_writeable(struct power_supply *psy,
  return ret;
   }

+static void bq24190_input_current_limit_work(struct work_struct *work)
+{
+   struct bq24190_dev_info *bdi =
+   container_of(work, struct bq24190_dev_info,
+input_current_limit_work.work);
+
+   power_supply_set_input_current_limit_from_supplier(bdi->charger);
+}
+
+static void bq24190_charger_external_power_changed(struct power_supply
*psy)
+{
+   struct bq24190_dev_info *bdi = power_supply_get_drvdata(psy);
+
+   /*
+* The Power-Good detection may take up to 220ms, sometimes
+* the external charger detection is quicker, and the bq24190
will
+* reset to iinlim based on its own charger detection (which is
not
+* hooked up when using external charger detection) resulting in
a
+* too low default 500mA iinlim. Delay setting the
input-current-limit
+* for 300ms to avoid this.
+*/
+   if (bdi->input_current_limit_from_supplier)
+   queue_delayed_work(system_wq,
>input_current_limit_work,
+  msecs_to_jiffies(300));
+}
+
   static enum power_supply_property bq24190_charger_properties[] = {
  POWER_SUPPLY_PROP_CHARGE_TYPE,
  POWER_SUPPLY_PROP_HEALTH,
@@ -1170,6 +1198,7 @@ static const struct power_supply_desc
bq24190_charger_desc = {
  .get_property   = bq24190_charger_get_property,
  .set_property   = bq24190_charger_set_property,
  .property_is_writeable  = bq24190_charger_property_is_writeable,
+   .external_power_changed = bq24190_charger_external_power_changed,
   };

   /* Battery power supply property routines */
@@ -1651,6 +1680,8 @@ static int bq24190_probe(struct i2c_client *client,
  mutex_init(>f_reg_lock);
  bdi->f_reg = 0;
  bdi->ss_reg = BQ24190_REG_SS_VBUS_STAT_MASK; /* impossible state
*/
+   INIT_DELAYED_WORK(>input_current_limit_work,
+ bq24190_input_current_limit_work);

  i2c_set_clientdata(client, bdi);

@@ -1659,6 +1690,10 @@ static int bq24190_probe(struct i2c_client
*client,
  return -EINVAL;
  }

+   bdi->input_current_limit_from_supplier =
+   device_property_read_bool(dev,
+
"input-current-limit-from-supplier");
+



Maybe
if (device_property_read_bool(dev,
"linux,input-current-limit-from-supplier")) {
 

Re: [PATCH v2 11/14] power: supply: bq24190_charger: Get input_current_limit from our supplier

2017-08-28 Thread Liam Breck
Hi Hans, I sent too soon...

On Mon, Aug 28, 2017 at 9:04 AM, Hans de Goede  wrote:
> Hi,
>
>
> On 16-08-17 22:28, Liam Breck wrote:
>>
>> Hi Hans,
>>
>> On Tue, Aug 15, 2017 at 1:04 PM, Hans de Goede 
>> wrote:
>>>
>>> On some devices the USB Type-C port power (USB PD 2.0) negotiation is
>>> done by a separate port-controller IC, while the current limit is
>>> controlled through another (charger) IC.
>>>
>>> It has been decided to model this by modelling the external Type-C
>>> power brick (adapter/charger) as a power-supply class device which
>>> supplies the charger-IC, with its voltage-now and current-max
>>> representing
>>> the negotiated voltage and max current draw.
>>>
>>> This commit adds support for this to the bq24190_charger driver by
>>> calling
>>> power_supply_set_input_current_limit_from_supplier helper if the
>>> "input-current-limit-from-supplier" device-property is set.
>>>
>>> Note this replaces the functionality to get the current-limit from an
>>> extcon device, which will be removed in a follow-up commit.
>>>
>>> Signed-off-by: Hans de Goede 
>>> ---
>>> Changes in v2:
>>> -Wait a bit before applying current-max from our supplier as
>>> input-current-limit
>>>   the bq24190 may still be in its power-good wait-state while our
>>> supplier is
>>>   done negotating current-max and if we apply the limit to early then the
>>>   input-current-limit will be reset to 0.5A by the bq24190 after its
>>>   power-good wait is done.
>>> ---
>>>   drivers/power/supply/bq24190_charger.c | 35
>>> ++
>>>   1 file changed, 35 insertions(+)
>>>
>>> diff --git a/drivers/power/supply/bq24190_charger.c
>>> b/drivers/power/supply/bq24190_charger.c
>>> index f13f892..6f75c8e 100644
>>> --- a/drivers/power/supply/bq24190_charger.c
>>> +++ b/drivers/power/supply/bq24190_charger.c
>>> @@ -159,9 +159,11 @@ struct bq24190_dev_info {
>>>  struct extcon_dev   *extcon;
>>>  struct notifier_block   extcon_nb;
>>>  struct delayed_work extcon_work;
>>> +   struct delayed_work input_current_limit_work;
>>>  charmodel_name[I2C_NAME_SIZE];
>>>  boolinitialized;
>>>  boolirq_event;
>>> +   bool
>>> input_current_limit_from_supplier;
>>>  struct mutexf_reg_lock;
>>>  u8  f_reg;
>>>  u8  ss_reg;
>>> @@ -1142,6 +1144,32 @@ static int
>>> bq24190_charger_property_is_writeable(struct power_supply *psy,
>>>  return ret;
>>>   }
>>>
>>> +static void bq24190_input_current_limit_work(struct work_struct *work)
>>> +{
>>> +   struct bq24190_dev_info *bdi =
>>> +   container_of(work, struct bq24190_dev_info,
>>> +input_current_limit_work.work);
>>> +
>>> +   power_supply_set_input_current_limit_from_supplier(bdi->charger);
>>> +}
>>> +
>>> +static void bq24190_charger_external_power_changed(struct power_supply
>>> *psy)
>>> +{
>>> +   struct bq24190_dev_info *bdi = power_supply_get_drvdata(psy);
>>> +
>>> +   /*
>>> +* The Power-Good detection may take up to 220ms, sometimes
>>> +* the external charger detection is quicker, and the bq24190
>>> will
>>> +* reset to iinlim based on its own charger detection (which is
>>> not
>>> +* hooked up when using external charger detection) resulting in
>>> a
>>> +* too low default 500mA iinlim. Delay setting the
>>> input-current-limit
>>> +* for 300ms to avoid this.
>>> +*/
>>> +   if (bdi->input_current_limit_from_supplier)
>>> +   queue_delayed_work(system_wq,
>>> >input_current_limit_work,
>>> +  msecs_to_jiffies(300));
>>> +}
>>> +
>>>   static enum power_supply_property bq24190_charger_properties[] = {
>>>  POWER_SUPPLY_PROP_CHARGE_TYPE,
>>>  POWER_SUPPLY_PROP_HEALTH,
>>> @@ -1170,6 +1198,7 @@ static const struct power_supply_desc
>>> bq24190_charger_desc = {
>>>  .get_property   = bq24190_charger_get_property,
>>>  .set_property   = bq24190_charger_set_property,
>>>  .property_is_writeable  = bq24190_charger_property_is_writeable,
>>> +   .external_power_changed = bq24190_charger_external_power_changed,
>>>   };
>>>
>>>   /* Battery power supply property routines */
>>> @@ -1651,6 +1680,8 @@ static int bq24190_probe(struct i2c_client *client,
>>>  mutex_init(>f_reg_lock);
>>>  bdi->f_reg = 0;
>>>  bdi->ss_reg = BQ24190_REG_SS_VBUS_STAT_MASK; /* impossible state
>>> */
>>> +   INIT_DELAYED_WORK(>input_current_limit_work,
>>> + bq24190_input_current_limit_work);
>>>
>>>  i2c_set_clientdata(client, bdi);
>>>
>>> @@ -1659,6 +1690,10 @@ 

[PATCH v2] staging: most: hdm_usb: Driver registration with module_usb_driver

2017-08-28 Thread Alex Briskin
Register with module_usb_driver macro instead of module_init/module_exit.

Signed-off-by: Alex Briskin 
---
 drivers/staging/most/hdm-usb/hdm_usb.c | 20 +---
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
b/drivers/staging/most/hdm-usb/hdm_usb.c
index a9c3785d19ae..85775da293fb 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -1301,25 +1301,7 @@ static struct usb_driver hdm_usb = {
.disconnect = hdm_disconnect,
 };
 
-static int __init hdm_usb_init(void)
-{
-   pr_info("hdm_usb_init()\n");
-   if (usb_register(_usb)) {
-   pr_err("could not register hdm_usb driver\n");
-   return -EIO;
-   }
-
-   return 0;
-}
-
-static void __exit hdm_usb_exit(void)
-{
-   pr_info("hdm_usb_exit()\n");
-   usb_deregister(_usb);
-}
-
-module_init(hdm_usb_init);
-module_exit(hdm_usb_exit);
+module_usb_driver(hdm_usb);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Christian Gromm ");
 MODULE_DESCRIPTION("HDM_4_USB");
-- 
2.11.0

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


[PATCH 11/11 v3] staging: typec: tcpm: Switch to PORT_RESET instead of SNK_UNATTACHED

2017-08-28 Thread Badhri Jagan Sridharan
When VBUS is not discovered within PD_T_PS_SOURCE_ON although Rp
is detected on CC, TCPM switches the port to SNK_UNATTACHED
state. SNK_UNATTACHED, however does not force TYPEC_CC_OPEN which
makes the partner(source) to think that it is connected.

To overcome this issue, force the port into PORT_RESET state
to make sure the CC lines are open.

Signed-off-by: Badhri Jagan Sridharan 
Reviewed-by: Guenter Roeck 
---
Changelog since previous version:
- Only one previous version of the patch was sent.
  Numbering this V3 instead of V2 to keep the sequence
  number in sync with the rest of the patches in the
  patch list.
- added Reviewed-by: Guenter Roeck 
- fixed version/sequence numbers

 drivers/staging/typec/tcpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index 9e0111dea7c4..47b8fec5ea36 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -2380,7 +2380,7 @@ static void run_state_machine(struct tcpm_port *port)
   0);
else
/* Wait for VBUS, but not forever */
-   tcpm_set_state(port, SNK_UNATTACHED, PD_T_PS_SOURCE_ON);
+   tcpm_set_state(port, PORT_RESET, PD_T_PS_SOURCE_ON);
break;
 
case SRC_TRY:
-- 
2.14.1.342.g6490525c54-goog

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


[PATCH 08/11 v3] staging: typec: tcpm: add cc change handling in src states

2017-08-28 Thread Badhri Jagan Sridharan
In the case that the lower layer driver reports a cc change directly
from SINK state to SOURCE state, TCPM doesn't handle these cc change
in SRC_SEND_CAPABILITIES, SRC_READY states. And with SRC_ATTACHED
state, the change is not handled as the port is still considered
connected.

[49606.131672] state change DRP_TOGGLING -> SRC_ATTACH_WAIT
[49606.131701] pending state change SRC_ATTACH_WAIT -> SRC_ATTACHED @
200 ms
[49606.329952] state change SRC_ATTACH_WAIT -> SRC_ATTACHED [delayed 200
ms]
[49606.329978] polarity 0
[49606.329989] Requesting mux mode 1, config 0, polarity 0
[49606.349416] vbus:=1 charge=0
[49606.372274] pending state change SRC_ATTACHED -> SRC_UNATTACHED @ 480
ms
[49606.372431] VBUS on
[49606.372488] state change SRC_ATTACHED -> SRC_STARTUP
...
(the lower layer driver reports a direct change from source to sink)
[49606.536927] pending state change SRC_SEND_CAPABILITIES ->
SRC_SEND_CAPABILITIES @ 150 ms
[49606.547244] CC1: 2 -> 5, CC2: 0 -> 0 [state SRC_SEND_CAPABILITIES,
polarity 0, connected]

This can happen when the lower layer driver and/or the hardware
handles a portion of the Type-C state machine work, and quietly goes
through the unattached state.

Originally-from: Yueyao Zhu 
Signed-off-by: Badhri Jagan Sridharan 
Reviewed-by: Guenter Roeck 
---
Changelog since previous version:
- Only one previous version of the patch was sent.
  Numbering this V3 instead of V2 to keep the sequence
  number in sync with the rest of the patches in the
  patch list.
- added Reviewed-by: Guenter Roeck 
- fixed version/sequence numbers

 drivers/staging/typec/tcpm.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index 645f43ee83df..1f6827f32b29 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -2874,10 +2874,12 @@ static void _tcpm_cc_change(struct tcpm_port *port, 
enum typec_cc_status cc1,
tcpm_set_state(port, SRC_ATTACH_WAIT, 0);
break;
case SRC_ATTACHED:
-   if (tcpm_port_is_disconnected(port))
+   case SRC_SEND_CAPABILITIES:
+   case SRC_READY:
+   if (tcpm_port_is_disconnected(port) ||
+   !tcpm_port_is_source(port))
tcpm_set_state(port, SRC_UNATTACHED, 0);
break;
-
case SNK_UNATTACHED:
if (tcpm_port_is_sink(port))
tcpm_set_state(port, SNK_ATTACH_WAIT, 0);
-- 
2.14.1.342.g6490525c54-goog

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


[PATCH 04/11 v3] staging: usb: tcpm: usb: type-c: tcpm: Check for Rp for tPDDebounce

2017-08-28 Thread Badhri Jagan Sridharan
According the spec, the following is the conditions for exiting Try.SNK
state:
"The port shall wait for tDRPTry and only then begin monitoring the CC1 and
CC2 pins for the SNK.Rp state. The port shall then transition to
Attached.SNK when the SNK.Rp state is detected on exactly one of the CC1
or CC2 pins for at least tPDDebounce and V BUS is detected. Alternatively,
the port shall transition to TryWait.SRC if SNK.Rp state is not detected
for tPDDebounce."

Signed-off-by: Badhri Jagan Sridharan 
Reviewed-by: Guenter Roeck 
---
Changelog since v1:
- Corrected  tag

Changelog since v2:
- added Reviewed-by: Guenter Roeck 
- fixed version/sequence numbers

 drivers/staging/typec/tcpm.c | 68 
 1 file changed, 24 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index d45ffa8f2cfd..7eed04698ebe 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -105,6 +105,8 @@
\
S(SNK_TRY), \
S(SNK_TRY_WAIT),\
+   S(SNK_TRY_WAIT_DEBOUNCE),   \
+   S(SNK_TRY_WAIT_DEBOUNCE_CHECK_VBUS),\
S(SRC_TRYWAIT), \
S(SRC_TRYWAIT_DEBOUNCE),\
S(SRC_TRYWAIT_UNATTACHED),  \
@@ -2202,18 +2204,24 @@ static void run_state_machine(struct tcpm_port *port)
tcpm_set_state(port, SNK_TRY_WAIT, PD_T_DRP_TRY);
break;
case SNK_TRY_WAIT:
+   if (tcpm_port_is_sink(port)) {
+   tcpm_set_state(port, SNK_TRY_WAIT_DEBOUNCE, 0);
+   } else {
+   tcpm_set_state(port, SRC_TRYWAIT, 0);
+   port->max_wait = 0;
+   }
+   break;
+   case SNK_TRY_WAIT_DEBOUNCE:
+   tcpm_set_state(port, SNK_TRY_WAIT_DEBOUNCE_CHECK_VBUS,
+  PD_T_PD_DEBOUNCE);
+   break;
+   case SNK_TRY_WAIT_DEBOUNCE_CHECK_VBUS:
if (port->vbus_present && tcpm_port_is_sink(port)) {
tcpm_set_state(port, SNK_ATTACHED, 0);
-   break;
-   }
-   if (!tcpm_port_is_sink(port)) {
-   tcpm_set_state(port, SRC_TRYWAIT,
-  PD_T_PD_DEBOUNCE);
+   } else {
+   tcpm_set_state(port, SRC_TRYWAIT, 0);
port->max_wait = 0;
-   break;
}
-   /* No vbus, cc state is sink or open */
-   tcpm_set_state(port, SRC_TRYWAIT_UNATTACHED, PD_T_DRP_TRYWAIT);
break;
case SRC_TRYWAIT:
tcpm_set_cc(port, tcpm_rp_cc(port));
@@ -2921,20 +2929,12 @@ static void _tcpm_cc_change(struct tcpm_port *port, 
enum typec_cc_status cc1,
if (port->vbus_present || !tcpm_port_is_source(port))
tcpm_set_state(port, SRC_TRYWAIT, 0);
break;
-   case SNK_TRY_WAIT:
-   if (port->vbus_present && tcpm_port_is_sink(port)) {
-   tcpm_set_state(port, SNK_ATTACHED, 0);
-   break;
+   case SNK_TRY_WAIT_DEBOUNCE:
+   if (!tcpm_port_is_sink(port)) {
+   port->max_wait = 0;
+   tcpm_set_state(port, SRC_TRYWAIT, 0);
}
-   if (!tcpm_port_is_sink(port))
-   new_state = SRC_TRYWAIT;
-   else
-   new_state = SRC_TRYWAIT_UNATTACHED;
-
-   if (new_state != port->delayed_state)
-   tcpm_set_state(port, SNK_TRY_WAIT, 0);
break;
-
case SRC_TRY:
if (tcpm_port_is_source(port))
tcpm_set_state(port, SRC_TRY_DEBOUNCE, 0);
@@ -2974,8 +2974,6 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum 
typec_cc_status cc1,
 
 static void _tcpm_pd_vbus_on(struct tcpm_port *port)
 {
-   enum tcpm_state new_state;
-
tcpm_log_force(port, "VBUS on");
port->vbus_present = true;
switch (port->state) {
@@ -3011,18 +3009,8 @@ static void _tcpm_pd_vbus_on(struct tcpm_port *port)
case SRC_TRYWAIT_DEBOUNCE:
tcpm_set_state(port, SRC_TRYWAIT, 0);
break;
-   case SNK_TRY_WAIT:
-   if (tcpm_port_is_sink(port)) {
-   tcpm_set_state(port, SNK_ATTACHED, 0);
-   break;
-   }
-   if (!tcpm_port_is_sink(port))
-   new_state = SRC_TRYWAIT;
-   else
-   new_state = SRC_TRYWAIT_UNATTACHED;
-
-   if (new_state != port->delayed_state)
-   tcpm_set_state(port, 

[PATCH 06/11 v3] staging: typec: tcpm: Comply with TryWait.SNK State

2017-08-28 Thread Badhri Jagan Sridharan
According to the spec:
"4.5.2.2.10.2 Exiting from TryWait.SNK State
The port shall transition to Attached.SNK after tCCDebounce if or when VBUS
is detected. Note the Source may initiate USB PD communications which will
cause brief periods of the SNK.Open state on both the CC1 and CC2 pins,
but this event will not exceed tPDDebounce. The port shall transition to
Unattached.SNK when the state of both of the CC1 and CC2 pins is SNK.Open
for at least tPDDebounce."

Signed-off-by: Badhri Jagan Sridharan 
Reviewed-by: Guenter Roeck 
---
Changelog since v1:
- Corrected  tag

Changelog since v2:
- added Reviewed-by: Guenter Roeck 
- fixed version/sequence numbers

 drivers/staging/typec/tcpm.c | 58 +++-
 1 file changed, 30 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index fc179bdea7e4..0ae0a5c7 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -2403,26 +2403,24 @@ static void run_state_machine(struct tcpm_port *port)
break;
case SNK_TRYWAIT:
tcpm_set_cc(port, TYPEC_CC_RD);
-   tcpm_set_state(port, SNK_TRYWAIT_DEBOUNCE, PD_T_CC_DEBOUNCE);
+   tcpm_set_state(port, SNK_TRYWAIT_VBUS, PD_T_CC_DEBOUNCE);
break;
-   case SNK_TRYWAIT_DEBOUNCE:
-   if (port->vbus_present) {
+   case SNK_TRYWAIT_VBUS:
+   /*
+* TCPM stays in this state indefinitely until VBUS
+* is detected as long as Rp is not detected for
+* more than a time period of tPDDebounce.
+*/
+   if (port->vbus_present && tcpm_port_is_sink(port)) {
tcpm_set_state(port, SNK_ATTACHED, 0);
break;
}
-   if (tcpm_port_is_disconnected(port)) {
-   tcpm_set_state(port, SNK_UNATTACHED,
-  PD_T_PD_DEBOUNCE);
-   break;
-   }
-   if (tcpm_port_is_source(port))
-   tcpm_set_state(port, SRC_ATTACHED, 0);
-   /* XXX Are we supposed to stay in this state ? */
+   if (!tcpm_port_is_sink(port))
+   tcpm_set_state(port, SNK_TRYWAIT_DEBOUNCE, 0);
break;
-   case SNK_TRYWAIT_VBUS:
-   tcpm_set_state(port, SNK_ATTACHED, PD_T_CC_DEBOUNCE);
+   case SNK_TRYWAIT_DEBOUNCE:
+   tcpm_set_state(port, SNK_UNATTACHED, PD_T_PD_DEBOUNCE);
break;
-
case SNK_ATTACHED:
ret = tcpm_snk_attach(port);
if (ret < 0)
@@ -2960,19 +2958,16 @@ static void _tcpm_cc_change(struct tcpm_port *port, 
enum typec_cc_status cc1,
tcpm_set_state(port, SRC_TRY_WAIT, 0);
break;
case SNK_TRYWAIT_DEBOUNCE:
-   if (port->vbus_present) {
-   tcpm_set_state(port, SNK_ATTACHED, 0);
-   break;
-   }
-   if (tcpm_port_is_source(port)) {
-   tcpm_set_state(port, SRC_ATTACHED, 0);
-   break;
-   }
-   if (tcpm_port_is_disconnected(port) &&
-   port->delayed_state != SNK_UNATTACHED)
+   if (tcpm_port_is_sink(port))
+   tcpm_set_state(port, SNK_TRYWAIT_VBUS, 0);
+   break;
+   case SNK_TRYWAIT_VBUS:
+   if (!tcpm_port_is_sink(port))
tcpm_set_state(port, SNK_TRYWAIT_DEBOUNCE, 0);
break;
-
+   case SNK_TRYWAIT:
+   /* Do nothing, waiting for tCCDebounce */
+   break;
case PR_SWAP_SNK_SRC_SINK_OFF:
case PR_SWAP_SRC_SNK_TRANSITION_OFF:
case PR_SWAP_SRC_SNK_SOURCE_OFF:
@@ -3030,7 +3025,14 @@ static void _tcpm_pd_vbus_on(struct tcpm_port *port)
/* Do nothing, waiting for PD_DEBOUNCE to do be done */
break;
case SNK_TRYWAIT:
-   tcpm_set_state(port, SNK_TRYWAIT_VBUS, 0);
+   /* Do nothing, waiting for tCCDebounce */
+   break;
+   case SNK_TRYWAIT_VBUS:
+   if (tcpm_port_is_sink(port))
+   tcpm_set_state(port, SNK_ATTACHED, 0);
+   break;
+   case SNK_TRYWAIT_DEBOUNCE:
+   /* Do nothing, waiting for Rp */
break;
case SRC_TRY_WAIT:
case SRC_TRY_DEBOUNCE:
@@ -3067,10 +3069,10 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port)
case SNK_TRY_WAIT_DEBOUNCE:
/* Do nothing, waiting for PD_DEBOUNCE to do be done */
break;
+   case SNK_TRYWAIT:
case SNK_TRYWAIT_VBUS:
-   tcpm_set_state(port, SNK_TRYWAIT, 0);
+   case SNK_TRYWAIT_DEBOUNCE:
 

[PATCH 10/11 v3] staging: typec: tcpm: Do not send PING msgs in TCPM

2017-08-28 Thread Badhri Jagan Sridharan
PING messages are used to monitor the connect/disconnect.
However, when PD is carried over CC, so this is not required.

Also, the spec does not clearly say if PD is possible when
Type-c is connected to Type-A/B. So, removing sending
PING messages altogether.

Signed-off-by: Badhri Jagan Sridharan 
Reviewed-by: Guenter Roeck 
---
Changelog since previous version:
- Only one previous version of the patch was sent.
  Numbering this V3 instead of V2 to keep the sequence
  number in sync with the rest of the patches in the
  patch list.
- added Reviewed-by: Guenter Roeck 
- fixed version/sequence numbers

 drivers/staging/typec/tcpm.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index a7da609006f5..9e0111dea7c4 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -2335,14 +2335,11 @@ static void run_state_machine(struct tcpm_port *port)
 * - The system is not operating in PD mode
 * or
 * - Both partners are connected using a Type-C connector
-*   XXX How do we know that ?
+*
+* There is no actual need to send PD messages since the local
+* port type-c and the spec does not clearly say whether PD is
+* possible when type-c is connected to Type-A/B
 */
-   if (port->pwr_opmode == TYPEC_PWR_MODE_PD &&
-   !port->op_vsafe5v) {
-   tcpm_pd_send_control(port, PD_CTRL_PING);
-   tcpm_set_state_cond(port, SRC_READY,
-   PD_T_SOURCE_ACTIVITY);
-   }
break;
case SRC_WAIT_NEW_CAPABILITIES:
/* Nothing to do... */
-- 
2.14.1.342.g6490525c54-goog

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


[PATCH 05/11 v3] staging: typec: tcpm: Follow Try.SRC exit requirements

2017-08-28 Thread Badhri Jagan Sridharan
According to spec:
" 4.5.2.2.9.2 Exiting from Try.SRC State:
The port shall transition to Attached.SRC when the SRC.Rd
state is detected on exactly one of the CC1 or CC2 pins for
at least tPDDebounce. The port shall transition to
TryWait.SNK after tDRPTry and the SRC.Rd state has not been
detected."

Signed-off-by: Badhri Jagan Sridharan 
Reviewed-by: Guenter Roeck 
---
Changelog since v1:
- Corrected  tag

Changelog since v2:
- added Reviewed-by: Guenter Roeck 
- fixed version/sequence numbers

 drivers/staging/typec/tcpm.c | 33 -
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index 7eed04698ebe..fc179bdea7e4 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -112,6 +112,7 @@
S(SRC_TRYWAIT_UNATTACHED),  \
\
S(SRC_TRY), \
+   S(SRC_TRY_WAIT),\
S(SRC_TRY_DEBOUNCE),\
S(SNK_TRYWAIT), \
S(SNK_TRYWAIT_DEBOUNCE),\
@@ -2158,6 +2159,7 @@ static void run_state_machine(struct tcpm_port *port)
 {
int ret;
enum typec_pwr_opmode opmode;
+   unsigned int msecs;
 
port->enter_state = port->state;
switch (port->state) {
@@ -2379,7 +2381,22 @@ static void run_state_machine(struct tcpm_port *port)
case SRC_TRY:
port->try_src_count++;
tcpm_set_cc(port, tcpm_rp_cc(port));
-   tcpm_set_state(port, SNK_TRYWAIT, PD_T_DRP_TRY);
+   port->max_wait = 0;
+   tcpm_set_state(port, SRC_TRY_WAIT, 0);
+   break;
+   case SRC_TRY_WAIT:
+   if (port->max_wait == 0) {
+   port->max_wait = jiffies +
+msecs_to_jiffies(PD_T_DRP_TRY);
+   msecs = PD_T_DRP_TRY;
+   } else {
+   if (time_is_after_jiffies(port->max_wait))
+   msecs = jiffies_to_msecs(port->max_wait -
+jiffies);
+   else
+   msecs = 0;
+   }
+   tcpm_set_state(port, SNK_TRYWAIT, msecs);
break;
case SRC_TRY_DEBOUNCE:
tcpm_set_state(port, SRC_ATTACHED, PD_T_PD_DEBOUNCE);
@@ -2935,12 +2952,12 @@ static void _tcpm_cc_change(struct tcpm_port *port, 
enum typec_cc_status cc1,
tcpm_set_state(port, SRC_TRYWAIT, 0);
}
break;
-   case SRC_TRY:
+   case SRC_TRY_WAIT:
if (tcpm_port_is_source(port))
tcpm_set_state(port, SRC_TRY_DEBOUNCE, 0);
break;
case SRC_TRY_DEBOUNCE:
-   tcpm_set_state(port, SRC_TRY, 0);
+   tcpm_set_state(port, SRC_TRY_WAIT, 0);
break;
case SNK_TRYWAIT_DEBOUNCE:
if (port->vbus_present) {
@@ -3015,7 +3032,10 @@ static void _tcpm_pd_vbus_on(struct tcpm_port *port)
case SNK_TRYWAIT:
tcpm_set_state(port, SNK_TRYWAIT_VBUS, 0);
break;
-
+   case SRC_TRY_WAIT:
+   case SRC_TRY_DEBOUNCE:
+   /* Do nothing, waiting for sink detection */
+   break;
default:
break;
}
@@ -3069,7 +3089,10 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port)
case PORT_RESET_WAIT_OFF:
tcpm_set_state(port, tcpm_default_state(port), 0);
break;
-
+   case SRC_TRY_WAIT:
+   case SRC_TRY_DEBOUNCE:
+   /* Do nothing, waiting for sink detection */
+   break;
default:
if (port->pwr_role == TYPEC_SINK &&
port->attached)
-- 
2.14.1.342.g6490525c54-goog

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


[PATCH 07/11 v3] staging: typec: tcpm: Consider port_type while determining unattached_state

2017-08-28 Thread Badhri Jagan Sridharan
While performing PORT_RESET, upon receiving the cc disconnect
signal from the underlaying tcpc device, TCPM transitions into
unattached state. Consider the current type of port while determining
the unattached state.

In the below logs, although the port_type was set to sink, TCPM
transitioned into SRC_UNATTACHED.

[  762.290654] state change SRC_READY -> PORT_RESET
[  762.324531] Setting voltage/current limit 0 mV 0 mA
[  762.327912] polarity 0
[  762.334864] cc:=0
[  762.347193] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms
[  762.347200] VBUS off
[  762.347203] CC1: 2 -> 0, CC2: 0 -> 0 [state PORT_RESET, polarity 0, 
disconnected]
[  762.347206] state change PORT_RESET -> SRC_UNATTACHED

Signed-off-by: Badhri Jagan Sridharan 
Reviewed-by: Guenter Roeck 
---
Changelog since previous version:
- Only one previous version of the patch was sent.
  Numbering this V3 instead of V2 to keep the sequence
  number in sync with the rest of the patches in the
  patch list.
- added Reviewed-by: Guenter Roeck 
- fixed version/sequence numbers
- addressed comment nit

 drivers/staging/typec/tcpm.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index 0ae0a5c7..645f43ee83df 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -2117,10 +2117,16 @@ static inline enum tcpm_state ready_state(struct 
tcpm_port *port)
 
 static inline enum tcpm_state unattached_state(struct tcpm_port *port)
 {
-   if (port->pwr_role == TYPEC_SOURCE)
+   if (port->port_type == TYPEC_PORT_DRP) {
+   if (port->pwr_role == TYPEC_SOURCE)
+   return SRC_UNATTACHED;
+   else
+   return SNK_UNATTACHED;
+   } else if (port->port_type == TYPEC_PORT_DFP) {
return SRC_UNATTACHED;
-   else
-   return SNK_UNATTACHED;
+   }
+
+   return SNK_UNATTACHED;
 }
 
 static void tcpm_check_send_discover(struct tcpm_port *port)
-- 
2.14.1.342.g6490525c54-goog

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


[PATCH 09/11 v3] staging: typec: tcpm: typec: tcpm: Wait for CC debounce before PD excg

2017-08-28 Thread Badhri Jagan Sridharan
Once, Rp or Rd is switched, wait for PD_T_CC_DEBOUNCE. If not the
PS_RDY message transmitted might result in failure.
Also, Only wait for PD_T_SRCSWAPSTDBY while in
PR_SWAP_SRC_SNK_TRANSITION_OFF. PD_T_PS_SOURCE_OFF is the overall
time after which the initial sink would issue hard reset.

Signed-off-by: Badhri Jagan Sridharan 
Reviewed-by: Guenter Roeck 
---
Changelog since previous version:
- Only one previous version of the patch was sent.
  Numbering this V3 instead of V2 to keep the sequence
  number in sync with the rest of the patches in the
  patch list.
- added Reviewed-by: Guenter Roeck 
- fixed version/sequence numbers

 drivers/staging/typec/pd.h   |  2 ++
 drivers/staging/typec/tcpm.c | 25 ++---
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/typec/pd.h b/drivers/staging/typec/pd.h
index 510ef7279900..30b32ad72acd 100644
--- a/drivers/staging/typec/pd.h
+++ b/drivers/staging/typec/pd.h
@@ -278,6 +278,8 @@ static inline unsigned int rdo_max_power(u32 rdo)
 #define PD_T_VCONN_SOURCE_ON   100
 #define PD_T_SINK_REQUEST  100 /* 100 ms minimum */
 #define PD_T_ERROR_RECOVERY100 /* minimum 25 is insufficient */
+#define PD_T_SRCSWAPSTDBY  625 /* Maximum of 650ms */
+#define PD_T_NEWSRC250 /* Maximum of 275ms */
 
 #define PD_T_DRP_TRY   100 /* 75 - 150 ms */
 #define PD_T_DRP_TRYWAIT   600 /* 400 - 800 ms */
diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index 1f6827f32b29..a7da609006f5 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -90,9 +90,11 @@
S(PR_SWAP_START),   \
S(PR_SWAP_SRC_SNK_TRANSITION_OFF),  \
S(PR_SWAP_SRC_SNK_SOURCE_OFF),  \
+   S(PR_SWAP_SRC_SNK_SOURCE_OFF_CC_DEBOUNCED), \
S(PR_SWAP_SRC_SNK_SINK_ON), \
S(PR_SWAP_SNK_SRC_SINK_OFF),\
S(PR_SWAP_SNK_SRC_SOURCE_ON),   \
+   S(PR_SWAP_SNK_SRC_SOURCE_ON_VBUS_RAMPED_UP),\
\
S(VCONN_SWAP_ACCEPT),   \
S(VCONN_SWAP_SEND), \
@@ -1395,7 +1397,7 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port,
   SNK_TRANSITION_SINK_VBUS, 0);
}
break;
-   case PR_SWAP_SRC_SNK_SOURCE_OFF:
+   case PR_SWAP_SRC_SNK_SOURCE_OFF_CC_DEBOUNCED:
tcpm_set_state(port, PR_SWAP_SRC_SNK_SINK_ON, 0);
break;
case PR_SWAP_SNK_SRC_SINK_OFF:
@@ -2679,11 +2681,17 @@ static void run_state_machine(struct tcpm_port *port)
case PR_SWAP_SRC_SNK_TRANSITION_OFF:
tcpm_set_vbus(port, false);
port->explicit_contract = false;
+   /* allow time for Vbus discharge, must be < tSrcSwapStdby */
tcpm_set_state(port, PR_SWAP_SRC_SNK_SOURCE_OFF,
-  PD_T_PS_SOURCE_OFF);
+  PD_T_SRCSWAPSTDBY);
break;
case PR_SWAP_SRC_SNK_SOURCE_OFF:
tcpm_set_cc(port, TYPEC_CC_RD);
+   /* allow CC debounce */
+   tcpm_set_state(port, PR_SWAP_SRC_SNK_SOURCE_OFF_CC_DEBOUNCED,
+  PD_T_CC_DEBOUNCE);
+   break;
+   case PR_SWAP_SRC_SNK_SOURCE_OFF_CC_DEBOUNCED:
/*
 * USB-PD standard, 6.2.1.4, Port Power Role:
 * "During the Power Role Swap Sequence, for the initial Source
@@ -2709,6 +2717,15 @@ static void run_state_machine(struct tcpm_port *port)
case PR_SWAP_SNK_SRC_SOURCE_ON:
tcpm_set_cc(port, tcpm_rp_cc(port));
tcpm_set_vbus(port, true);
+   /*
+* allow time VBUS ramp-up, must be < tNewSrc
+* Also, this window overlaps with CC debounce as well.
+* So, Wait for the max of two which is PD_T_NEWSRC
+*/
+   tcpm_set_state(port, PR_SWAP_SNK_SRC_SOURCE_ON_VBUS_RAMPED_UP,
+  PD_T_NEWSRC);
+   break;
+   case PR_SWAP_SNK_SRC_SOURCE_ON_VBUS_RAMPED_UP:
/*
 * USB PD standard, 6.2.1.4:
 * "Subsequent Messages initiated by the Policy Engine,
@@ -2979,8 +2996,10 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum 
typec_cc_status cc1,
case PR_SWAP_SNK_SRC_SINK_OFF:
case PR_SWAP_SRC_SNK_TRANSITION_OFF:
case PR_SWAP_SRC_SNK_SOURCE_OFF:
+   case PR_SWAP_SRC_SNK_SOURCE_OFF_CC_DEBOUNCED:
+   case PR_SWAP_SNK_SRC_SOURCE_ON:
/*
-* CC state change is expected here; we just turned off power.
+* CC state change is expected in PR_SWAP
   

[PATCH 03/11 v3] staging: typec: tcpm: Prevent TCPM from looping in SRC_TRYWAIT

2017-08-28 Thread Badhri Jagan Sridharan
According to the spec the following is the condition
for exiting TryWait.SRC:

"The port shall transition to Attached.SRC when V BUS is at vSafe0V
and the SRC.Rd state is detected on exactly one of the CC pins for at
least tCCDebounce. The port shall transition to Unattached.SNK after
tDRPTry if neither of the CC1 or CC2 pins are in the SRC.Rd state"

TCPM at present keeps re-entering the SRC_TRYWAIT and keeps restarting
tDRPTry if the CC presents Rp and disconnects within tCCDebounce.

For example:
[  447.164308] pending state change SRC_TRYWAIT -> SRC_ATTACHED @ 200 ms
[  447.164386] CC1: 2 -> 0, CC2: 0 -> 0 [state SRC_TRYWAIT, polarity 0, 
disconnected]
[  447.164406] state change SRC_TRYWAIT -> SRC_TRYWAIT
[  447.164573] cc:=3
[  447.191408] pending state change SRC_TRYWAIT -> SRC_TRYWAIT_UNATTACHED @ 100 
ms
[  447.191478] CC1: 0 -> 0, CC2: 0 -> 0 [state SRC_TRYWAIT, polarity 0, 
disconnected]
[  447.207261] CC1: 0 -> 2, CC2: 0 -> 0 [state SRC_TRYWAIT, polarity 0, 
connected]
[  447.207306] state change SRC_TRYWAIT -> SRC_TRYWAIT
[  447.207485] cc:=3
[  447.237283] pending state change SRC_TRYWAIT -> SRC_ATTACHED @ 200 ms
[  447.237357] CC1: 2 -> 0, CC2: 0 -> 0 [state SRC_TRYWAIT, polarity 0, 
disconnected]
[  447.237379] state change SRC_TRYWAIT -> SRC_TRYWAIT
[  447.237532] cc:=3
[  447.263219] pending state change SRC_TRYWAIT -> SRC_TRYWAIT_UNATTACHED @ 100 
ms
[  447.263289] CC1: 0 -> 0, CC2: 0 -> 0 [state SRC_TRYWAIT, polarity 0, 
disconnected]
[  447.280926] CC1: 0 -> 2, CC2: 0 -> 0 [state SRC_TRYWAIT, polarity 0, 
connected]
[  447.280970] state change SRC_TRYWAIT -> SRC_TRYWAIT
[  447.281158] cc:=3
[  447.307767] pending state change SRC_TRYWAIT -> SRC_ATTACHED @ 200 ms
[  447.307838] CC1: 2 -> 0, CC2: 0 -> 0 [state SRC_TRYWAIT, polarity 0, 
disconnected]
[  447.307858] state change SRC_TRYWAIT -> SRC_TRYWAIT

In TCPM, tDRPTry is set tp 100ms (min 75ms and max 150ms)
and tCCdebounce is set to 200ms (min 100ms and max 200ms).
To overcome the issue, record the time at which the port
enters TryWait.SRC(SRC_TRYWAIT) and re-enter SRC_TRYWAIT
only when CC keeps debouncing within tDRPTry.

Signed-off-by: Badhri Jagan Sridharan 
Reviewed-by: Guenter Roeck 
---
Changelog since v1:
- Corrected  tag

Changelog since v2:
- added Reviewed-by: Guenter Roeck 
- fixed version/sequence numbers

 drivers/staging/typec/tcpm.c | 45 
 1 file changed, 29 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index 1219e3bc13ef..d45ffa8f2cfd 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -105,6 +106,7 @@
S(SNK_TRY), \
S(SNK_TRY_WAIT),\
S(SRC_TRYWAIT), \
+   S(SRC_TRYWAIT_DEBOUNCE),\
S(SRC_TRYWAIT_UNATTACHED),  \
\
S(SRC_TRY), \
@@ -284,6 +286,9 @@ struct tcpm_port {
struct typec_altmode *partner_altmode[SVID_DISCOVERY_MAX];
struct typec_altmode *port_altmode[SVID_DISCOVERY_MAX];
 
+   /* Deadline in jiffies to exit src_try_wait state */
+   unsigned long max_wait;
+
 #ifdef CONFIG_DEBUG_FS
struct dentry *dentry;
struct mutex logbuffer_lock;/* log buffer access lock */
@@ -2204,6 +2209,7 @@ static void run_state_machine(struct tcpm_port *port)
if (!tcpm_port_is_sink(port)) {
tcpm_set_state(port, SRC_TRYWAIT,
   PD_T_PD_DEBOUNCE);
+   port->max_wait = 0;
break;
}
/* No vbus, cc state is sink or open */
@@ -2211,11 +2217,22 @@ static void run_state_machine(struct tcpm_port *port)
break;
case SRC_TRYWAIT:
tcpm_set_cc(port, tcpm_rp_cc(port));
-   if (!port->vbus_present && tcpm_port_is_source(port))
-   tcpm_set_state(port, SRC_ATTACHED, PD_T_CC_DEBOUNCE);
-   else
+   if (port->max_wait == 0) {
+   port->max_wait = jiffies +
+msecs_to_jiffies(PD_T_DRP_TRY);
tcpm_set_state(port, SRC_TRYWAIT_UNATTACHED,
   PD_T_DRP_TRY);
+   } else {
+   if (time_is_after_jiffies(port->max_wait))
+   tcpm_set_state(port, SRC_TRYWAIT_UNATTACHED,
+  jiffies_to_msecs(port->max_wait -
+   jiffies));
+   else
+   tcpm_set_state(port, 

[PATCH 02/11 v3] staging: typec: tcpm: Check for port type for Try.SRC/Try.SNK

2017-08-28 Thread Badhri Jagan Sridharan
Enable Try.SRC or Try.SNK only when port_type is
DRP. Try.SRC or Try.SNK state machines are not
valid for SRC only or SNK only ports.

Signed-off-by: Badhri Jagan Sridharan 
Reviewed-by: Guenter Roeck 
---
Changelog since v1:
- Corrected  tag

Changelog since v2:
- added Reviewed-by: Guenter Roeck 
- fixed version/sequence numbers

 drivers/staging/typec/tcpm.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index 6c045ac9c42a..1219e3bc13ef 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -328,10 +328,12 @@ struct pd_rx_event {
 (tcpm_cc_is_audio((port)->cc2) && tcpm_cc_is_open((port)->cc1)))
 
 #define tcpm_try_snk(port) \
-   ((port)->try_snk_count == 0 && (port)->try_role == TYPEC_SINK)
+   ((port)->try_snk_count == 0 && (port)->try_role == TYPEC_SINK && \
+   (port)->port_type == TYPEC_PORT_DRP)
 
 #define tcpm_try_src(port) \
-   ((port)->try_src_count == 0 && (port)->try_role == TYPEC_SOURCE)
+   ((port)->try_src_count == 0 && (port)->try_role == TYPEC_SOURCE && \
+   (port)->port_type == TYPEC_PORT_DRP)
 
 static enum tcpm_state tcpm_default_state(struct tcpm_port *port)
 {
-- 
2.14.1.342.g6490525c54-goog

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


[PATCH 01/11 v3] staging: typec: tcpm: set port type callback

2017-08-28 Thread Badhri Jagan Sridharan
The port type callback call enquires the tcpc_dev if
the requested port type is supported. If supported, then
performs a tcpm reset if required after setting the tcpm
internal port_type variable.

Check against the tcpm port_type instead of checking
against caps.type as port_type reflects the current
configuration.

Signed-off-by: Badhri Jagan Sridharan 
Reviewed-by: Guenter Roeck 
---
Changelog since v1:
- Corrected  tag

Changelog since v2:
- added Reviewed-by: Guenter Roeck 
- fixed version/sequence numbers

 drivers/staging/typec/tcpm.c | 52 ++--
 1 file changed, 41 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index a911cad41a59..6c045ac9c42a 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -197,6 +197,7 @@ struct tcpm_port {
 
bool attached;
bool connected;
+   enum typec_port_type port_type;
bool vbus_present;
bool vbus_never_low;
bool vbus_source;
@@ -334,7 +335,7 @@ struct pd_rx_event {
 
 static enum tcpm_state tcpm_default_state(struct tcpm_port *port)
 {
-   if (port->typec_caps.type == TYPEC_PORT_DRP) {
+   if (port->port_type == TYPEC_PORT_DRP) {
if (port->try_role == TYPEC_SINK)
return SNK_UNATTACHED;
else if (port->try_role == TYPEC_SOURCE)
@@ -342,7 +343,7 @@ static enum tcpm_state tcpm_default_state(struct tcpm_port 
*port)
else if (port->tcpc->config->default_role == TYPEC_SINK)
return SNK_UNATTACHED;
/* Fall through to return SRC_UNATTACHED */
-   } else if (port->typec_caps.type == TYPEC_PORT_UFP) {
+   } else if (port->port_type == TYPEC_PORT_UFP) {
return SNK_UNATTACHED;
}
return SRC_UNATTACHED;
@@ -1458,7 +1459,7 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port,
tcpm_set_state(port, SOFT_RESET, 0);
break;
case PD_CTRL_DR_SWAP:
-   if (port->typec_caps.type != TYPEC_PORT_DRP) {
+   if (port->port_type != TYPEC_PORT_DRP) {
tcpm_queue_message(port, PD_MSG_CTRL_REJECT);
break;
}
@@ -1478,7 +1479,7 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port,
}
break;
case PD_CTRL_PR_SWAP:
-   if (port->typec_caps.type != TYPEC_PORT_DRP) {
+   if (port->port_type != TYPEC_PORT_DRP) {
tcpm_queue_message(port, PD_MSG_CTRL_REJECT);
break;
}
@@ -1853,7 +1854,7 @@ static bool tcpm_start_drp_toggling(struct tcpm_port 
*port)
int ret;
 
if (port->tcpc->start_drp_toggling &&
-   port->typec_caps.type == TYPEC_PORT_DRP) {
+   port->port_type == TYPEC_PORT_DRP) {
tcpm_log_force(port, "Start DRP toggling");
ret = port->tcpc->start_drp_toggling(port->tcpc,
 tcpm_rp_cc(port));
@@ -2163,7 +2164,7 @@ static void run_state_machine(struct tcpm_port *port)
break;
}
tcpm_set_cc(port, tcpm_rp_cc(port));
-   if (port->typec_caps.type == TYPEC_PORT_DRP)
+   if (port->port_type == TYPEC_PORT_DRP)
tcpm_set_state(port, SNK_UNATTACHED, PD_T_DRP_SNK);
break;
case SRC_ATTACH_WAIT:
@@ -2320,7 +2321,7 @@ static void run_state_machine(struct tcpm_port *port)
break;
}
tcpm_set_cc(port, TYPEC_CC_RD);
-   if (port->typec_caps.type == TYPEC_PORT_DRP)
+   if (port->port_type == TYPEC_PORT_DRP)
tcpm_set_state(port, SRC_UNATTACHED, PD_T_DRP_SRC);
break;
case SNK_ATTACH_WAIT:
@@ -2411,7 +2412,7 @@ static void run_state_machine(struct tcpm_port *port)
 * see USB power delivery specification, section 8.3.3.6.1.5.1).
 */
tcpm_set_state(port, hard_reset_state(port),
-  port->typec_caps.type == TYPEC_PORT_DRP ?
+  port->port_type == TYPEC_PORT_DRP ?
PD_T_DB_DETECT : PD_T_NO_RESPONSE);
break;
case SNK_DISCOVERY_DEBOUNCE:
@@ -3167,7 +3168,7 @@ static int tcpm_dr_set(const struct typec_capability *cap,
mutex_lock(>swap_lock);
mutex_lock(>lock);
 
-   if (port->typec_caps.type != TYPEC_PORT_DRP) {
+   if (port->port_type != TYPEC_PORT_DRP) {
ret = -EINVAL;
goto port_unlock;
}
@@ -3235,7 +3236,7 @@ static int tcpm_pr_set(const struct typec_capability *cap,
mutex_lock(>swap_lock);

Re: [PATCH v2 11/14] power: supply: bq24190_charger: Get input_current_limit from our supplier

2017-08-28 Thread Liam Breck
Hi Hans,

On Mon, Aug 28, 2017 at 9:04 AM, Hans de Goede  wrote:
> Hi,
>
>
> On 16-08-17 22:28, Liam Breck wrote:
>>
>> Hi Hans,
>>
>> On Tue, Aug 15, 2017 at 1:04 PM, Hans de Goede 
>> wrote:
>>>
>>> On some devices the USB Type-C port power (USB PD 2.0) negotiation is
>>> done by a separate port-controller IC, while the current limit is
>>> controlled through another (charger) IC.
>>>
>>> It has been decided to model this by modelling the external Type-C
>>> power brick (adapter/charger) as a power-supply class device which
>>> supplies the charger-IC, with its voltage-now and current-max
>>> representing
>>> the negotiated voltage and max current draw.
>>>
>>> This commit adds support for this to the bq24190_charger driver by
>>> calling
>>> power_supply_set_input_current_limit_from_supplier helper if the
>>> "input-current-limit-from-supplier" device-property is set.
>>>
>>> Note this replaces the functionality to get the current-limit from an
>>> extcon device, which will be removed in a follow-up commit.
>>>
>>> Signed-off-by: Hans de Goede 
>>> ---
>>> Changes in v2:
>>> -Wait a bit before applying current-max from our supplier as
>>> input-current-limit
>>>   the bq24190 may still be in its power-good wait-state while our
>>> supplier is
>>>   done negotating current-max and if we apply the limit to early then the
>>>   input-current-limit will be reset to 0.5A by the bq24190 after its
>>>   power-good wait is done.
>>> ---
>>>   drivers/power/supply/bq24190_charger.c | 35
>>> ++
>>>   1 file changed, 35 insertions(+)
>>>
>>> diff --git a/drivers/power/supply/bq24190_charger.c
>>> b/drivers/power/supply/bq24190_charger.c
>>> index f13f892..6f75c8e 100644
>>> --- a/drivers/power/supply/bq24190_charger.c
>>> +++ b/drivers/power/supply/bq24190_charger.c
>>> @@ -159,9 +159,11 @@ struct bq24190_dev_info {
>>>  struct extcon_dev   *extcon;
>>>  struct notifier_block   extcon_nb;
>>>  struct delayed_work extcon_work;
>>> +   struct delayed_work input_current_limit_work;
>>>  charmodel_name[I2C_NAME_SIZE];
>>>  boolinitialized;
>>>  boolirq_event;
>>> +   bool
>>> input_current_limit_from_supplier;
>>>  struct mutexf_reg_lock;
>>>  u8  f_reg;
>>>  u8  ss_reg;
>>> @@ -1142,6 +1144,32 @@ static int
>>> bq24190_charger_property_is_writeable(struct power_supply *psy,
>>>  return ret;
>>>   }
>>>
>>> +static void bq24190_input_current_limit_work(struct work_struct *work)
>>> +{
>>> +   struct bq24190_dev_info *bdi =
>>> +   container_of(work, struct bq24190_dev_info,
>>> +input_current_limit_work.work);
>>> +
>>> +   power_supply_set_input_current_limit_from_supplier(bdi->charger);
>>> +}
>>> +
>>> +static void bq24190_charger_external_power_changed(struct power_supply
>>> *psy)
>>> +{
>>> +   struct bq24190_dev_info *bdi = power_supply_get_drvdata(psy);
>>> +
>>> +   /*
>>> +* The Power-Good detection may take up to 220ms, sometimes
>>> +* the external charger detection is quicker, and the bq24190
>>> will
>>> +* reset to iinlim based on its own charger detection (which is
>>> not
>>> +* hooked up when using external charger detection) resulting in
>>> a
>>> +* too low default 500mA iinlim. Delay setting the
>>> input-current-limit
>>> +* for 300ms to avoid this.
>>> +*/
>>> +   if (bdi->input_current_limit_from_supplier)
>>> +   queue_delayed_work(system_wq,
>>> >input_current_limit_work,
>>> +  msecs_to_jiffies(300));
>>> +}
>>> +
>>>   static enum power_supply_property bq24190_charger_properties[] = {
>>>  POWER_SUPPLY_PROP_CHARGE_TYPE,
>>>  POWER_SUPPLY_PROP_HEALTH,
>>> @@ -1170,6 +1198,7 @@ static const struct power_supply_desc
>>> bq24190_charger_desc = {
>>>  .get_property   = bq24190_charger_get_property,
>>>  .set_property   = bq24190_charger_set_property,
>>>  .property_is_writeable  = bq24190_charger_property_is_writeable,
>>> +   .external_power_changed = bq24190_charger_external_power_changed,
>>>   };
>>>
>>>   /* Battery power supply property routines */
>>> @@ -1651,6 +1680,8 @@ static int bq24190_probe(struct i2c_client *client,
>>>  mutex_init(>f_reg_lock);
>>>  bdi->f_reg = 0;
>>>  bdi->ss_reg = BQ24190_REG_SS_VBUS_STAT_MASK; /* impossible state
>>> */
>>> +   INIT_DELAYED_WORK(>input_current_limit_work,
>>> + bq24190_input_current_limit_work);
>>>
>>>  i2c_set_clientdata(client, bdi);
>>>
>>> @@ -1659,6 +1690,10 @@ static int 

RE: [PATCHv2] hv_set_ifconfig.sh double check before setting ip

2017-08-28 Thread KY Srinivasan


> -Original Message-
> From: Haiyang Zhang
> Sent: Monday, August 28, 2017 8:57 AM
> To: Stephen Hemminger ; Eduardo Otubo
> ; KY Srinivasan 
> Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; Stephen
> Hemminger ; David Miller
> 
> Subject: RE: [PATCHv2] hv_set_ifconfig.sh double check before setting ip
> 
> 
> 
> > -Original Message-
> > From: Stephen Hemminger [mailto:step...@networkplumber.org]
> > Sent: Monday, August 28, 2017 11:16 AM
> > To: Eduardo Otubo 
> > Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; Haiyang
> > Zhang ; Stephen Hemminger
> > ; David Miller 
> > Subject: Re: [PATCHv2] hv_set_ifconfig.sh double check before setting ip
> >
> > On Mon, 28 Aug 2017 12:01:21 +0200
> > Eduardo Otubo  wrote:
> >
> > > v2: The script is now a little bit safer so it doesn't conflicts with
> > > network daemon trying to set configurations at the same time.
> > >
> > > This patch fixes the behavior of the hv_set_ifconfig script when
> > setting
> > > the interface ip. Sometimes the interface has already been configured
> > by
> > > network daemon, in this case hv_set_ifconfig causes "RTNETLINK: file
> > > exists error"; in order to avoid this error this patch makes sure
> > double
> > > checks the interface before trying anything.
> > >
> > > Signed-off-by: Eduardo Otubo 
> >
> > Adding new dependency on systemd is not going to make this script
> > even less useful.  I wonder why the script still exists at all? Most of
> > the
> > Linux distro's can already setup HV networking without it.
> >
> 
> This script is used by a host to inject IP into guests. KY knows more
> details about it.

I wrote this script initially to provide an example script for Distros to base 
their solution on.
KVP supports IP injection to enable VM migration. For this scenario, I think we 
recommend that NM be
disabled.

K. Y
> 

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


Re: [PATCH v2 04/14] staging: typec: fusb302: Get max snk mv/ma/mw from device-properties

2017-08-28 Thread Hans de Goede

Hi,

On 17-08-17 23:41, Rob Herring wrote:

On Tue, Aug 15, 2017 at 10:04:52PM +0200, Hans de Goede wrote:

This is board specific info so it should come from board config, such
as devicetree.

I've chosen to prefix these with "fcs," treating them as fusb302 driver
specific for now. We may want to revisit this and replace these with
properties which are part of a (to be written) generic type-c controller
devicetree binding.

Since this commit adds new dt-properties it also adds devicetree-bindings
documentation (which so far was absent for the fusb302 driver).

Cc: Rob Herring 
Cc: Frank Rowand 
Cc: devicet...@vger.kernel.org
Cc: "Yueyao (Nathan) Zhu" 
Signed-off-by: Hans de Goede 
---
Changes in v2:
-Use micro... instead of mili...
-Add devicetree bindings documentation
---
  .../devicetree/bindings/usb/fcs,fusb302.txt| 29 ++
  drivers/staging/typec/fusb302/TODO |  4 +++
  drivers/staging/typec/fusb302/fusb302.c| 18 +-
  3 files changed, 50 insertions(+), 1 deletion(-)
  create mode 100644 Documentation/devicetree/bindings/usb/fcs,fusb302.txt

diff --git a/Documentation/devicetree/bindings/usb/fcs,fusb302.txt 
b/Documentation/devicetree/bindings/usb/fcs,fusb302.txt
new file mode 100644
index 000..ffc6c87
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/fcs,fusb302.txt
@@ -0,0 +1,29 @@
+Fairchild FUSB302 Type-C Port controllers
+
+Required properties :
+- compatible: "fcs,fusb302"
+- reg   : I2C slave address
+- interrupts: Interrupt specifier
+
+Optional properties :
+- fcs,max-snk-microvolt : Maximum voltage to negotiate when configured as sink
+- fcs,max-snk-microamp  : Maximum current to negotiate when configured as sink
+- fcs,max-snk-microwatt : Maximum power to negotiate when configured as sink
+ If this is less then max-snk-microvolt *
+ max-snk-microamp then the configured current will
+ be clamped.
+- fcs,operating-snk-microwatt :


Might as well spell out sink.


Fixed for v3.


Otherwise,

Acked-by: Rob Herring 


Thank you, added to v3 of this patch-set.

Regards,

Hans




+  Minimum amount of power accepted from a sink
+ when negotiating
+
+Example:
+
+fusb302: typec-portc@54 {
+   compatible = "fcs,fusb302";
+   reg = <0x54>;
+   interrupt-parent = <_intc>;
+   interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+   fcs,max-snk-microvolt = <1200>;
+   fcs,max-snk-microamp = <300>;
+   fcs,max-snk-microwatt = <3600>;
+};

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


Re: [PATCHv2] hv_set_ifconfig.sh double check before setting ip

2017-08-28 Thread Eduardo Otubo
On Mon, Aug 28, 2017 at 03:56:44PM +, Haiyang Zhang wrote:
> 
> 
> > -Original Message-
> > From: Stephen Hemminger [mailto:step...@networkplumber.org]
> > Sent: Monday, August 28, 2017 11:16 AM
> > To: Eduardo Otubo 
> > Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; Haiyang
> > Zhang ; Stephen Hemminger
> > ; David Miller 
> > Subject: Re: [PATCHv2] hv_set_ifconfig.sh double check before setting ip
> > 
> > On Mon, 28 Aug 2017 12:01:21 +0200
> > Eduardo Otubo  wrote:
> > 
> > > v2: The script is now a little bit safer so it doesn't conflicts with
> > > network daemon trying to set configurations at the same time.
> > >
> > > This patch fixes the behavior of the hv_set_ifconfig script when
> > setting
> > > the interface ip. Sometimes the interface has already been configured
> > by
> > > network daemon, in this case hv_set_ifconfig causes "RTNETLINK: file
> > > exists error"; in order to avoid this error this patch makes sure
> > double
> > > checks the interface before trying anything.
> > >
> > > Signed-off-by: Eduardo Otubo 
> > 
> > Adding new dependency on systemd is not going to make this script
> > even less useful.  I wonder why the script still exists at all? Most of
> > the
> > Linux distro's can already setup HV networking without it.
> > 

Also, this script is meant to run only on RHEL guests, as written on
the header of this very same file.

-- 
Eduardo Otubo
Senior Software Engineer @ RedHat
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 11/14] power: supply: bq24190_charger: Get input_current_limit from our supplier

2017-08-28 Thread Hans de Goede

Hi,

On 16-08-17 22:28, Liam Breck wrote:

Hi Hans,

On Tue, Aug 15, 2017 at 1:04 PM, Hans de Goede  wrote:

On some devices the USB Type-C port power (USB PD 2.0) negotiation is
done by a separate port-controller IC, while the current limit is
controlled through another (charger) IC.

It has been decided to model this by modelling the external Type-C
power brick (adapter/charger) as a power-supply class device which
supplies the charger-IC, with its voltage-now and current-max representing
the negotiated voltage and max current draw.

This commit adds support for this to the bq24190_charger driver by calling
power_supply_set_input_current_limit_from_supplier helper if the
"input-current-limit-from-supplier" device-property is set.

Note this replaces the functionality to get the current-limit from an
extcon device, which will be removed in a follow-up commit.

Signed-off-by: Hans de Goede 
---
Changes in v2:
-Wait a bit before applying current-max from our supplier as input-current-limit
  the bq24190 may still be in its power-good wait-state while our supplier is
  done negotating current-max and if we apply the limit to early then the
  input-current-limit will be reset to 0.5A by the bq24190 after its
  power-good wait is done.
---
  drivers/power/supply/bq24190_charger.c | 35 ++
  1 file changed, 35 insertions(+)

diff --git a/drivers/power/supply/bq24190_charger.c 
b/drivers/power/supply/bq24190_charger.c
index f13f892..6f75c8e 100644
--- a/drivers/power/supply/bq24190_charger.c
+++ b/drivers/power/supply/bq24190_charger.c
@@ -159,9 +159,11 @@ struct bq24190_dev_info {
 struct extcon_dev   *extcon;
 struct notifier_block   extcon_nb;
 struct delayed_work extcon_work;
+   struct delayed_work input_current_limit_work;
 charmodel_name[I2C_NAME_SIZE];
 boolinitialized;
 boolirq_event;
+   boolinput_current_limit_from_supplier;
 struct mutexf_reg_lock;
 u8  f_reg;
 u8  ss_reg;
@@ -1142,6 +1144,32 @@ static int bq24190_charger_property_is_writeable(struct 
power_supply *psy,
 return ret;
  }

+static void bq24190_input_current_limit_work(struct work_struct *work)
+{
+   struct bq24190_dev_info *bdi =
+   container_of(work, struct bq24190_dev_info,
+input_current_limit_work.work);
+
+   power_supply_set_input_current_limit_from_supplier(bdi->charger);
+}
+
+static void bq24190_charger_external_power_changed(struct power_supply *psy)
+{
+   struct bq24190_dev_info *bdi = power_supply_get_drvdata(psy);
+
+   /*
+* The Power-Good detection may take up to 220ms, sometimes
+* the external charger detection is quicker, and the bq24190 will
+* reset to iinlim based on its own charger detection (which is not
+* hooked up when using external charger detection) resulting in a
+* too low default 500mA iinlim. Delay setting the input-current-limit
+* for 300ms to avoid this.
+*/
+   if (bdi->input_current_limit_from_supplier)
+   queue_delayed_work(system_wq, >input_current_limit_work,
+  msecs_to_jiffies(300));
+}
+
  static enum power_supply_property bq24190_charger_properties[] = {
 POWER_SUPPLY_PROP_CHARGE_TYPE,
 POWER_SUPPLY_PROP_HEALTH,
@@ -1170,6 +1198,7 @@ static const struct power_supply_desc 
bq24190_charger_desc = {
 .get_property   = bq24190_charger_get_property,
 .set_property   = bq24190_charger_set_property,
 .property_is_writeable  = bq24190_charger_property_is_writeable,
+   .external_power_changed = bq24190_charger_external_power_changed,
  };

  /* Battery power supply property routines */
@@ -1651,6 +1680,8 @@ static int bq24190_probe(struct i2c_client *client,
 mutex_init(>f_reg_lock);
 bdi->f_reg = 0;
 bdi->ss_reg = BQ24190_REG_SS_VBUS_STAT_MASK; /* impossible state */
+   INIT_DELAYED_WORK(>input_current_limit_work,
+ bq24190_input_current_limit_work);

 i2c_set_clientdata(client, bdi);

@@ -1659,6 +1690,10 @@ static int bq24190_probe(struct i2c_client *client,
 return -EINVAL;
 }

+   bdi->input_current_limit_from_supplier =
+   device_property_read_bool(dev,
+ "input-current-limit-from-supplier");
+


Maybe
   if (device_property_read_bool(dev,
"linux,input-current-limit-from-supplier")) {
INIT_DELAYED_WORK(>input_current_limit_work,
  bq24190_input_current_limit_work);
   bdi->input_current_limit_from_supplier = 

RE: [PATCHv2] hv_set_ifconfig.sh double check before setting ip

2017-08-28 Thread Haiyang Zhang


> -Original Message-
> From: Stephen Hemminger [mailto:step...@networkplumber.org]
> Sent: Monday, August 28, 2017 11:16 AM
> To: Eduardo Otubo 
> Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; Haiyang
> Zhang ; Stephen Hemminger
> ; David Miller 
> Subject: Re: [PATCHv2] hv_set_ifconfig.sh double check before setting ip
> 
> On Mon, 28 Aug 2017 12:01:21 +0200
> Eduardo Otubo  wrote:
> 
> > v2: The script is now a little bit safer so it doesn't conflicts with
> > network daemon trying to set configurations at the same time.
> >
> > This patch fixes the behavior of the hv_set_ifconfig script when
> setting
> > the interface ip. Sometimes the interface has already been configured
> by
> > network daemon, in this case hv_set_ifconfig causes "RTNETLINK: file
> > exists error"; in order to avoid this error this patch makes sure
> double
> > checks the interface before trying anything.
> >
> > Signed-off-by: Eduardo Otubo 
> 
> Adding new dependency on systemd is not going to make this script
> even less useful.  I wonder why the script still exists at all? Most of
> the
> Linux distro's can already setup HV networking without it.
> 

This script is used by a host to inject IP into guests. KY knows more 
details about it.


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


Re: Send a large patch right now or is it better to do it later?

2017-08-28 Thread Greg Kroah-Hartman
On Fri, Jul 28, 2017 at 05:16:56PM +0200, Marcus Wolf wrote:
> Hi Greg,
>  
> according to the proposals of Walter Harms, I revised the rf69.c: I replaced
> some macros with inline functions and removed some obsolete ifdefs. According 
> to
> walter this will improve the resource situation. In addition the readybility 
> is
> enhanced, since lines got shorter. It's a quite big change, that touched 
> nearly
> every function in that file.
> I was testing the new code for a while now and did not observer a problem so
> far. But I don't have a kind of unit test, so my tests for sure didn't cover
> everything.
>  
> Is it a good time, to submit such a change in these days, or is it prefrable 
> to
> submit it later?
> In adition, I am a bit afraid of my current mailtool doing something
> unexpected...

You can send patches anytime, don't worry about timing, I can handle
putting them in the correct patch queue.

> P.S. Can you process diffs fom SVN, too, or is it mandatory to create the diff
> with git?

As long as it is in normal patch format, I can apply it.  Personally, I
use quilt to generate patche, which uses 'diff', and that works just
fine.

thanks,

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


Re: [PATCHv2] hv_set_ifconfig.sh double check before setting ip

2017-08-28 Thread Stephen Hemminger
On Mon, 28 Aug 2017 12:01:21 +0200
Eduardo Otubo  wrote:

> v2: The script is now a little bit safer so it doesn't conflicts with
> network daemon trying to set configurations at the same time.
> 
> This patch fixes the behavior of the hv_set_ifconfig script when setting
> the interface ip. Sometimes the interface has already been configured by
> network daemon, in this case hv_set_ifconfig causes "RTNETLINK: file
> exists error"; in order to avoid this error this patch makes sure double
> checks the interface before trying anything.
> 
> Signed-off-by: Eduardo Otubo 

Adding new dependency on systemd is not going to make this script
even less useful.  I wonder why the script still exists at all? Most of the
Linux distro's can already setup HV networking without it.


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


[PATCH] Staging: bcm2048 fix bare use of 'unsigned' in radio-bcm2048.c

2017-08-28 Thread Branislav Radocaj
This is a patch to the radio-bcm2048.c file that fixes up
a warning found by the checkpatch.pl tool.

Removed unused 'size' argument from property_read macro.
In property_write macro, 'signal, size' is replaced by 'prop_type'.
This change implys the update of DEFINE_SYSFS_PROPERTY macro
and all places of its usage as well.

Signed-off-by: Branislav Radocaj 
---
 drivers/staging/media/bcm2048/radio-bcm2048.c | 60 +--
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c 
b/drivers/staging/media/bcm2048/radio-bcm2048.c
index 38f72d069e27..b1e664aeb6ab 100644
--- a/drivers/staging/media/bcm2048/radio-bcm2048.c
+++ b/drivers/staging/media/bcm2048/radio-bcm2048.c
@@ -1965,7 +1965,7 @@ static ssize_t bcm2048_##prop##_write(struct device *dev, 
\
return err < 0 ? err : count;   \
 }
 
-#define property_read(prop, size, mask)
\
+#define property_read(prop, mask)  \
 static ssize_t bcm2048_##prop##_read(struct device *dev,   \
struct device_attribute *attr,  \
char *buf)  \
@@ -2000,9 +2000,9 @@ static ssize_t bcm2048_##prop##_read(struct device *dev,  
\
return sprintf(buf, mask "\n", value);  \
 }
 
-#define DEFINE_SYSFS_PROPERTY(prop, signal, size, mask, check) \
-property_write(prop, signal size, mask, check) \
-property_read(prop, size, mask)
+#define DEFINE_SYSFS_PROPERTY(prop, prop_type, mask, check)\
+property_write(prop, prop_type, mask, check)   \
+property_read(prop, mask)  \
 
 #define property_str_read(prop, size)  \
 static ssize_t bcm2048_##prop##_read(struct device *dev,   \
@@ -2028,39 +2028,39 @@ static ssize_t bcm2048_##prop##_read(struct device 
*dev,\
return count;   \
 }
 
-DEFINE_SYSFS_PROPERTY(power_state, unsigned, int, "%u", 0)
-DEFINE_SYSFS_PROPERTY(mute, unsigned, int, "%u", 0)
-DEFINE_SYSFS_PROPERTY(audio_route, unsigned, int, "%u", 0)
-DEFINE_SYSFS_PROPERTY(dac_output, unsigned, int, "%u", 0)
-
-DEFINE_SYSFS_PROPERTY(fm_hi_lo_injection, unsigned, int, "%u", 0)
-DEFINE_SYSFS_PROPERTY(fm_frequency, unsigned, int, "%u", 0)
-DEFINE_SYSFS_PROPERTY(fm_af_frequency, unsigned, int, "%u", 0)
-DEFINE_SYSFS_PROPERTY(fm_deemphasis, unsigned, int, "%u", 0)
-DEFINE_SYSFS_PROPERTY(fm_rds_mask, unsigned, int, "%u", 0)
-DEFINE_SYSFS_PROPERTY(fm_best_tune_mode, unsigned, int, "%u", 0)
-DEFINE_SYSFS_PROPERTY(fm_search_rssi_threshold, unsigned, int, "%u", 0)
-DEFINE_SYSFS_PROPERTY(fm_search_mode_direction, unsigned, int, "%u", 0)
-DEFINE_SYSFS_PROPERTY(fm_search_tune_mode, unsigned, int, "%u", value > 3)
-
-DEFINE_SYSFS_PROPERTY(rds, unsigned, int, "%u", 0)
-DEFINE_SYSFS_PROPERTY(rds_b_block_mask, unsigned, int, "%u", 0)
-DEFINE_SYSFS_PROPERTY(rds_b_block_match, unsigned, int, "%u", 0)
-DEFINE_SYSFS_PROPERTY(rds_pi_mask, unsigned, int, "%u", 0)
-DEFINE_SYSFS_PROPERTY(rds_pi_match, unsigned, int, "%u", 0)
-DEFINE_SYSFS_PROPERTY(rds_wline, unsigned, int, "%u", 0)
-property_read(rds_pi, unsigned int, "%x")
+DEFINE_SYSFS_PROPERTY(power_state, unsigned int, "%u", 0)
+DEFINE_SYSFS_PROPERTY(mute, unsigned int, "%u", 0)
+DEFINE_SYSFS_PROPERTY(audio_route, unsigned int, "%u", 0)
+DEFINE_SYSFS_PROPERTY(dac_output, unsigned int, "%u", 0)
+
+DEFINE_SYSFS_PROPERTY(fm_hi_lo_injection, unsigned int, "%u", 0)
+DEFINE_SYSFS_PROPERTY(fm_frequency, unsigned int, "%u", 0)
+DEFINE_SYSFS_PROPERTY(fm_af_frequency, unsigned int, "%u", 0)
+DEFINE_SYSFS_PROPERTY(fm_deemphasis, unsigned int, "%u", 0)
+DEFINE_SYSFS_PROPERTY(fm_rds_mask, unsigned int, "%u", 0)
+DEFINE_SYSFS_PROPERTY(fm_best_tune_mode, unsigned int, "%u", 0)
+DEFINE_SYSFS_PROPERTY(fm_search_rssi_threshold, unsigned int, "%u", 0)
+DEFINE_SYSFS_PROPERTY(fm_search_mode_direction, unsigned int, "%u", 0)
+DEFINE_SYSFS_PROPERTY(fm_search_tune_mode, unsigned int, "%u", value > 3)
+
+DEFINE_SYSFS_PROPERTY(rds, unsigned int, "%u", 0)
+DEFINE_SYSFS_PROPERTY(rds_b_block_mask, unsigned int, "%u", 0)
+DEFINE_SYSFS_PROPERTY(rds_b_block_match, unsigned int, "%u", 0)
+DEFINE_SYSFS_PROPERTY(rds_pi_mask, unsigned int, "%u", 0)
+DEFINE_SYSFS_PROPERTY(rds_pi_match, unsigned int, "%u", 0)
+DEFINE_SYSFS_PROPERTY(rds_wline, unsigned int, "%u", 0)
+property_read(rds_pi, "%x")
 property_str_read(rds_rt, (BCM2048_MAX_RDS_RT + 1))
 property_str_read(rds_ps, (BCM2048_MAX_RDS_PS + 1))
 
-property_read(fm_rds_flags, unsigned int, "%u")
+property_read(fm_rds_flags, "%u")
 property_str_read(rds_data, BCM2048_MAX_RDS_RADIO_TEXT * 5)
 
-property_read(region_bottom_frequency, unsigned int, "%u")

Re: [PATCHv2] hv_set_ifconfig.sh double check before setting ip

2017-08-28 Thread Olaf Hering
On Mon, Aug 28, Eduardo Otubo wrote:

> +sleep 30s;

Was this runtime tested?
Once this sleep(1) is done, HV_UTIL_TIMEOUT kicks in and the daemon dies.

Olaf


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


[PATCH] staging: rtl8723bs: hal: remove cast to void pointer

2017-08-28 Thread Himanshu Jha
casting to void pointer from any pointer type and vice-versa is done
implicitly and therefore casting is not needed in such a case.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/rtl8723bs/hal/hal_btcoex.c| 14 +++
 drivers/staging/rtl8723bs/hal/hal_com.c   |  4 +-
 drivers/staging/rtl8723bs/hal/odm.c   | 46 +++
 drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 20 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_rxdesc.c   |  2 +-
 drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c|  2 +-
 drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c|  2 +-
 drivers/staging/rtl8723bs/hal/sdio_ops.c  |  2 +-
 8 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c 
b/drivers/staging/rtl8723bs/hal/hal_btcoex.c
index 9e08a4d..86fee10 100644
--- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c
+++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c
@@ -419,10 +419,10 @@ static u8 halbtcoutsrc_Get(void *pBtcContext, u8 getType, 
void *pOutBuf)
padapter = pBtCoexist->Adapter;
pHalData = GET_HAL_DATA(padapter);
mlmeext = >mlmeextpriv;
-   pu8 = (u8 *)pOutBuf;
-   pS4Tmp = (s32 *)pOutBuf;
-   pU4Tmp = (u32 *)pOutBuf;
-   pU1Tmp = (u8 *)pOutBuf;
+   pu8 = pOutBuf;
+   pS4Tmp = pOutBuf;
+   pU4Tmp = pOutBuf;
+   pU1Tmp = pOutBuf;
ret = true;
 
switch (getType) {
@@ -585,9 +585,9 @@ static u8 halbtcoutsrc_Set(void *pBtcContext, u8 setType, 
void *pInBuf)
pBtCoexist = (PBTC_COEXIST)pBtcContext;
padapter = pBtCoexist->Adapter;
pHalData = GET_HAL_DATA(padapter);
-   pu8 = (u8 *)pInBuf;
-   pU1Tmp = (u8 *)pInBuf;
-   pU4Tmp = (u32 *)pInBuf;
+   pu8 = pInBuf;
+   pU1Tmp = pInBuf;
+   pU4Tmp = pInBuf;
ret = true;
 
if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist))
diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c 
b/drivers/staging/rtl8723bs/hal/hal_com.c
index e3a9832..3e63b6d 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com.c
@@ -1311,7 +1311,7 @@ void SetHalODMVar(
switch (eVariable) {
case HAL_ODM_STA_INFO:
{
-   struct sta_info *psta = (struct sta_info *)pValue1;
+   struct sta_info *psta = pValue1;
if (bSet) {
DBG_8192C("### Set STA_(%d) info ###\n", 
psta->mac_id);
ODM_CmnInfoPtrArrayHook(podmpriv, 
ODM_CMNINFO_STA_STATUS, psta->mac_id, psta);
@@ -1333,7 +1333,7 @@ void SetHalODMVar(
#if defined(CONFIG_SIGNAL_DISPLAY_DBM) && 
defined(CONFIG_BACKGROUND_NOISE_MONITOR)
case HAL_ODM_NOISE_MONITOR:
{
-   struct noise_info *pinfo = (struct noise_info *)pValue1;
+   struct noise_info *pinfo = pValue1;
 
#ifdef DBG_NOISE_MONITOR
DBG_8192C("### Noise monitor chan(%d)-bPauseDIG:%d, 
IGIValue:0x%02x, max_time:%d (ms) ###\n",
diff --git a/drivers/staging/rtl8723bs/hal/odm.c 
b/drivers/staging/rtl8723bs/hal/odm.c
index 2dbf199..ff43bb2 100644
--- a/drivers/staging/rtl8723bs/hal/odm.c
+++ b/drivers/staging/rtl8723bs/hal/odm.c
@@ -592,95 +592,95 @@ void ODM_CmnInfoHook(PDM_ODM_T pDM_Odm, ODM_CMNINFO_E 
CmnInfo, void *pValue)
/*  Dynamic call by reference pointer. */
/*  */
case ODM_CMNINFO_MAC_PHY_MODE:
-   pDM_Odm->pMacPhyMode = (u8 *)pValue;
+   pDM_Odm->pMacPhyMode = pValue;
break;
 
case ODM_CMNINFO_TX_UNI:
-   pDM_Odm->pNumTxBytesUnicast = (u64 *)pValue;
+   pDM_Odm->pNumTxBytesUnicast = pValue;
break;
 
case ODM_CMNINFO_RX_UNI:
-   pDM_Odm->pNumRxBytesUnicast = (u64 *)pValue;
+   pDM_Odm->pNumRxBytesUnicast = pValue;
break;
 
case ODM_CMNINFO_WM_MODE:
-   pDM_Odm->pwirelessmode = (u8 *)pValue;
+   pDM_Odm->pwirelessmode = pValue;
break;
 
case ODM_CMNINFO_BAND:
-   pDM_Odm->pBandType = (u8 *)pValue;
+   pDM_Odm->pBandType = pValue;
break;
 
case ODM_CMNINFO_SEC_CHNL_OFFSET:
-   pDM_Odm->pSecChOffset = (u8 *)pValue;
+   pDM_Odm->pSecChOffset = pValue;
break;
 
case ODM_CMNINFO_SEC_MODE:
-   pDM_Odm->pSecurity = (u8 *)pValue;
+   pDM_Odm->pSecurity = pValue;
break;
 
case ODM_CMNINFO_BW:
-   pDM_Odm->pBandWidth = (u8 *)pValue;
+   pDM_Odm->pBandWidth = pValue;
break;
 
case ODM_CMNINFO_CHNL:
-   pDM_Odm->pChannel = (u8 *)pValue;
+   pDM_Odm->pChannel = pValue;
break;
 
case 

[PATCH] staging: rtl8723bs: os_dep: remove cast to void pointer

2017-08-28 Thread Himanshu Jha
casting to void pointer from any pointer type and vice-versa is done
implicitly and therefore casting is not needed in such a case.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/rtl8723bs/os_dep/mlme_linux.c | 4 ++--
 drivers/staging/rtl8723bs/os_dep/osdep_service.c  | 2 +-
 drivers/staging/rtl8723bs/os_dep/sdio_intf.c  | 2 +-
 drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c 
b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c
index 3e29df0..80ca2d7 100644
--- a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c
@@ -21,7 +21,7 @@
 
 static void _dynamic_check_timer_handlder (void *FunctionContext)
 {
-   struct adapter *adapter = (struct adapter *)FunctionContext;
+   struct adapter *adapter = FunctionContext;
 
rtw_dynamic_check_timer_handlder(adapter);
 
@@ -30,7 +30,7 @@ static void _dynamic_check_timer_handlder (void 
*FunctionContext)
 
 static void _rtw_set_scan_deny_timer_hdl(void *FunctionContext)
 {
-   struct adapter *adapter = (struct adapter *)FunctionContext;
+   struct adapter *adapter = FunctionContext;
rtw_set_scan_deny_timer_hdl(adapter);
 }
 
diff --git a/drivers/staging/rtl8723bs/os_dep/osdep_service.c 
b/drivers/staging/rtl8723bs/os_dep/osdep_service.c
index aa16d1a..a05daf0 100644
--- a/drivers/staging/rtl8723bs/os_dep/osdep_service.c
+++ b/drivers/staging/rtl8723bs/os_dep/osdep_service.c
@@ -73,7 +73,7 @@ inline int _rtw_netif_rx(_nic_hdl ndev, struct sk_buff *skb)
 
 void rtw_init_timer(_timer *ptimer, void *padapter, void *pfunc)
 {
-   struct adapter *adapter = (struct adapter *)padapter;
+   struct adapter *adapter = padapter;
 
_init_timer(ptimer, adapter->pnetdev, pfunc, adapter);
 }
diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c 
b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
index d2fb489..94332487 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
@@ -138,7 +138,7 @@ static void sdio_free_irq(struct dvobj_priv *dvobj)
 extern unsigned int oob_irq;
 static irqreturn_t gpio_hostwakeup_irq_thread(int irq, void *data)
 {
-   struct adapter *padapter = (struct adapter *)data;
+   struct adapter *padapter = data;
DBG_871X_LEVEL(_drv_always_, "gpio_hostwakeup_irq_thread\n");
/* Disable interrupt before calling handler */
/* disable_irq_nosync(oob_irq); */
diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c 
b/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
index 3aa3e65..3108a62 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
@@ -431,7 +431,7 @@ s32 _sd_read(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, 
void *pdata)
if (unlikely((cnt == 1) || (cnt == 2)))
{
int i;
-   u8 *pbuf = (u8 *)pdata;
+   u8 *pbuf = pdata;
 
for (i = 0; i < cnt; i++)
{
@@ -534,7 +534,7 @@ s32 _sd_write(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, 
void *pdata)
if (unlikely((cnt == 1) || (cnt == 2)))
{
int i;
-   u8 *pbuf = (u8 *)pdata;
+   u8 *pbuf = pdata;
 
for (i = 0; i < cnt; i++)
{
-- 
2.7.4

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


[PATCH] staging: rtl8723bs: core: remove cast to void pointer

2017-08-28 Thread Himanshu Jha
casting to void pointer from any pointer type and vice-versa is done
implicitly and therefore casting is not needed in such a case.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c  | 2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 2 +-
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c  | 2 +-
 drivers/staging/rtl8723bs/core/rtw_recv.c | 2 +-
 drivers/staging/rtl8723bs/core/rtw_xmit.c | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 080c81b..d381827 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -432,7 +432,7 @@ int rtw_cmd_thread(void *context)
unsigned long cmd_process_time;
u8 (*cmd_hdl)(struct adapter *padapter, u8 *pbuf);
void (*pcmd_callback)(struct adapter *dev, struct cmd_obj *pcmd);
-   struct adapter *padapter = (struct adapter *)context;
+   struct adapter *padapter = context;
struct cmd_priv *pcmdpriv = &(padapter->cmdpriv);
struct drvextra_cmd_parm *extra_parm = NULL;
 
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 99e3b68..b6d137f 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -1228,7 +1228,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union 
recv_frame *precv_frame)
}
 
pstat = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe));
-   if (pstat == (struct sta_info *)NULL) {
+   if (pstat == NULL) {
status = _RSON_CLS2_;
goto asoc_class2_error;
}
diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index f060e54..aabdaaf 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -829,7 +829,7 @@ static void pwr_rpwm_timeout_handler(void *FunctionContext)
struct pwrctrl_priv *pwrpriv;
 
 
-   padapter = (struct adapter *)FunctionContext;
+   padapter = FunctionContext;
pwrpriv = adapter_to_pwrctl(padapter);
DBG_871X("+%s: rpwm = 0x%02X cpwm = 0x%02X\n", __func__, pwrpriv->rpwm, 
pwrpriv->cpwm);
 
diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c 
b/drivers/staging/rtl8723bs/core/rtw_recv.c
index c6018f0..68a6303 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -2360,7 +2360,7 @@ int recv_indicatepkt_reorder(struct adapter *padapter, 
union recv_frame *prframe
 
 void rtw_reordering_ctrl_timeout_handler(void *pcontext)
 {
-   struct recv_reorder_ctrl *preorder_ctrl = (struct recv_reorder_ctrl 
*)pcontext;
+   struct recv_reorder_ctrl *preorder_ctrl = pcontext;
struct adapter *padapter = preorder_ctrl->padapter;
struct __queue *ppending_recvframe_queue = 
_ctrl->pending_recvframe_queue;
 
diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c 
b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index a0d79985..022f654 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -3002,7 +3002,7 @@ int rtw_xmit_thread(void *context)
 
 
err = _SUCCESS;
-   padapter = (struct adapter *)context;
+   padapter = context;
 
thread_enter("RTW_XMIT_THREAD");
 
-- 
2.7.4

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


[PATCH] staging: rtl8188eu: remove unnecessary call to memset

2017-08-28 Thread Himanshu Jha
call to memset to assign 0 value immediately after allocating
memory with kzalloc is unnecesaary as kzalloc allocates the memory
filled with 0 value.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/rtl8188eu/core/rtw_mlme.c  | 3 ---
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 2 --
 2 files changed, 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index fde3060..7397167 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -1566,7 +1566,6 @@ int rtw_set_auth(struct adapter *adapter, struct 
security_priv *psecuritypriv)
res = _FAIL;
goto exit;
}
-   memset(psetauthparm, 0, sizeof(struct setauth_parm));
psetauthparm->mode = (unsigned char)psecuritypriv->dot11AuthAlgrthm;
pcmd->cmdcode = _SetAuth_CMD_;
pcmd->parmbuf = (unsigned char *)psetauthparm;
@@ -1601,8 +1600,6 @@ int rtw_set_key(struct adapter *adapter, struct 
security_priv *psecuritypriv, in
goto err_free_cmd;
}
 
-   memset(psetkeyparm, 0, sizeof(struct setkey_parm));
-
if (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) {
psetkeyparm->algorithm = (unsigned 
char)psecuritypriv->dot118021XGrpPrivacy;
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
index 763eccd..c0664dc 100644
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -2166,8 +2166,6 @@ static int set_group_key(struct adapter *padapter, u8 
*key, u8 alg, int keyid)
goto exit;
}
 
-   memset(psetkeyparm, 0, sizeof(struct setkey_parm));
-
psetkeyparm->keyid = (u8)keyid;
 
psetkeyparm->algorithm = alg;
-- 
2.7.4

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


[PATCH v2] staging: fsl-mc: move bus driver out of staging

2017-08-28 Thread laurentiu.tudor
From: Stuart Yoder 

Move the source files out of staging into their final locations:
  -include files in drivers/staging/fsl-mc/include go to include/linux/fsl
  -irq-gic-v3-its-fsl-mc-msi.c goes to drivers/irqchip
  -source in drivers/staging/fsl-mc/bus goes to drivers/bus/fsl-mc
  -README.txt, providing and overview of DPAA goes to
   Documentation/dpaa2/overview.txt

Update or delete other remaining staging files-- Makefile, Kconfig, TODO.
Update dpaa2_eth and dpio staging drivers.

Signed-off-by: Stuart Yoder 
Signed-off-by: Laurentiu Tudor 
[Laurentiu: rebased, add dpaa2_eth and dpio #include updates]
Cc: Thomas Gleixner 
Cc: Jason Cooper 
Cc: Marc Zyngier 
---
Notes:
-v2:
  - group irqchip gic its glue code together with the rest (Marc Zyngier)

 .../README.txt => Documentation/dpaa2/overview.txt |  0
 MAINTAINERS|  2 +-
 drivers/bus/Kconfig|  2 ++
 drivers/bus/Makefile   |  3 +++
 drivers/bus/fsl-mc/Kconfig | 17 +
 drivers/bus/fsl-mc/Makefile| 17 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp-cmd.h |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.h |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng-cmd.h |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-cmd.h  |  0
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c   |  1 -
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c  |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.h  |  0
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c   |  1 -
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c|  0
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c|  0
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c |  1 -
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c|  2 +-
 drivers/irqchip/Makefile   |  1 +
 .../fsl-mc/bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c |  2 +-
 drivers/staging/fsl-dpaa2/ethernet/README  |  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpni.c  |  2 +-
 drivers/staging/fsl-mc/TODO| 18 --
 drivers/staging/fsl-mc/bus/Kconfig | 10 --
 drivers/staging/fsl-mc/bus/Makefile| 15 ++-
 drivers/staging/fsl-mc/bus/dpbp.c  |  2 +-
 drivers/staging/fsl-mc/bus/dpcon.c |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.c |  2 +-
 .../staging/fsl-mc/include => include/linux/fsl}/mc.h  |  0
 34 files changed, 56 insertions(+), 58 deletions(-)
 rename drivers/staging/fsl-mc/README.txt => Documentation/dpaa2/overview.txt 
(100%)
 create mode 100644 drivers/bus/fsl-mc/Kconfig
 create mode 100644 drivers/bus/fsl-mc/Makefile
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c (99%)
 rename drivers/{staging/fsl-mc/bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c 
(99%)
 delete mode 100644 drivers/staging/fsl-mc/TODO
 rename {drivers/staging/fsl-mc/include => include/linux/fsl}/mc.h (100%)

diff --git a/drivers/staging/fsl-mc/README.txt 
b/Documentation/dpaa2/overview.txt
similarity index 100%
rename from drivers/staging/fsl-mc/README.txt
rename to Documentation/dpaa2/overview.txt
diff --git a/MAINTAINERS b/MAINTAINERS
index 6f7721d..2149eeb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10900,7 +10900,7 @@ M:  Stuart Yoder 
 M: Laurentiu Tudor 
 L: linux-ker...@vger.kernel.org
 S: Maintained
-F: 

[PATCH] staging: rtlwifi: remove memset before memcpy

2017-08-28 Thread Himanshu Jha
calling memcpy immediately after memset with the same region of memory
makes memset redundant.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/rtlwifi/base.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtlwifi/base.c b/drivers/staging/rtlwifi/base.c
index b81f0a9..63ce708 100644
--- a/drivers/staging/rtlwifi/base.c
+++ b/drivers/staging/rtlwifi/base.c
@@ -2554,7 +2554,6 @@ bool rtl_check_beacon_key(struct ieee80211_hw *hw, void 
*data, unsigned int len)
 
if (!cur_bcn_key->valid) {
/* update cur_beacon_keys */
-   memset(cur_bcn_key, 0, sizeof(bcn_key));
memcpy(cur_bcn_key, _key, sizeof(bcn_key));
cur_bcn_key->valid = true;
 
-- 
2.7.4

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


[PATCHv2] hv_set_ifconfig.sh double check before setting ip

2017-08-28 Thread Eduardo Otubo
v2: The script is now a little bit safer so it doesn't conflicts with
network daemon trying to set configurations at the same time.

This patch fixes the behavior of the hv_set_ifconfig script when setting
the interface ip. Sometimes the interface has already been configured by
network daemon, in this case hv_set_ifconfig causes "RTNETLINK: file
exists error"; in order to avoid this error this patch makes sure double
checks the interface before trying anything.

Signed-off-by: Eduardo Otubo 
---
 tools/hv/hv_set_ifconfig.sh | 44 
 1 file changed, 36 insertions(+), 8 deletions(-)

diff --git a/tools/hv/hv_set_ifconfig.sh b/tools/hv/hv_set_ifconfig.sh
index 735aafd64a3f..3a04b91f61e3 100755
--- a/tools/hv/hv_set_ifconfig.sh
+++ b/tools/hv/hv_set_ifconfig.sh
@@ -46,19 +46,47 @@
 # is expected to return the configuration that is set via the SET
 # call.
 #
+interface=$(echo $1 | awk -F - '{ print $2 }')
 
+current_ip=$(ip addr show $interface|grep "inet ");
+config_file_ip=$(grep IPADDR $1|cut -d"=" -f2);
 
+current_ipv6=$(ip addr show $interface|grep "inet6 ");
+config_file_ipv6=$(grep IPV6ADDR $1|cut -d"=" -f2);
+config_file_ipv6_netmask=$(grep IPV6NETMASK $1|cut -d"=" -f2);
+config_file_ipv6=${config_file_ipv6}/${config_file_ipv6_netmask};
 
-echo "IPV6INIT=yes" >> $1
-echo "NM_CONTROLLED=no" >> $1
-echo "PEERDNS=yes" >> $1
-echo "ONBOOT=yes" >> $1
+network_service_state=$(/bin/systemctl is-active network);
 
+while [[ ${network_service_state} == "activating" \
+   || ${network_service_state} == "deactivating" ]]; do
+# Network script is still working. let's wait a bit.
+# The default timeout for systemd is 90s.
+sleep 30s;
+((i++));
+network_service_state=$(/bin/systemctl is-active network);
 
-cp $1 /etc/sysconfig/network-scripts/
+# If network service doens't come up or down in 90s we log the
+# error and give up.
+if [[ $i == 3 ]]; then
+logger "Couldn't set IP address for fail-over interface"\
+" because network daemon might be busy. Try to"\
+" if-down $interface && if-up $interface"\
+" manually later.";
+exit 1;
+fi
+done
 
+# Only set the IP if it's not configured yet.
+if [[ $(test "${current_ip#*$config_file_ip}") == "$config_file_ip" \
+|| $(test "${current_ipv6#*$config_file_ipv6}") == "$current_ipv6" ]]; then
+echo "IPV6INIT=yes" >> $1
+echo "NM_CONTROLLED=no" >> $1
+echo "PEERDNS=yes" >> $1
+echo "ONBOOT=yes" >> $1
 
-interface=$(echo $1 | awk -F - '{ print $2 }')
+cp $1 /etc/sysconfig/network-scripts/
 
-/sbin/ifdown $interface 2>/dev/null
-/sbin/ifup $interface 2>/dev/null
+/sbin/ifdown $interface 2>/dev/null
+/sbin/ifup $interface 2>/dev/null
+fi
-- 
2.13.5

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


For Mutual Benefit

2017-08-28 Thread Mr. Peter
Dear Beneficiary

I am Peter Douglas Director Inspection Unit United Nations Inspection Agent in 
Hartsfield–Jackson Atlanta International Airport Atlanta GA. We are rounding up 
for the second Quater of the auditing, all abandom Consignment in US Airports 
are being transfer to our facilities here for inspection and confiscation. but 
During our investigation, I discovered An abandoned shipment on your name which 
was transferred to our facility here in Hartsfield–Jackson Atlanta 
International Airport and when scanned it revealed an undisclosed sum of money 
in a Metal Trunk Box. The consignment was abandoned because the Content was not 
properly declared by the consignee as money, rather it was declared as personal 
effect to avoid diversion by the Diplomatic Agent also the Diplomat inability 
to pay for Non Inspection Fees.

On my assumption, the boxes will contain more that $6M and the consignment is 
still left in storage facility till today. The Consignment is a metal box with 
weight of about 242LBS (Internal dimension: W61 x H156 x D73 (cm). Effective 
capacity: 680 L.)Approximately.

The details of the consignment including your name the official document from 
United Nation office in London are tagged on the Metal Trunk box.

I want to use my good office and clear the Consignment and deliver it to you. 
If you WILL ACCEPT MY CONDITION AND want us to transact the delivery for mutual 
benefit, you should provide your name, Phone Number and full address, to cross 
check if it corresponds with the address on the official document including the 
name of nearest Airport around you and other details. You should send the 
required details to me for onward delivery.

All communication must be held extremely confidential. I can get everything 
concluded within 24 to 48 hours upon your acceptance and proceed to your 
address for delivery. But it must be on the condition that you will give me 30% 
of the amount contained in the boxes and i must get assurance from you 
concerning my 30% before i will proceed.

I want us to transact this business and share the money, since the shipper have 
abandoned it and ran away. I will pay for the Non inspection fee and arrange 
for the boxes to be moved out of this Airport to your address, Once i am 
through, i will deploy the services of a secured shipping Company to provide 
the security it needs to your doorstep. or i can bring it by myself to avoid 
any more trouble. But i will share it 70% to you and 30% to me. But you have to 
assure me of my 30%. do respond to me if you are interested to conclude this 
with me.

Respond to my direct Email: crrkkpe...@gmail.com 

Looking forward to hear from you

Best Regards,

Peter Douglas
INSPECTION OFFICER


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


Re: [PATCH] staging: gdm724x: Rename variable for consistency

2017-08-28 Thread Greg KH
On Thu, Aug 24, 2017 at 07:18:53PM -0400, Nick Fox wrote:
> Rename dftEpsId variable to dft_eps_ID to be consistent with other
> variables in the source file.
> 
> Signed-off-by: Nick Fox 
> ---
>  drivers/staging/gdm724x/hci_packet.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Always test-build your patches, to not do so is rude to those of us you
expect to apply your patch :(

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


Re: [PATCH] Staging rtlwifi efuse fix up a warning kzalloc

2017-08-28 Thread Dan Carpenter
Yeah...  I reviewed this code to see where
rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE] gets set and if it can be
controlled by the user.

It looks to me like it's only set when we declare rtl8822be_hal_cfg in
drivers/staging/rtlwifi/rtl8822be/sw.c so it's fine. I think it should
probably be a big struct instead of an array.

regards,
dan carpenter

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


Re: [PATCH] staging: lustre: constify cl_lock_operations

2017-08-28 Thread Greg KH
On Sun, Aug 27, 2017 at 11:35:27AM +0530, Arvind Yadav wrote:
> cl_lock_operations are not supposed to change at runtime.
> cl_lock_slice_add is working with const cl_lock_operations.
> So mark the non-const cl_lock_operations structs as const.
> 
> Signed-off-by: Arvind Yadav 
> ---
>  drivers/staging/lustre/lustre/obdecho/echo_client.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Someone else already sent this same patch in, and it's already applied
in my tree :(
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v1] staging: most: hdm_usb: Driver registration with module_driver macro

2017-08-28 Thread Andrey Shvetsov
On Sun, Aug 27, 2017 at 08:22:10AM +0300, Alex Briskin wrote:
> Register with module_driver macro instead of module_init/module_exit.
It must be the module_usb_driver. Also in the subject.

Hint: use the imperative sentence for the subject, like
"staging: most: hdm_usb: use module_usb_driver ..."

/andy

>
> Signed-off-by: Alex Briskin 
> ---
>  drivers/staging/most/hdm-usb/hdm_usb.c | 20 +---
>  1 file changed, 1 insertion(+), 19 deletions(-)
>
> diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
> b/drivers/staging/most/hdm-usb/hdm_usb.c
> index a9c3785d19ae..85775da293fb 100644
> --- a/drivers/staging/most/hdm-usb/hdm_usb.c
> +++ b/drivers/staging/most/hdm-usb/hdm_usb.c
> @@ -1301,25 +1301,7 @@ static struct usb_driver hdm_usb = {
>   .disconnect = hdm_disconnect,
>  };
>
> -static int __init hdm_usb_init(void)
> -{
> - pr_info("hdm_usb_init()\n");
> - if (usb_register(_usb)) {
> - pr_err("could not register hdm_usb driver\n");
> - return -EIO;
> - }
> -
> - return 0;
> -}
> -
> -static void __exit hdm_usb_exit(void)
> -{
> - pr_info("hdm_usb_exit()\n");
> - usb_deregister(_usb);
> -}
> -
> -module_init(hdm_usb_init);
> -module_exit(hdm_usb_exit);
> +module_usb_driver(hdm_usb);
>  MODULE_LICENSE("GPL");
>  MODULE_AUTHOR("Christian Gromm ");
>  MODULE_DESCRIPTION("HDM_4_USB");
> --
> 2.11.0
>
> ___
> devel mailing list
> de...@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtl8723bs: remove memset before memcpy

2017-08-28 Thread Himanshu Jha
On Mon, Aug 28, 2017 at 09:19:06AM +0300, Dan Carpenter wrote:
> On Mon, Aug 28, 2017 at 01:43:31AM +0530, Himanshu Jha wrote:
> > calling memcpy immediately after memset with the same region of memory
> > makes memset redundant.
> > 
> > Build successfully.
> > 
> 
> Thanks for the patch, it looks good.  You don't need to say that it
> builds successfully, because we already assume that's true.
> 
> > Signed-off-by: Himanshu Jha 
> > ---
> 
> Sometimes I put a comment here under the cut off line if I want people
> to know that I haven't tested a patch.
> 
> Anyway, don't resend the patch.  It's fine as-is (unless Greg
> complains) but it's just for future reference.

Thanks for the feedback and i will keep that in mind for future patches.
Himanshu Jha
> 
> regards,
> dan carpenter
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtl8723bs: remove memset before memcpy

2017-08-28 Thread Dan Carpenter
On Mon, Aug 28, 2017 at 01:43:31AM +0530, Himanshu Jha wrote:
> calling memcpy immediately after memset with the same region of memory
> makes memset redundant.
> 
> Build successfully.
> 

Thanks for the patch, it looks good.  You don't need to say that it
builds successfully, because we already assume that's true.

> Signed-off-by: Himanshu Jha 
> ---

Sometimes I put a comment here under the cut off line if I want people
to know that I haven't tested a patch.

Anyway, don't resend the patch.  It's fine as-is (unless Greg
complains) but it's just for future reference.

regards,
dan carpenter

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