Re: [greybus-dev] [PATCH v2] staging: greybus: Use gpio_is_valid()

2018-05-01 Thread Viresh Kumar
On 28-04-18, 10:05, Arvind Yadav wrote:
> Replace the manual validity checks for the GPIO with the
> gpio_is_valid().
> 
> Signed-off-by: Arvind Yadav 
> ---
> chnage in v2 :
>  Returning invalid gpio as error instead of -ENODEV.
> 
>  drivers/staging/greybus/arche-platform.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/greybus/arche-platform.c 
> b/drivers/staging/greybus/arche-platform.c
> index 83254a7..c3a7da5 100644
> --- a/drivers/staging/greybus/arche-platform.c
> +++ b/drivers/staging/greybus/arche-platform.c
> @@ -448,7 +448,7 @@ static int arche_platform_probe(struct platform_device 
> *pdev)
>   arche_pdata->svc_reset_gpio = of_get_named_gpio(np,
>   "svc,reset-gpio",
>   0);
> - if (arche_pdata->svc_reset_gpio < 0) {
> + if (!gpio_is_valid(arche_pdata->svc_reset_gpio)) {
>   dev_err(dev, "failed to get reset-gpio\n");
>   return arche_pdata->svc_reset_gpio;
>   }
> @@ -468,7 +468,7 @@ static int arche_platform_probe(struct platform_device 
> *pdev)
>   arche_pdata->svc_sysboot_gpio = of_get_named_gpio(np,
> "svc,sysboot-gpio",
> 0);
> - if (arche_pdata->svc_sysboot_gpio < 0) {
> + if (!gpio_is_valid(arche_pdata->svc_sysboot_gpio)) {
>   dev_err(dev, "failed to get sysboot gpio\n");
>   return arche_pdata->svc_sysboot_gpio;
>   }
> @@ -487,7 +487,7 @@ static int arche_platform_probe(struct platform_device 
> *pdev)
>   arche_pdata->svc_refclk_req = of_get_named_gpio(np,
>   "svc,refclk-req-gpio",
>   0);
> - if (arche_pdata->svc_refclk_req < 0) {
> + if (!gpio_is_valid(arche_pdata->svc_refclk_req)) {
>   dev_err(dev, "failed to get svc clock-req gpio\n");
>   return arche_pdata->svc_refclk_req;
>   }

Acked-by: Viresh Kumar 

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


Re: [PATCH] staging: wilc1000: fix infinite loop and out-of-bounds access

2018-05-01 Thread Ajay Singh
On Mon, 30 Apr 2018 18:23:21 +0300
Dan Carpenter  wrote:

> On Mon, Apr 30, 2018 at 07:59:16PM +0530, Ajay Singh wrote:
> > Reviewed-by: Ajay Singh 
> > 
> > On Mon, 30 Apr 2018 07:50:40 -0500
> > "Gustavo A. R. Silva"  wrote:
> >   
> > > If i < slot_id is initially true then it will remain true. Also,
> > > as i is being decremented it will end up accessing memory out of
> > > bounds.
> > > 
> > > Fix this by incrementing *i* instead of decrementing it.  
> > 
> > Nice catch!
> > Thanks for submitting the changes.
> >   
> > > 
> > > Addresses-Coverity-ID: 1468454 ("Infinite loop")
> > > Fixes: faa657641081 ("staging: wilc1000: refactor scan() to free
> > > kmalloc memory on failure cases")
> > > Signed-off-by: Gustavo A. R. Silva 
> > > ---
> > > 
> > > BTW... at first sight it seems to me that variables slot_id
> > > and i should be of type unsigned instead of signed.  
> > 
> > Yes, 'slot_id' & 'i' can be changed to unsigned int.
> >   
> 
> A lot of people think making things unsigned improves the code but I
> hate "unsigned int i"...  I understand that in certain cases we do
> loop more than INT_MAX but those are a tiny tiny minority of loops.
> 
> Simple types like "int" are more readable than complicated types
> like "unsigned int".  Unsigned int just draws attention to itself
> and distracts people from things that might potentially matter.  We
> have real life subtle loops like in xtea_encrypt() where we need to
> use unsigned types.
> 
> And look at the function we're talking about here:
> 
> drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
>577  static inline int
>578  wilc_wfi_cfg_alloc_fill_ssid(struct cfg80211_scan_request
> *request, 579   struct hidden_network
> *ntwk) 580  {
>581  int i;
>582  int slot_id = 0;
>583  
>584  ntwk->net_info = kcalloc(request->n_ssids,
>585   sizeof(struct
> hidden_network), GFP_KERNEL); 586  if (!ntwk->net_info)
>587  goto out;
>588  
>589  ntwk->n_ssids = request->n_ssids;
>590  
>591  for (i = 0; i < request->n_ssids; i++) {
> 
> request->n_ssids is an int.  It can't possibly be INT_MAX because
> the kcalloc() will fail.  Ideally the static analysis tool should
> be able to tell you that if you seed it with the knowledge of how
> much memory it's possible to kmalloc().  So it's just laziness here
> is why the static checker complains, it should see there is no
> issue.  Smatch fails here as well but I'll see if I can fix it.
> 
> Anyway let's say it could be negative then 0 is greater than
> negative values so the loop would be a no-op.  I've seen code where
> the user could set the loop bounds to s32min-4 but because it was
> "int i" instead of "unsigned int i" then it meant the loop was a
> no-op instead of being a security problem.  In other words,
> unsigned can be less secure.
> 
> I honestly have never seen a bug in the kernel where we intended to
> loop more than INT_MAX times, but there was a signedness bug
> preventing it. That's the only reason I can see to change the
> signedness.  Am I missing something?
> 

Hi Dan,

Thanks for providing the detailed explanation.

I understand your point, but what's your opinion about variable
'slot_id', as this variable is added to take only the positive
value(i.e from 0 to maximum number of filled elements), so for more
readability should we keep it same.

BTW in my opinion 'request->n_ssids' should have been unsigned
because it is suppose to hold only positive values along with 
smaller data type(may be u8 or u16, as the range might be enough to
hold the value of n_ssids). So we have advantage of size reduction
not just the increase in value range.

Suppose we get negative value for "request->n_ssids" & kmalloc is 
pass then we have to add some more extra code to free data and
return error code in wilc_wfi_cfg_alloc_fill_ssid(). In your opinion
should this condition be handled as the received 'request->n_ssids' is
of 'int' type.


Regards,
Ajay

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


[PATCH] staging: lustre: o2iblnd: fix race at kiblnd_connect_peer

2018-05-01 Thread Doug Oucharek
From: Doug Oucahrek 

cmid will be destroyed at OFED if kiblnd_cm_callback return error.
if error happen before the end of kiblnd_connect_peer, it will touch
destroyed cmid and fail as
(o2iblnd_cb.c:1315:kiblnd_connect_peer())
ASSERTION( cmid->device != ((void *)0) ) failed:

Signed-off-by: Alexander Boyko 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-10015
Reviewed-by: Alexey Lyashkov 
Reviewed-by: Doug Oucharek 
Reviewed-by: John L. Hammond 
Signed-off-by: Doug Oucharek 
---
 drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c 
b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
index b4a182d..a76c1f2 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
@@ -1290,11 +1290,6 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid,
goto failed2;
}
 
-   LASSERT(cmid->device);
-   CDEBUG(D_NET, "%s: connection bound to %s:%pI4h:%s\n",
-  libcfs_nid2str(peer->ibp_nid), dev->ibd_ifname,
-  &dev->ibd_ifip, cmid->device->name);
-
return;
 
  failed2:
@@ -2996,8 +2991,19 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid,
} else {
rc = rdma_resolve_route(
cmid, *kiblnd_tunables.kib_timeout * 1000);
-   if (!rc)
+   if (!rc) {
+   struct kib_net *net = peer->ibp_ni->ni_data;
+   struct kib_dev *dev = net->ibn_dev;
+
+   CDEBUG(D_NET, "%s: connection bound to "\
+  "%s:%pI4h:%s\n",
+  libcfs_nid2str(peer->ibp_nid),
+  dev->ibd_ifname,
+  &dev->ibd_ifip, cmid->device->name);
+
return 0;
+   }
+
/* Can't initiate route resolution */
CERROR("Can't resolve route for %s: %d\n",
   libcfs_nid2str(peer->ibp_nid), rc);
-- 
1.8.3.1

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


[PATCH] staging: lustre: o2iblnd: Fix FastReg map/unmap for MLX5

2018-05-01 Thread Doug Oucharek
The FastReg support in ko2iblnd was not unmapping pool items
causing the items to leak.  In addition, the mapping code
is not growing the pool like we do with FMR.

This patch makes sure we are unmapping FastReg pool elements
when we are done with them.  It also makes sure the pool
will grow when we depleat the pool.

Signed-off-by: Doug Oucharek 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9472
Reviewed-on: https://review.whamcloud.com/27015
Reviewed-by: Andrew Perepechko 
Reviewed-by: Dmitry Eremin 
Reviewed-by: James Simmons 
Reviewed-by: Oleg Drokin 
Signed-off-by: Doug Oucharek 
---
 drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c|  2 +-
 drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 12 
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c 
b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
index 959e119..cace9ba 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
@@ -1702,7 +1702,7 @@ int kiblnd_fmr_pool_map(struct kib_fmr_poolset *fps, 
struct kib_tx *tx,
return 0;
}
spin_unlock(&fps->fps_lock);
-   rc = -EBUSY;
+   rc = -EAGAIN;
}
 
spin_lock(&fps->fps_lock);
diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c 
b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
index b4a182d..f245481 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
@@ -48,7 +48,7 @@ static int kiblnd_init_rdma(struct kib_conn *conn, struct 
kib_tx *tx, int type,
__u64 dstcookie);
 static void kiblnd_queue_tx_locked(struct kib_tx *tx, struct kib_conn *conn);
 static void kiblnd_queue_tx(struct kib_tx *tx, struct kib_conn *conn);
-static void kiblnd_unmap_tx(struct lnet_ni *ni, struct kib_tx *tx);
+static void kiblnd_unmap_tx(struct kib_tx *tx);
 static void kiblnd_check_sends_locked(struct kib_conn *conn);
 
 static void
@@ -66,7 +66,7 @@ static int kiblnd_init_rdma(struct kib_conn *conn, struct 
kib_tx *tx, int type,
LASSERT(!tx->tx_waiting); /* mustn't be awaiting peer 
response */
LASSERT(tx->tx_pool);
 
-   kiblnd_unmap_tx(ni, tx);
+   kiblnd_unmap_tx(tx);
 
/* tx may have up to 2 lnet msgs to finalise */
lntmsg[0] = tx->tx_lntmsg[0]; tx->tx_lntmsg[0] = NULL;
@@ -591,13 +591,9 @@ static int kiblnd_init_rdma(struct kib_conn *conn, struct 
kib_tx *tx, int type,
return 0;
 }
 
-static void kiblnd_unmap_tx(struct lnet_ni *ni, struct kib_tx *tx)
+static void kiblnd_unmap_tx(struct kib_tx *tx)
 {
-   struct kib_net *net = ni->ni_data;
-
-   LASSERT(net);
-
-   if (net->ibn_fmr_ps)
+   if (tx->fmr.fmr_pfmr || tx->fmr.fmr_frd)
kiblnd_fmr_pool_unmap(&tx->fmr, tx->tx_status);
 
if (tx->tx_nfrags) {
-- 
1.8.3.1

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


[PATCH] staging: lustre: o2iblnd: Enable Multiple OPA Endpoints between Nodes

2018-05-01 Thread Doug Oucharek
OPA driver optimizations are based on the MPI model where it is
expected to have multiple endpoints between two given nodes. To
enable this optimization for Lustre, we need to make it possible,
via an LND-specific tuneable, to create multiple endpoints and to
balance the traffic over them.

Both sides of a connection must have this patch for it to work.
Only the active side of the connection (usually the client)
needs to have the new tuneable set > 1.

Signed-off-by: Doug Oucharek 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8943
Reviewed-on: https://review.whamcloud.com/25168
Reviewed-by: Amir Shehata 
Reviewed-by: Dmitry Eremin 
Reviewed-by: James Simmons 
Reviewed-by: Oleg Drokin 
Signed-off-by: Doug Oucharek 
---
 .../lustre/include/uapi/linux/lnet/lnet-dlc.h  |  3 ++-
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h| 17 ---
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 25 +++---
 .../lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c  |  9 
 4 files changed, 42 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/lustre/include/uapi/linux/lnet/lnet-dlc.h 
b/drivers/staging/lustre/include/uapi/linux/lnet/lnet-dlc.h
index e45d828..c1619f4 100644
--- a/drivers/staging/lustre/include/uapi/linux/lnet/lnet-dlc.h
+++ b/drivers/staging/lustre/include/uapi/linux/lnet/lnet-dlc.h
@@ -53,7 +53,8 @@ struct lnet_ioctl_config_o2iblnd_tunables {
__u32 lnd_fmr_pool_size;
__u32 lnd_fmr_flush_trigger;
__u32 lnd_fmr_cache;
-   __u32 pad;
+   __u16 lnd_conns_per_peer;
+   __u16 pad;
 };
 
 struct lnet_ioctl_config_lnd_tunables {
diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h 
b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
index ca6e09d..da8929d 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
@@ -568,6 +568,8 @@ struct kib_peer {
lnet_nid_t   ibp_nid; /* who's on the other end(s) */
struct lnet_ni  *ibp_ni; /* LNet interface */
struct list_head ibp_conns;   /* all active connections */
+   struct kib_conn *ibp_next_conn;  /* next connection to send on for
+   round robin */
struct list_head ibp_tx_queue;/* msgs waiting for a conn */
__u64ibp_incarnation; /* incarnation of peer */
/* when (in jiffies) I was last alive */
@@ -581,7 +583,7 @@ struct kib_peer {
/* current active connection attempts */
unsigned short  ibp_connecting;
/* reconnect this peer later */
-   unsigned short  ibp_reconnecting:1;
+   unsigned char   ibp_reconnecting;
/* counter of how many times we triggered a conn race */
unsigned char   ibp_races;
/* # consecutive reconnection attempts to this peer */
@@ -744,10 +746,19 @@ struct kib_peer {
 static inline struct kib_conn *
 kiblnd_get_conn_locked(struct kib_peer *peer)
 {
+   struct list_head *next;
+
LASSERT(!list_empty(&peer->ibp_conns));
 
-   /* just return the first connection */
-   return list_entry(peer->ibp_conns.next, struct kib_conn, ibc_list);
+   /* Advance to next connection, be sure to skip the head node */
+   if (!peer->ibp_next_conn ||
+   peer->ibp_next_conn->ibc_list.next == &peer->ibp_conns)
+   next = peer->ibp_conns.next;
+   else
+   next = peer->ibp_next_conn->ibc_list.next;
+   peer->ibp_next_conn = list_entry(next, struct kib_conn, ibc_list);
+
+   return peer->ibp_next_conn;
 }
 
 static inline int
diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c 
b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
index b4a182d..303e4e1 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
@@ -1250,7 +1250,6 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid,
 
LASSERT(net);
LASSERT(peer->ibp_connecting > 0);
-   LASSERT(!peer->ibp_reconnecting);
 
cmid = kiblnd_rdma_create_id(kiblnd_cm_callback, peer, RDMA_PS_TCP,
 IB_QPT_RC);
@@ -1332,7 +1331,7 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid,
 
LASSERT(!peer->ibp_accepting && !peer->ibp_connecting &&
list_empty(&peer->ibp_conns));
-   peer->ibp_reconnecting = 0;
+   peer->ibp_reconnecting--;
 
if (!kiblnd_peer_active(peer)) {
list_splice_init(&peer->ibp_tx_queue, &txs);
@@ -1365,6 +1364,8 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid,
rwlock_t *g_lock = &kiblnd_data.kib_global_lock;
unsigned long flags;
int rc;
+   inti;
+   struct lnet_ioctl_config_o2iblnd_tunables *tunables;
 
/*
 * If I get here, I've committed to send, so I complete the tx with
@

[PATCH] staging: speakup: Add pause command used on switching to graphical mode

2018-05-01 Thread Samuel Thibault
For software speech syntheses to be able to manage concurrent audio card
access, they need to know when speakup stops emitting text to be spoken
because the console has switched to graphical mode.  This introduces a
PAUSE command to do so.

Signed-off-by: Samuel Thibault 

Index: linux-4.15/drivers/staging/speakup/speakup_dummy.c
===
--- linux-4.15.orig/drivers/staging/speakup/speakup_dummy.c
+++ linux-4.15/drivers/staging/speakup/speakup_dummy.c
@@ -30,6 +30,7 @@
 static struct var_t vars[] = {
{ CAPS_START, .u.s = {"CAPS_START\n" } },
{ CAPS_STOP, .u.s = {"CAPS_STOP\n" } },
+   { PAUSE, .u.s = {"PAUSE\n"} },
{ RATE, .u.n = {"RATE %d\n", 8, 1, 16, 0, 0, NULL } },
{ PITCH, .u.n = {"PITCH %d\n", 8, 0, 16, 0, 0, NULL } },
{ VOL, .u.n = {"VOL %d\n", 8, 0, 16, 0, 0, NULL } },
Index: linux-4.15/drivers/staging/speakup/speakup_soft.c
===
--- linux-4.15.orig/drivers/staging/speakup/speakup_soft.c
+++ linux-4.15/drivers/staging/speakup/speakup_soft.c
@@ -45,6 +45,7 @@ static int misc_registered;
 static struct var_t vars[] = {
{ CAPS_START, .u.s = {"\x01+3p" } },
{ CAPS_STOP, .u.s = {"\x01-3p" } },
+   { PAUSE, .u.n = {"\x01P" } },
{ RATE, .u.n = {"\x01%ds", 2, 0, 9, 0, 0, NULL } },
{ PITCH, .u.n = {"\x01%dp", 5, 0, 9, 0, 0, NULL } },
{ VOL, .u.n = {"\x01%dv", 5, 0, 9, 0, 0, NULL } },
@@ -164,7 +165,7 @@ static char *get_initstring(void)
var = synth_soft.vars;
while (var->var_id != MAXVARS) {
if (var->var_id != CAPS_START && var->var_id != CAPS_STOP &&
-   var->var_id != DIRECT)
+   var->var_id != PAUSE && var->var_id != DIRECT)
cp = cp + sprintf(cp, var->u.n.synth_fmt,
  var->u.n.value);
var++;
Index: linux-4.15/drivers/staging/speakup/spk_types.h
===
--- linux-4.15.orig/drivers/staging/speakup/spk_types.h
+++ linux-4.15/drivers/staging/speakup/spk_types.h
@@ -42,7 +42,7 @@ enum var_id_t {
SAY_CONTROL, SAY_WORD_CTL, NO_INTERRUPT, KEY_ECHO,
SPELL_DELAY, PUNC_LEVEL, READING_PUNC,
ATTRIB_BLEEP, BLEEPS,
-   RATE, PITCH, VOL, TONE, PUNCT, VOICE, FREQUENCY, LANG, DIRECT,
+   RATE, PITCH, VOL, TONE, PUNCT, VOICE, FREQUENCY, LANG, DIRECT, PAUSE,
CAPS_START, CAPS_STOP, CHARTAB,
MAXVARS
 };
Index: linux-4.15/drivers/staging/speakup/varhandlers.c
===
--- linux-4.15.orig/drivers/staging/speakup/varhandlers.c
+++ linux-4.15/drivers/staging/speakup/varhandlers.c
@@ -44,6 +44,7 @@ static struct st_var_header var_headers[
{ "lang", LANG, VAR_NUM, NULL, NULL },
{ "chartab", CHARTAB, VAR_PROC, NULL, NULL },
{ "direct", DIRECT, VAR_NUM, NULL, NULL },
+   { "pause", PAUSE, VAR_STRING, spk_str_pause, NULL },
 };
 
 static struct st_var_header *var_ptrs[MAXVARS] = { NULL, NULL, NULL };
Index: linux-4.15/drivers/staging/speakup/main.c
===
--- linux-4.15.orig/drivers/staging/speakup/main.c
+++ linux-4.15/drivers/staging/speakup/main.c
@@ -76,6 +76,8 @@ short spk_punc_mask;
 int spk_punc_level, spk_reading_punc;
 char spk_str_caps_start[MAXVARLEN + 1] = "\0";
 char spk_str_caps_stop[MAXVARLEN + 1] = "\0";
+char spk_str_pause[MAXVARLEN + 1] = "\0";
+bool spk_paused = 0;
 const struct st_bits_data spk_punc_info[] = {
{"none", "", 0},
{"some", "/$%&@", SOME},
@@ -1789,6 +1791,11 @@ static void speakup_con_update(struct vc
/* Speakup output, discard */
return;
speakup_date(vc);
+   if (vc->vc_mode == KD_GRAPHICS && !spk_paused && spk_str_pause[0])
+   {
+   synth_printf("%s", spk_str_pause);
+   spk_paused = 1;
+   }
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
 }
 
Index: linux-4.15/drivers/staging/speakup/speakup.h
===
--- linux-4.15.orig/drivers/staging/speakup/speakup.h
+++ linux-4.15/drivers/staging/speakup/speakup.h
@@ -94,7 +94,8 @@ extern struct spk_synth *synth;
 extern char spk_pitch_buff[];
 extern u_char *spk_our_keys[];
 extern short spk_punc_masks[];
-extern char spk_str_caps_start[], spk_str_caps_stop[];
+extern char spk_str_caps_start[], spk_str_caps_stop[], spk_str_pause[];
+extern bool spk_paused;
 extern const struct st_bits_data spk_punc_info[];
 extern u_char spk_key_buf[600];
 extern char *spk_characters[];
Index: linux-4.15/drivers/staging/speakup/buffers.c
===
--- linux-4.15.orig/drivers/staging/speakup/buffers.c
+++ linux-4.15/drivers/staging/speakup/buffers.c
@@ -76,

Re: [PATCH] staging: speakup: Add pause command used on switching to graphical mode

2018-05-01 Thread Samuel Thibault
For software speech syntheses to be able to manage concurrent audio card
access, they need to know when speakup stops emitting text to be spoken
because the console has switched to graphical mode.  This introduces a
PAUSE command to do so.

Signed-off-by: Samuel Thibault 

Index: linux-4.15/drivers/staging/speakup/speakup_dummy.c
===
--- linux-4.15.orig/drivers/staging/speakup/speakup_dummy.c
+++ linux-4.15/drivers/staging/speakup/speakup_dummy.c
@@ -30,6 +30,7 @@
 static struct var_t vars[] = {
{ CAPS_START, .u.s = {"CAPS_START\n" } },
{ CAPS_STOP, .u.s = {"CAPS_STOP\n" } },
+   { PAUSE, .u.s = {"PAUSE\n"} },
{ RATE, .u.n = {"RATE %d\n", 8, 1, 16, 0, 0, NULL } },
{ PITCH, .u.n = {"PITCH %d\n", 8, 0, 16, 0, 0, NULL } },
{ VOL, .u.n = {"VOL %d\n", 8, 0, 16, 0, 0, NULL } },
Index: linux-4.15/drivers/staging/speakup/speakup_soft.c
===
--- linux-4.15.orig/drivers/staging/speakup/speakup_soft.c
+++ linux-4.15/drivers/staging/speakup/speakup_soft.c
@@ -45,6 +45,7 @@ static int misc_registered;
 static struct var_t vars[] = {
{ CAPS_START, .u.s = {"\x01+3p" } },
{ CAPS_STOP, .u.s = {"\x01-3p" } },
+   { PAUSE, .u.n = {"\x01P" } },
{ RATE, .u.n = {"\x01%ds", 2, 0, 9, 0, 0, NULL } },
{ PITCH, .u.n = {"\x01%dp", 5, 0, 9, 0, 0, NULL } },
{ VOL, .u.n = {"\x01%dv", 5, 0, 9, 0, 0, NULL } },
@@ -164,7 +165,7 @@ static char *get_initstring(void)
var = synth_soft.vars;
while (var->var_id != MAXVARS) {
if (var->var_id != CAPS_START && var->var_id != CAPS_STOP &&
-   var->var_id != DIRECT)
+   var->var_id != PAUSE && var->var_id != DIRECT)
cp = cp + sprintf(cp, var->u.n.synth_fmt,
  var->u.n.value);
var++;
Index: linux-4.15/drivers/staging/speakup/spk_types.h
===
--- linux-4.15.orig/drivers/staging/speakup/spk_types.h
+++ linux-4.15/drivers/staging/speakup/spk_types.h
@@ -42,7 +42,7 @@ enum var_id_t {
SAY_CONTROL, SAY_WORD_CTL, NO_INTERRUPT, KEY_ECHO,
SPELL_DELAY, PUNC_LEVEL, READING_PUNC,
ATTRIB_BLEEP, BLEEPS,
-   RATE, PITCH, VOL, TONE, PUNCT, VOICE, FREQUENCY, LANG, DIRECT,
+   RATE, PITCH, VOL, TONE, PUNCT, VOICE, FREQUENCY, LANG, DIRECT, PAUSE,
CAPS_START, CAPS_STOP, CHARTAB,
MAXVARS
 };
Index: linux-4.15/drivers/staging/speakup/varhandlers.c
===
--- linux-4.15.orig/drivers/staging/speakup/varhandlers.c
+++ linux-4.15/drivers/staging/speakup/varhandlers.c
@@ -44,6 +44,7 @@ static struct st_var_header var_headers[
{ "lang", LANG, VAR_NUM, NULL, NULL },
{ "chartab", CHARTAB, VAR_PROC, NULL, NULL },
{ "direct", DIRECT, VAR_NUM, NULL, NULL },
+   { "pause", PAUSE, VAR_STRING, spk_str_pause, NULL },
 };
 
 static struct st_var_header *var_ptrs[MAXVARS] = { NULL, NULL, NULL };
Index: linux-4.15/drivers/staging/speakup/main.c
===
--- linux-4.15.orig/drivers/staging/speakup/main.c
+++ linux-4.15/drivers/staging/speakup/main.c
@@ -76,6 +76,8 @@ short spk_punc_mask;
 int spk_punc_level, spk_reading_punc;
 char spk_str_caps_start[MAXVARLEN + 1] = "\0";
 char spk_str_caps_stop[MAXVARLEN + 1] = "\0";
+char spk_str_pause[MAXVARLEN + 1] = "\0";
+bool spk_paused = 0;
 const struct st_bits_data spk_punc_info[] = {
{"none", "", 0},
{"some", "/$%&@", SOME},
@@ -1789,6 +1791,11 @@ static void speakup_con_update(struct vc
/* Speakup output, discard */
return;
speakup_date(vc);
+   if (vc->vc_mode == KD_GRAPHICS && !spk_paused && spk_str_pause[0])
+   {
+   synth_printf("%s", spk_str_pause);
+   spk_paused = 1;
+   }
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
 }
 
Index: linux-4.15/drivers/staging/speakup/speakup.h
===
--- linux-4.15.orig/drivers/staging/speakup/speakup.h
+++ linux-4.15/drivers/staging/speakup/speakup.h
@@ -94,7 +94,8 @@ extern struct spk_synth *synth;
 extern char spk_pitch_buff[];
 extern u_char *spk_our_keys[];
 extern short spk_punc_masks[];
-extern char spk_str_caps_start[], spk_str_caps_stop[];
+extern char spk_str_caps_start[], spk_str_caps_stop[], spk_str_pause[];
+extern bool spk_paused;
 extern const struct st_bits_data spk_punc_info[];
 extern u_char spk_key_buf[600];
 extern char *spk_characters[];
Index: linux-4.15/drivers/staging/speakup/buffers.c
===
--- linux-4.15.orig/drivers/staging/speakup/buffers.c
+++ linux-4.15/drivers/staging/speakup/buffers.c
@@ -76,

Patch "staging: bcm2835-audio: Release resources on module_exit()" has been added to the 4.14-stable tree

2018-05-01 Thread gregkh

This is a note to let you know that I've just added the patch titled

staging: bcm2835-audio: Release resources on module_exit()

to the 4.14-stable tree which can be found at:

http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
 staging-bcm2835-audio-release-resources-on-module_exit.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let  know about it.


>From foo@baz Tue May  1 16:18:20 PDT 2018
From: Kirill Marinushkin 
Date: Fri, 23 Mar 2018 20:32:54 +0100
Subject: staging: bcm2835-audio: Release resources on module_exit()

From: Kirill Marinushkin 

[ Upstream commit 626118b472d2eb45f83a0276a18d3e6a01c69f6a ]

In the current implementation, `rmmod snd_bcm2835` does not release
resources properly. It causes an oops when trying to list sound devices.

This commit fixes it.

The details WRT allocation / free are described below.

Device structure WRT allocation:

pdev
  \childdev[]
\card
  \chip
\pcm
\ctl

Allocation / register sequence:

* childdev: devm_kzalloc  - freed during driver detach
* childdev: device_initialize - freed during device_unregister
* pdev: devres_alloc  - freed during driver detach
* childdev: device_add- removed during device_unregister
* pdev, childdev: devres_add  - freed during driver detach
* card: snd_card_new  - freed during snd_card_free
* chip: kzalloc   - freed during kfree
* card, chip: snd_device_new  - freed during snd_device_free
* chip: new_pcm   - TODO: free pcm
* chip: new_ctl   - TODO: free ctl
* card: snd_card_register - unregistered during snd_card_free

Free / unregister sequence:

* card: snd_card_free
* card, chip: snd_device_free
* childdev: device_unregister
* chip: kfree

Steps to reproduce the issue before this commit:


$ rmmod snd_bcm2835
$ aplay -L
[  138.648130] Unable to handle kernel paging request at virtual address 
7f1343c0
[  138.660415] pgd = ad8f
[  138.665567] [7f1343c0] *pgd=3864c811, *pte=, *ppte=
[  138.674887] Internal error: Oops: 7 [#1] SMP ARM
[  138.683571] Modules linked in: sha256_generic cfg80211 rfkill snd_pcm 
snd_timer
 snd fixed uio_pdrv_genirq uio ip_tables x_tables ipv6 [last unloaded: 
snd_bcm2835
]
[  138.706594] CPU: 3 PID: 463 Comm: aplay Tainted: GWC   
4.15.0-rc1-v
7+ #6
[  138.719833] Hardware name: BCM2835
[  138.726016] task: b877ac00 task.stack: aebec000
[  138.733408] PC is at try_module_get+0x38/0x24c
[  138.740813] LR is at snd_ctl_open+0x58/0x194 [snd]
[  138.748485] pc : [<801c4d5c>]lr : [<7f0e6b2c>]psr: 2013
[  138.757709] sp : aebedd60  ip : aebedd88  fp : aebedd84
[  138.765884] r10:   r9 : 0004  r8 : 7f0ed440
[  138.774040] r7 : b7e469b0  r6 : 7f0e6b2c  r5 : afd91900  r4 : 7f1343c0
[  138.783571] r3 : aebec000  r2 : 0001  r1 : b877ac00  r0 : 7f1343c0
[  138.793084] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[  138.803300] Control: 10c5387d  Table: 2d8f006a  DAC: 0055
[  138.812064] Process aplay (pid: 463, stack limit = 0xaebec210)
[  138.820868] Stack: (0xaebedd60 to 0xaebee000)
[  138.828207] dd60:  b848d000 afd91900  b7e469b0 7f0ed440 
aebedda4 aebedd88
[  138.842371] dd80: 7f0e6b2c 801c4d30 afd91900 7f0ea4dc  b7e469b0 
aebeddcc aebedda8
[  138.856611] dda0: 7f0e250c 7f0e6ae0 7f0e2464 b8478ec0 b7e469b0 afd91900 
7f0ea388 
[  138.870864] ddc0: aebeddf4 aebeddd0 802ce590 7f0e2470 8090ab64 afd91900 
afd91900 b7e469b0
[  138.885301] dde0: afd91908 802ce4e4 aebede1c aebeddf8 802c57b4 802ce4f0 
afd91900 aebedea8
[  138.900110] de00: b7fa4c00   0004 aebede3c aebede20 
802c6ba8 802c56b4
[  138.915260] de20: aebedea8  aebedf5c  aebedea4 aebede40 
802d9a68 802c6b58
[  138.930661] de40: b874ddd0   0001 0041  
afd91900 aebede70
[  138.946402] de60:   0002 b7e469b0 b8a87610 b8d6ab80 
801852f8 0008
[  138.962314] de80: aebedf5c aebedea8 0001 80108464 aebec000  
aebedf4c aebedea8
[  138.978414] dea0: 802dacd4 802d970c b8a87610 b8d6ab80 a7982bc6 0009 
af363019 b9231480
[  138.994617] dec0:  b8c038a0 b7e469b0 0101 0002 0238 
 
[  139.010823] dee0:  aebedee8 0008 000f aebedf3c aebedf00 
802ed7e4 80843f94
[  139.027025] df00: 0003 0008 b9231490 b9231480  0008 
af363000 
[  139.043229] df20: 0005 0002 ff9c  0008 ff9c 
af363000 0003
[  139.059430] df40: aebedf94 aebedf50 802c6f70 802dac70 aebec000  
0001 
[  139.075629] df60: 0002 0004 0100 0001 7ebe577c 0002e038 
 0005
[  139.091828] df80: 80108464 aebec000 aebedfa4 aebedf98 802c7060 802c6e6c 
 aebedfa8
[  139.108025] dfa0: 801082c0 8

[PATCH] doc: fix sysfs ABI documentation

2018-05-01 Thread Stephen Hemminger
In 4.9 kernel, the sysfs files for Hyper-V VMBus changed name but
the documentation files were not updated. The current sysfs file
names are /sys/bus/vmbus/devices//...

See commit 9a56e5d6a0ba ("Drivers: hv: make VMBus bus ids persistent")
and commit f6b2db084b65 ("vmbus: make sysfs names consistent with PCI")

Reported-by: Michael Kelley 
Signed-off-by: Stephen Hemminger 
---
 Documentation/ABI/stable/sysfs-bus-vmbus | 40 
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/Documentation/ABI/stable/sysfs-bus-vmbus 
b/Documentation/ABI/stable/sysfs-bus-vmbus
index 0c9d9dcd2151..3eaffbb2d468 100644
--- a/Documentation/ABI/stable/sysfs-bus-vmbus
+++ b/Documentation/ABI/stable/sysfs-bus-vmbus
@@ -1,25 +1,25 @@
-What:  /sys/bus/vmbus/devices/vmbus_*/id
+What:  /sys/bus/vmbus/devices//id
 Date:  Jul 2009
 KernelVersion: 2.6.31
 Contact:   K. Y. Srinivasan 
 Description:   The VMBus child_relid of the device's primary channel
 Users: tools/hv/lsvmbus
 
-What:  /sys/bus/vmbus/devices/vmbus_*/class_id
+What:  /sys/bus/vmbus/devices//class_id
 Date:  Jul 2009
 KernelVersion: 2.6.31
 Contact:   K. Y. Srinivasan 
 Description:   The VMBus interface type GUID of the device
 Users: tools/hv/lsvmbus
 
-What:  /sys/bus/vmbus/devices/vmbus_*/device_id
+What:  /sys/bus/vmbus/devices//device_id
 Date:  Jul 2009
 KernelVersion: 2.6.31
 Contact:   K. Y. Srinivasan 
 Description:   The VMBus interface instance GUID of the device
 Users: tools/hv/lsvmbus
 
-What:  /sys/bus/vmbus/devices/vmbus_*/channel_vp_mapping
+What:  /sys/bus/vmbus/devices//channel_vp_mapping
 Date:  Jul 2015
 KernelVersion: 4.2.0
 Contact:   K. Y. Srinivasan 
@@ -28,112 +28,112 @@ Description:  The mapping of which primary/sub 
channels are bound to which
Format: 
 Users: tools/hv/lsvmbus
 
-What:  /sys/bus/vmbus/devices/vmbus_*/device
+What:  /sys/bus/vmbus/devices//device
 Date:  Dec. 2015
 KernelVersion: 4.5
 Contact:   K. Y. Srinivasan 
 Description:   The 16 bit device ID of the device
 Users: tools/hv/lsvmbus and user level RDMA libraries
 
-What:  /sys/bus/vmbus/devices/vmbus_*/vendor
+What:  /sys/bus/vmbus/devices//vendor
 Date:  Dec. 2015
 KernelVersion: 4.5
 Contact:   K. Y. Srinivasan 
 Description:   The 16 bit vendor ID of the device
 Users: tools/hv/lsvmbus and user level RDMA libraries
 
-What:  /sys/bus/vmbus/devices/vmbus_*/channels/NN
+What:  /sys/bus/vmbus/devices//channels/
 Date:  September. 2017
 KernelVersion: 4.14
 Contact:   Stephen Hemminger 
 Description:   Directory for per-channel information
NN is the VMBUS relid associtated with the channel.
 
-What:  /sys/bus/vmbus/devices/vmbus_*/channels/NN/cpu
+What:  /sys/bus/vmbus/devices//channels//cpu
 Date:  September. 2017
 KernelVersion: 4.14
 Contact:   Stephen Hemminger 
 Description:   VCPU (sub)channel is affinitized to
 Users: tools/hv/lsvmbus and other debugging tools
 
-What:  /sys/bus/vmbus/devices/vmbus_*/channels/NN/cpu
+What:  /sys/bus/vmbus/devices//channels//cpu
 Date:  September. 2017
 KernelVersion: 4.14
 Contact:   Stephen Hemminger 
 Description:   VCPU (sub)channel is affinitized to
 Users: tools/hv/lsvmbus and other debugging tools
 
-What:  /sys/bus/vmbus/devices/vmbus_*/channels/NN/in_mask
+What:  /sys/bus/vmbus/devices//channels//in_mask
 Date:  September. 2017
 KernelVersion: 4.14
 Contact:   Stephen Hemminger 
 Description:   Host to guest channel interrupt mask
 Users: Debugging tools
 
-What:  /sys/bus/vmbus/devices/vmbus_*/channels/NN/latency
+What:  /sys/bus/vmbus/devices//channels//latency
 Date:  September. 2017
 KernelVersion: 4.14
 Contact:   Stephen Hemminger 
 Description:   Channel signaling latency
 Users: Debugging tools
 
-What:  /sys/bus/vmbus/devices/vmbus_*/channels/NN/out_mask
+What:  /sys/bus/vmbus/devices//channels//out_mask
 Date:  September. 2017
 KernelVersion: 4.14
 Contact:   Stephen Hemminger 
 Description:   Guest to host channel interrupt mask
 Users: Debugging tools
 
-What:  /sys/bus/vmbus/devices/vmbus_*/channels/NN/pending
+What:  /sys/bus/vmbus/devices//channels//pending
 Date:  September. 2017
 KernelVersion: 4.14
 Contact:   Stephen Hemminger 
 Description:   Channel interrupt pending state
 Users: Debugging tools
 
-What:  /sys/bus/vmbus/devices/vmbus_*/channels/NN/read_avail
+What:  /sys/bus/vmbus/devices//channels//read_avail
 Date:  September. 2017
 KernelVersion: 4.14
 Contact:   Stephen Hemminger 
 Description:   Bytes available to read
 Users: Debugging tool

Patch "staging: bcm2835-audio: Release resources on module_exit()" has been added to the 4.16-stable tree

2018-05-01 Thread gregkh

This is a note to let you know that I've just added the patch titled

staging: bcm2835-audio: Release resources on module_exit()

to the 4.16-stable tree which can be found at:

http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
 staging-bcm2835-audio-release-resources-on-module_exit.patch
and it can be found in the queue-4.16 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let  know about it.


>From foo@baz Tue May  1 14:59:17 PDT 2018
From: Kirill Marinushkin 
Date: Fri, 23 Mar 2018 20:32:54 +0100
Subject: staging: bcm2835-audio: Release resources on module_exit()

From: Kirill Marinushkin 

[ Upstream commit 626118b472d2eb45f83a0276a18d3e6a01c69f6a ]

In the current implementation, `rmmod snd_bcm2835` does not release
resources properly. It causes an oops when trying to list sound devices.

This commit fixes it.

The details WRT allocation / free are described below.

Device structure WRT allocation:

pdev
  \childdev[]
\card
  \chip
\pcm
\ctl

Allocation / register sequence:

* childdev: devm_kzalloc  - freed during driver detach
* childdev: device_initialize - freed during device_unregister
* pdev: devres_alloc  - freed during driver detach
* childdev: device_add- removed during device_unregister
* pdev, childdev: devres_add  - freed during driver detach
* card: snd_card_new  - freed during snd_card_free
* chip: kzalloc   - freed during kfree
* card, chip: snd_device_new  - freed during snd_device_free
* chip: new_pcm   - TODO: free pcm
* chip: new_ctl   - TODO: free ctl
* card: snd_card_register - unregistered during snd_card_free

Free / unregister sequence:

* card: snd_card_free
* card, chip: snd_device_free
* childdev: device_unregister
* chip: kfree

Steps to reproduce the issue before this commit:


$ rmmod snd_bcm2835
$ aplay -L
[  138.648130] Unable to handle kernel paging request at virtual address 
7f1343c0
[  138.660415] pgd = ad8f
[  138.665567] [7f1343c0] *pgd=3864c811, *pte=, *ppte=
[  138.674887] Internal error: Oops: 7 [#1] SMP ARM
[  138.683571] Modules linked in: sha256_generic cfg80211 rfkill snd_pcm 
snd_timer
 snd fixed uio_pdrv_genirq uio ip_tables x_tables ipv6 [last unloaded: 
snd_bcm2835
]
[  138.706594] CPU: 3 PID: 463 Comm: aplay Tainted: GWC   
4.15.0-rc1-v
7+ #6
[  138.719833] Hardware name: BCM2835
[  138.726016] task: b877ac00 task.stack: aebec000
[  138.733408] PC is at try_module_get+0x38/0x24c
[  138.740813] LR is at snd_ctl_open+0x58/0x194 [snd]
[  138.748485] pc : [<801c4d5c>]lr : [<7f0e6b2c>]psr: 2013
[  138.757709] sp : aebedd60  ip : aebedd88  fp : aebedd84
[  138.765884] r10:   r9 : 0004  r8 : 7f0ed440
[  138.774040] r7 : b7e469b0  r6 : 7f0e6b2c  r5 : afd91900  r4 : 7f1343c0
[  138.783571] r3 : aebec000  r2 : 0001  r1 : b877ac00  r0 : 7f1343c0
[  138.793084] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[  138.803300] Control: 10c5387d  Table: 2d8f006a  DAC: 0055
[  138.812064] Process aplay (pid: 463, stack limit = 0xaebec210)
[  138.820868] Stack: (0xaebedd60 to 0xaebee000)
[  138.828207] dd60:  b848d000 afd91900  b7e469b0 7f0ed440 
aebedda4 aebedd88
[  138.842371] dd80: 7f0e6b2c 801c4d30 afd91900 7f0ea4dc  b7e469b0 
aebeddcc aebedda8
[  138.856611] dda0: 7f0e250c 7f0e6ae0 7f0e2464 b8478ec0 b7e469b0 afd91900 
7f0ea388 
[  138.870864] ddc0: aebeddf4 aebeddd0 802ce590 7f0e2470 8090ab64 afd91900 
afd91900 b7e469b0
[  138.885301] dde0: afd91908 802ce4e4 aebede1c aebeddf8 802c57b4 802ce4f0 
afd91900 aebedea8
[  138.900110] de00: b7fa4c00   0004 aebede3c aebede20 
802c6ba8 802c56b4
[  138.915260] de20: aebedea8  aebedf5c  aebedea4 aebede40 
802d9a68 802c6b58
[  138.930661] de40: b874ddd0   0001 0041  
afd91900 aebede70
[  138.946402] de60:   0002 b7e469b0 b8a87610 b8d6ab80 
801852f8 0008
[  138.962314] de80: aebedf5c aebedea8 0001 80108464 aebec000  
aebedf4c aebedea8
[  138.978414] dea0: 802dacd4 802d970c b8a87610 b8d6ab80 a7982bc6 0009 
af363019 b9231480
[  138.994617] dec0:  b8c038a0 b7e469b0 0101 0002 0238 
 
[  139.010823] dee0:  aebedee8 0008 000f aebedf3c aebedf00 
802ed7e4 80843f94
[  139.027025] df00: 0003 0008 b9231490 b9231480  0008 
af363000 
[  139.043229] df20: 0005 0002 ff9c  0008 ff9c 
af363000 0003
[  139.059430] df40: aebedf94 aebedf50 802c6f70 802dac70 aebec000  
0001 
[  139.075629] df60: 0002 0004 0100 0001 7ebe577c 0002e038 
 0005
[  139.091828] df80: 80108464 aebec000 aebedfa4 aebedf98 802c7060 802c6e6c 
 aebedfa8
[  139.108025] dfa0: 801082c0 8

Re: [PATCH v2 03/15] clk: imx7d: fix mipi dphy div parent

2018-05-01 Thread Stephen Boyd
Quoting Rui Miguel Silva (2018-04-23 06:47:38)
> Fix the mipi dphy root divider to mipi_dphy_pre_div, this would remove a 
> orphan
> clock and set the correct parent.
> 
> before:
> cat clk_orphan_summary
>  enable  prepare  protect
>clock  countcountcountrate   
> accuracy   phase
> 
>  mipi_dphy_post_div   110   0 
>  0 0
> mipi_dphy_root_clk110   0 
>  0 0
> 
> cat clk_dump | grep mipi_dphy
> mipi_dphy_post_div110   0 
>  0 0
> mipi_dphy_root_clk110   0 
>  0 0
> 
> after:
> cat clk_dump | grep mipi_dphy
>mipi_dphy_src 1102400  
> 0 0
>mipi_dphy_cg  1102400  
> 0 0
>   mipi_dphy_pre_div  1102400  
> 0 0
>  mipi_dphy_post_div  1102400  
> 0 0
> mipi_dphy_root_clk   1102400  
> 0 0
> 
> Cc: linux-...@vger.kernel.org
> Signed-off-by: Rui Miguel Silva 
> 
> Signed-off-by: Rui Miguel Silva 

You have double signed-off-by here. Please resend.

Also, add a "Fixes:" tag so we know where to backport this to.

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


[PATCH v8] PCI: hv: Make sure the bus domain is really unique

2018-05-01 Thread Sridhar Pitchai
When Linux runs as a guest VM in Hyper-V and Hyper-V adds the virtual PCI
bus to the guest, Hyper-V always provides unique PCI domain.

commit 4a9b0933bdfc ("PCI: hv: Use device serial number as PCI domain")
overrode unique domain with the serial number of the first device added to
the virtual PCI bus.

The reason for that patch was to have a consistent and short name for the
device, but Hyper-V doesn't provide unique serial numbers. Using non-unique
serial numbers as domain IDs leads to duplicate device addresses, which
causes PCI bus registration to fail.

commit 0c195567a8f6 ("netvsc: transparent VF management") avoids the need
for commit 4a9b0933bdfc ("PCI: hv: Use device serial number as PCI
domain").  When scripts were used to configure VF devices, the name of
the VF needed to be consistent and short, but with commit 0c195567a8f6
("netvsc: transparent VF management") all the setup is done in the kernel,
and we do not need to maintain consistent name.

Revert commit 4a9b0933bdfc ("PCI: hv: Use device serial number as PCI
domain") so we can reliably support multiple devices being assigned to
a guest.

This revert should only be backported to kernels that contain commit
0c195567a8f6 ("netvsc: transparent VF management").

Fixes: 4a9b0933bdfc ("PCI: hv: Use device serial number as PCI domain")
Signed-off-by: Sridhar Pitchai 
Cc: sta...@vger.kernel.org # v4.14+
Reviewed-by: Bjorn Helgaas 

---
Changes in v8:
* fix the commit comment. [Lorenzo Pieralisi, Bjorn Helgaas]
---
 drivers/pci/host/pci-hyperv.c | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index 2faf38eab785..ac67e56e451a 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -1518,17 +1518,6 @@ static struct hv_pci_dev *new_pcichild_device(struct 
hv_pcibus_device *hbus,
get_pcichild(hpdev, hv_pcidev_ref_childlist);
spin_lock_irqsave(&hbus->device_list_lock, flags);
 
-   /*
-* When a device is being added to the bus, we set the PCI domain
-* number to be the device serial number, which is non-zero and
-* unique on the same VM.  The serial numbers start with 1, and
-* increase by 1 for each device.  So device names including this
-* can have shorter names than based on the bus instance UUID.
-* Only the first device serial number is used for domain, so the
-* domain number will not change after the first device is added.
-*/
-   if (list_empty(&hbus->children))
-   hbus->sysdata.domain = desc->ser;
list_add_tail(&hpdev->list_entry, &hbus->children);
spin_unlock_irqrestore(&hbus->device_list_lock, flags);
return hpdev;
-- 
2.14.1


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


Re: [PATCH v2] staging: lustre: llite: fix potential missing-check bug when copying lumv

2018-05-01 Thread Dan Carpenter
On Mon, Apr 30, 2018 at 05:56:10PM -0500, Wenwen Wang wrote:
> However, given that the user data resides in the user space, a malicious
> user-space process can race to change the data between the two copies. By
> doing so, the attacker can provide a data with an inconsistent version,
> e.g., v1 version + v3 data. This can lead to logical errors in the
> following execution in ll_dir_setstripe(), which performs different actions
> according to the version specified by the field lmm_magic.

This part is misleading.  The fix is to improve readability and make
static checkers happy.  You're over dramatizing it to make people think
it has a security impact when it doesn't.

If the user wants to specify v1 data they can just say that on the first
read.  They don't need to do funny tricks and race between the two
reads.  It's allowed.

In other words this allows the user to do something in a very
complicated way which they are already allowed to do in a very simple
straight forward way.

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


RE: [PATCH v4 01/13] dt-bindings: connector: add properties for typec

2018-05-01 Thread Jun Li
Hi
> -Original Message-
> From: Heikki Krogerus [mailto:heikki.kroge...@linux.intel.com]
> Sent: 2018年4月30日 19:24
> To: Jun Li 
> Cc: robh...@kernel.org; gre...@linuxfoundation.org; li...@roeck-us.net;
> a.ha...@samsung.com; shufan_...@richtek.com; Peter Chen
> ; devicet...@vger.kernel.org;
> linux-...@vger.kernel.org; dl-linux-imx ;
> de...@driverdev.osuosl.org
> Subject: Re: [PATCH v4 01/13] dt-bindings: connector: add properties for typec
> 
> Hi,
> 
> On Thu, Mar 29, 2018 at 12:06:06AM +0800, Li Jun wrote:
> > +Optional properties for usb-c-connector:
> > +- power-type: should be one of "source", "sink" or "dual"(DRP) if typec
> > +  connector has power support.
> > +- try-power-role: preferred power role if "dual"(DRP) can support Try.SNK
> > +  or Try.SRC, should be "sink" for Try.SNK or "source" for Try.SRC.
> > +- data-type: should be one of "host", "device", "dual"(DRD) if typec
> > +  connector supports USB data.
> 
> Please use "power-role" and "data-role".

OK. I will update these 2 property names as you suggested.

Li Jun
> 
> 
> Thanks,
> 
> --
> heikki
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v4 02/13] dt-bindings: usb: add documentation for typec port controller(TCPCI)

2018-05-01 Thread Jun Li
Hi,
> -Original Message-
> From: Mats Karrman [mailto:mats.dev.l...@gmail.com]
> Sent: 2018年4月30日 15:41
> To: Jun Li 
> Cc: robh...@kernel.org; gre...@linuxfoundation.org;
> heikki.kroge...@linux.intel.com; li...@roeck-us.net; a.ha...@samsung.com;
> shufan_...@richtek.com; Peter Chen ;
> devicet...@vger.kernel.org; linux-...@vger.kernel.org; dl-linux-imx
> ; de...@driverdev.osuosl.org
> Subject: Re: [PATCH v4 02/13] dt-bindings: usb: add documentation for typec
> port controller(TCPCI)
> 
> Hi Li Jun,
> 
> Are you working on an updated version of this patch series?
> I'm pondering other changes that builds on these patches (the documentation
> and the fwnode added to the tcpc_dev and tcpm primarily).

I am on a vacation and will be back tomorrow, I will post a new version soon.

> 
> Btw, there is a semi-colon missing in your example below.

Thanks, I will add it.

Li Jun
> 
> BR // Mats
> 
> On 2018-03-28 18:06, Li Jun wrote:
> 
> > TCPCI stands for typec port controller interface, its implementation
> > has full typec port control with power delivery support, it's a
> > standard i2c slave with GPIO input as irq interface, detail see spec
> > "Universal Serial Bus Type-C Port Controller Interface Specification
> > Revision 1.0, Version 1.1"
> >
> > Signed-off-by: Li Jun 
> > ---
> >   .../devicetree/bindings/usb/typec-tcpci.txt| 33
> ++
> >   1 file changed, 33 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/usb/typec-tcpci.txt
> > b/Documentation/devicetree/bindings/usb/typec-tcpci.txt
> > new file mode 100644
> > index 000..7a7a8e0
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/usb/typec-tcpci.txt
> > @@ -0,0 +1,33 @@
> > +TCPCI(Typec port cotroller interface) binding
> > +-
> > +
> > +Required properties:
> > +- compatible:   should be "usb-tcpci,chip-specific-string".
> > +- reg:  the i2c slave address of typec port controller device.
> > +- interrupt-parent: the phandle to the interrupt controller which provides
> > +the interrupt.
> > +- interrupts:   interrupt specification for tcpci alert.
> > +
> > +Required sub-node:
> > +- connector: The "usb-c-connector" attached to the tcpci chip, the
> > +bindings
> > +  of connector node are specified in
> > +  Documentation/devicetree/bindings/connector/usb-connector.txt
> > +
> > +Example:
> > +
> > +ptn5110@50 {
> > +   compatible = "usb-tcpci,ptn5110";
> > +   reg = <0x50>;
> > +   interrupt-parent = <&gpio3>;
> > +   interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
> > +
> > +   usb_con: connector {
> > +   compatible = "usb-c-connector";
> > +   label = "USB-C";
> > +   port-type = "dual";
> > +   try-power-role = "sink"
> 
> Here!
> 
> > +   source-pdos = <0x380190c8>;
> > +   sink-pdos = <0x380190c8 0x3802d0c8>;
> > +   op-sink-microwatt-hours = <900>;
> > +   };
> > +};
> >
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel