Re: [PATCH 3/8] media: v4l2-async: simplify v4l2_async_subdev structure

2017-12-19 Thread Sakari Ailus
On Mon, Dec 18, 2017 at 05:53:57PM -0200, Mauro Carvalho Chehab wrote:
> The V4L2_ASYNC_MATCH_FWNODE match criteria requires just one
> struct to be filled (struct fwnode_handle). The V4L2_ASYNC_MATCH_DEVNAME
> match criteria requires just a device name.
> 
> So, it doesn't make sense to enclose those into structs,
> as the criteria can go directly into the union.
> 
> That makes easier to document it, as we don't need to document
> weird senseless structs.
> 
> At drivers, this makes even clearer about the match criteria.
> 
> Acked-by: Sylwester Nawrocki 
> Signed-off-by: Mauro Carvalho Chehab 

I'm not sure this is needed but it doesn't break anything either.

Feel free to add:

Acked-by: Sakari Ailus 

-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: PROBLEM: 4.15.0-rc3 APIC causes lockups on Core 2 Duo laptop

2017-12-19 Thread Alexandru Chirvasitu
Thank you!

On Mon, Dec 18, 2017 at 11:11:31AM +0100, Pavel Machek wrote:
> Hi!
> On Mon 2017-12-18 03:20:11, Alexandru Chirvasitu wrote:
> > Short description of the problem: latest rc kernel results in seemingly 
> > APIC-caused hard lockups, whereas latest stable kernel works fine.
> > 
> > I have an old ASUS F5RL laptop with an Intel Core 2 Duo CPU T5450 @1.66GHz. 
> > It is currently running Debian 9.3 stable 32 bit (by default on a 
> > 4.9-series kernel), but I have been compiling and installing the latest 
> > kernels.
> > 
> 
> Thanks for doing that.
> 
> > The latest rc kernel at the time of this writing (4.15.0-rc3) boots but 
> > then results in hard lockups on both CPUs after login. Starting in recovery 
> > mode returns the error
> > 
> > "spurious APIC interrupt through vector ff on CPU#0, should never happen"
> > 
> > before lockip up the CPUs again. A hard reboot is necessary. 
> > 
> > Starting with kernel option noapic logs me in uneventfully, but for some 
> > reason has the effect of rendering my ethrenet card inoperable. It is a 
> > Qualcomm Atheros Attansic L2 Fast Ethernet (rev a0), handled by kernel 
> > module atl2. In noapic mode the card is still seen by the system, can be 
> > brought up / down, etc., but dhclient never manages to acquire a lease.
> > 
> > Starting with kernel option nolapic instead brings up the network and logs 
> > me in, but only sees one CPU instead of two, as usual.
> > 
> > The latest kernel that exhibits none of these issues is the latest stable 
> > one as of this writing: 4.14.7.
> > 
> > ---
> > 
> > As this seems to be APIC-related, I am sending the message to the 
> > maintainers mentioned in arch/x86/kernel/apic/apic.c. I am unsure whether 
> > this is the correct procedure however.
> > 
> 
> Good enough procedure. You want to always copy linux-kernel mailing
> list, and you should probably look for X86 maintainers in MAINTAINERS
> file, and  cc them, too.
> 
> If you run out of other options, you can always do "git bisect"...
>


I had never heard of 'bisect' before this casual mention (you might tell I am a 
bit out of my depth). I've since applied it to Linus' tree between

bebc608 Linux 4.14 (good)

and

4fbd8d1 Linux 4.15-rc1 (bad)

It took about 13 attempts (I had access to a faster machine to compile on, and 
ccache helped once the cache built up some momentum). The result is (as 
presented by 'git bisect' at the end of the process, between the --- dividers 
added by me for clarity):

--- start of output ---

2b5175c4fa974b6aa05bbd2ee8d443a8036a1714 is the first bad commit
commit 2b5175c4fa974b6aa05bbd2ee8d443a8036a1714
Author: Thomas Gleixner 
Date:   Tue Oct 17 09:54:57 2017 +0200

genirq: Add config option for reservation mode

The interrupt reservation mode requires reactivation of PCI/MSI
interrupts. Create a config option, so the PCI code can set the
corresponding flag when required.

Signed-off-by: Thomas Gleixner 
Cc: Josh Poulson 
Cc: Mihai Costache 
Cc: Stephen Hemminger 
Cc: Marc Zyngier 
Cc: linux-...@vger.kernel.org
Cc: Haiyang Zhang 
Cc: Dexuan Cui 
Cc: Simon Xiao 
Cc: Saeed Mahameed 
Cc: Jork Loeser 
Cc: Bjorn Helgaas 
Cc: de...@linuxdriverproject.org
Cc: KY Srinivasan 
Link: https://lkml.kernel.org/r/20171017075600.369375...@linutronix.de

:04 04 5e73031cc0c8411a20722cce7876ab7b82ed3858 
dcf98e7a6b7d5f7c5353b7ccab02125e6d332ec8 M  kernel

--- end of output ---

Consequently, I am cc-ing in the listed addresses.


Thank you,

Alex Chirvasitu

> Best regards, Pavel
> -- 
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) 
> http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


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


Re: [PATCH V2] hyper-v: use GFP_KERNEL for hv_context.hv_numa_map

2017-12-19 Thread Jia-Ju Bai


On 2017/12/19 1:05, Stephen Hemminger wrote:

On Mon, 18 Dec 2017 17:02:52 +0800
Jia-Ju Bai  wrote:


The kzalloc function is called with GFP_ATOMIC.
But according to driver call graph, it is not in atomic context,
namely no spinlock is held nor in an interrupt handler.

This GFP_ATOMIC is unnecessary, and replace with GFP_KERNEL.

Signed-off-by: Jia-Ju Bai 
---
  drivers/hv/hv.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 8267439..b0d025a 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -150,7 +150,7 @@ int hv_synic_alloc(void)
int cpu;
  
  	hv_context.hv_numa_map = kzalloc(sizeof(struct cpumask) * nr_node_ids,

-GFP_ATOMIC);
+GFP_KERNEL);
if (hv_context.hv_numa_map == NULL) {
pr_err("Unable to allocate NUMA map\n");
goto err;

Thanks, for fixing this.
While you are at it; wouldn't it make sense to use kcalloc here?


I think kcalloc can be used here.


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


Re: [PATCH 3/8] media: v4l2-async: simplify v4l2_async_subdev structure

2017-12-19 Thread Philipp Zabel
On Mon, 2017-12-18 at 17:53 -0200, Mauro Carvalho Chehab wrote:
> The V4L2_ASYNC_MATCH_FWNODE match criteria requires just one
> struct to be filled (struct fwnode_handle). The V4L2_ASYNC_MATCH_DEVNAME
> match criteria requires just a device name.
> 
> So, it doesn't make sense to enclose those into structs,
> as the criteria can go directly into the union.
> 
> That makes easier to document it, as we don't need to document
> weird senseless structs.
> 
> At drivers, this makes even clearer about the match criteria.
> 
> Acked-by: Sylwester Nawrocki 
> Signed-off-by: Mauro Carvalho Chehab 

Thanks, this does improve readability in the drivers. For imx-media,

Acked-by: Philipp Zabel 

regards
Philipp

> ---
>  drivers/media/platform/am437x/am437x-vpfe.c|  6 +++---
>  drivers/media/platform/atmel/atmel-isc.c   |  2 +-
>  drivers/media/platform/atmel/atmel-isi.c   |  2 +-
>  drivers/media/platform/davinci/vpif_capture.c  |  4 ++--
>  drivers/media/platform/exynos4-is/media-dev.c  |  4 ++--
>  drivers/media/platform/pxa_camera.c|  2 +-
>  drivers/media/platform/qcom/camss-8x16/camss.c |  2 +-
>  drivers/media/platform/rcar-vin/rcar-core.c|  2 +-
>  drivers/media/platform/rcar_drif.c |  4 ++--
>  drivers/media/platform/soc_camera/soc_camera.c |  2 +-
>  drivers/media/platform/stm32/stm32-dcmi.c  |  2 +-
>  drivers/media/platform/ti-vpe/cal.c|  2 +-
>  drivers/media/platform/xilinx/xilinx-vipp.c|  2 +-
>  drivers/media/v4l2-core/v4l2-async.c   | 16 
>  drivers/media/v4l2-core/v4l2-fwnode.c  | 10 +-
>  drivers/staging/media/imx/imx-media-dev.c  |  4 ++--
>  include/media/v4l2-async.h |  8 ++--
>  17 files changed, 35 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/media/platform/am437x/am437x-vpfe.c 
> b/drivers/media/platform/am437x/am437x-vpfe.c
> index 0997c640191d..601ae6487617 100644
> --- a/drivers/media/platform/am437x/am437x-vpfe.c
> +++ b/drivers/media/platform/am437x/am437x-vpfe.c
> @@ -2304,8 +2304,8 @@ vpfe_async_bound(struct v4l2_async_notifier *notifier,
>   vpfe_dbg(1, vpfe, "vpfe_async_bound\n");
>  
>   for (i = 0; i < ARRAY_SIZE(vpfe->cfg->asd); i++) {
> - if (vpfe->cfg->asd[i]->match.fwnode.fwnode ==
> - asd[i].match.fwnode.fwnode) {
> + if (vpfe->cfg->asd[i]->match.fwnode ==
> + asd[i].match.fwnode) {
>   sdinfo = &vpfe->cfg->sub_devs[i];
>   vpfe->sd[i] = subdev;
>   vpfe->sd[i]->grp_id = sdinfo->grp_id;
> @@ -2510,7 +2510,7 @@ vpfe_get_pdata(struct platform_device *pdev)
>   }
>  
>   pdata->asd[i]->match_type = V4L2_ASYNC_MATCH_FWNODE;
> - pdata->asd[i]->match.fwnode.fwnode = of_fwnode_handle(rem);
> + pdata->asd[i]->match.fwnode = of_fwnode_handle(rem);
>   of_node_put(rem);
>   }
>  
> diff --git a/drivers/media/platform/atmel/atmel-isc.c 
> b/drivers/media/platform/atmel/atmel-isc.c
> index 0c2635647f69..34676409ca08 100644
> --- a/drivers/media/platform/atmel/atmel-isc.c
> +++ b/drivers/media/platform/atmel/atmel-isc.c
> @@ -2088,7 +2088,7 @@ static int isc_parse_dt(struct device *dev, struct 
> isc_device *isc)
>   subdev_entity->pfe_cfg0 |= ISC_PFE_CFG0_PPOL_LOW;
>  
>   subdev_entity->asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
> - subdev_entity->asd->match.fwnode.fwnode =
> + subdev_entity->asd->match.fwnode =
>   of_fwnode_handle(rem);
>   list_add_tail(&subdev_entity->list, &isc->subdev_entities);
>   }
> diff --git a/drivers/media/platform/atmel/atmel-isi.c 
> b/drivers/media/platform/atmel/atmel-isi.c
> index e900995143a3..9958918e2449 100644
> --- a/drivers/media/platform/atmel/atmel-isi.c
> +++ b/drivers/media/platform/atmel/atmel-isi.c
> @@ -1128,7 +1128,7 @@ static int isi_graph_parse(struct atmel_isi *isi, 
> struct device_node *node)
>   /* Remote node to connect */
>   isi->entity.node = remote;
>   isi->entity.asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
> - isi->entity.asd.match.fwnode.fwnode = of_fwnode_handle(remote);
> + isi->entity.asd.match.fwnode = of_fwnode_handle(remote);
>   return 0;
>   }
>  }
> diff --git a/drivers/media/platform/davinci/vpif_capture.c 
> b/drivers/media/platform/davinci/vpif_capture.c
> index e45916f69def..e1c273c8b9a6 100644
> --- a/drivers/media/platform/davinci/vpif_capture.c
> +++ b/drivers/media/platform/davinci/vpif_capture.c
> @@ -1390,7 +1390,7 @@ static int vpif_async_bound(struct v4l2_async_notifier 
> *notifier,
>  
>   for (i = 0; i < vpif_obj.config->asd_sizes[0]; i++) {
>   struct v4l2_async_subdev *_asd = vpif_obj.config->asd[i];
> - const struct fwnode_handle *fwnode = _asd->match.fwnode.fwnode;
> + const

[PATCH v2 3/8] media: v4l2-async: simplify v4l2_async_subdev structure

2017-12-19 Thread Mauro Carvalho Chehab
The V4L2_ASYNC_MATCH_FWNODE match criteria requires just one
struct to be filled (struct fwnode_handle). The V4L2_ASYNC_MATCH_DEVNAME
match criteria requires just a device name.

So, it doesn't make sense to enclose those into structs,
as the criteria can go directly into the union.

That makes easier to document it, as we don't need to document
weird senseless structs.

At drivers, this makes even clearer about the match criteria.

Acked-by: Sylwester Nawrocki 
Acked-by: Benoit Parrot 
Acked-by: Alexandre Belloni 
Acked-by: Sakari Ailus 
Acked-by: Philipp Zabel 
Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/platform/am437x/am437x-vpfe.c|  6 +++---
 drivers/media/platform/atmel/atmel-isc.c   |  2 +-
 drivers/media/platform/atmel/atmel-isi.c   |  2 +-
 drivers/media/platform/davinci/vpif_capture.c  |  4 ++--
 drivers/media/platform/exynos4-is/media-dev.c  |  4 ++--
 drivers/media/platform/pxa_camera.c|  2 +-
 drivers/media/platform/qcom/camss-8x16/camss.c |  2 +-
 drivers/media/platform/rcar-vin/rcar-core.c|  2 +-
 drivers/media/platform/rcar_drif.c |  4 ++--
 drivers/media/platform/soc_camera/soc_camera.c |  2 +-
 drivers/media/platform/stm32/stm32-dcmi.c  |  2 +-
 drivers/media/platform/ti-vpe/cal.c|  2 +-
 drivers/media/platform/xilinx/xilinx-vipp.c|  2 +-
 drivers/media/v4l2-core/v4l2-async.c   | 16 
 drivers/media/v4l2-core/v4l2-fwnode.c  | 10 +-
 drivers/staging/media/imx/imx-media-dev.c  |  4 ++--
 include/media/v4l2-async.h |  8 ++--
 17 files changed, 35 insertions(+), 39 deletions(-)

diff --git a/drivers/media/platform/am437x/am437x-vpfe.c 
b/drivers/media/platform/am437x/am437x-vpfe.c
index 0997c640191d..601ae6487617 100644
--- a/drivers/media/platform/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/am437x/am437x-vpfe.c
@@ -2304,8 +2304,8 @@ vpfe_async_bound(struct v4l2_async_notifier *notifier,
vpfe_dbg(1, vpfe, "vpfe_async_bound\n");
 
for (i = 0; i < ARRAY_SIZE(vpfe->cfg->asd); i++) {
-   if (vpfe->cfg->asd[i]->match.fwnode.fwnode ==
-   asd[i].match.fwnode.fwnode) {
+   if (vpfe->cfg->asd[i]->match.fwnode ==
+   asd[i].match.fwnode) {
sdinfo = &vpfe->cfg->sub_devs[i];
vpfe->sd[i] = subdev;
vpfe->sd[i]->grp_id = sdinfo->grp_id;
@@ -2510,7 +2510,7 @@ vpfe_get_pdata(struct platform_device *pdev)
}
 
pdata->asd[i]->match_type = V4L2_ASYNC_MATCH_FWNODE;
-   pdata->asd[i]->match.fwnode.fwnode = of_fwnode_handle(rem);
+   pdata->asd[i]->match.fwnode = of_fwnode_handle(rem);
of_node_put(rem);
}
 
diff --git a/drivers/media/platform/atmel/atmel-isc.c 
b/drivers/media/platform/atmel/atmel-isc.c
index 0c2635647f69..34676409ca08 100644
--- a/drivers/media/platform/atmel/atmel-isc.c
+++ b/drivers/media/platform/atmel/atmel-isc.c
@@ -2088,7 +2088,7 @@ static int isc_parse_dt(struct device *dev, struct 
isc_device *isc)
subdev_entity->pfe_cfg0 |= ISC_PFE_CFG0_PPOL_LOW;
 
subdev_entity->asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
-   subdev_entity->asd->match.fwnode.fwnode =
+   subdev_entity->asd->match.fwnode =
of_fwnode_handle(rem);
list_add_tail(&subdev_entity->list, &isc->subdev_entities);
}
diff --git a/drivers/media/platform/atmel/atmel-isi.c 
b/drivers/media/platform/atmel/atmel-isi.c
index e900995143a3..9958918e2449 100644
--- a/drivers/media/platform/atmel/atmel-isi.c
+++ b/drivers/media/platform/atmel/atmel-isi.c
@@ -1128,7 +1128,7 @@ static int isi_graph_parse(struct atmel_isi *isi, struct 
device_node *node)
/* Remote node to connect */
isi->entity.node = remote;
isi->entity.asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
-   isi->entity.asd.match.fwnode.fwnode = of_fwnode_handle(remote);
+   isi->entity.asd.match.fwnode = of_fwnode_handle(remote);
return 0;
}
 }
diff --git a/drivers/media/platform/davinci/vpif_capture.c 
b/drivers/media/platform/davinci/vpif_capture.c
index e45916f69def..e1c273c8b9a6 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -1390,7 +1390,7 @@ static int vpif_async_bound(struct v4l2_async_notifier 
*notifier,
 
for (i = 0; i < vpif_obj.config->asd_sizes[0]; i++) {
struct v4l2_async_subdev *_asd = vpif_obj.config->asd[i];
-   const struct fwnode_handle *fwnode = _asd->match.fwnode.fwnode;
+   const struct fwnode_handle *fwnode = _asd->match.fwnode;
 
if (fwnode == subdev->fwnode) {
vpif_obj.sd[i] = subdev;
@@ -1595,7 +1595,7 @@ vpif_capture_get_pdata(struct platform

[PATCH v2 5/8] media: v4l2-mediabus: convert flags to enums and document them

2017-12-19 Thread Mauro Carvalho Chehab
There is a mess with media bus flags: there are two sets of
flags, one used by parallel and ITU-R BT.656 outputs,
and another one for CSI2.

Depending on the type, the same bit has different meanings.

That's very confusing, and counter-intuitive. So, split them
into two sets of flags, inside an enum.

This way, it becomes clearer that there are two separate sets
of flags. It also makes easier if CSI1, CSP, CSI3, etc. would
need a different set of flags.

As a side effect, enums can be documented via kernel-docs,
so there will be an improvement at flags documentation.

Unfortunately, soc_camera and pxa_camera do a mess with
the flags, using either one set of flags without proper
checks about the type. That could be fixed, but, as both drivers
are obsolete and in the process of cleanings, I opted to just
keep the behavior, using an unsigned int inside those two
drivers.

Acked-by: Hans Verkuil 
Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/i2c/adv7180.c|  10 +-
 drivers/media/i2c/ml86v7667.c  |   5 +-
 drivers/media/i2c/mt9m111.c|   8 +-
 drivers/media/i2c/ov6650.c |  19 +--
 drivers/media/i2c/soc_camera/imx074.c  |   6 +-
 drivers/media/i2c/soc_camera/mt9m001.c |  10 +-
 drivers/media/i2c/soc_camera/mt9t031.c |  11 +-
 drivers/media/i2c/soc_camera/mt9t112.c |  11 +-
 drivers/media/i2c/soc_camera/mt9v022.c |  16 ++-
 drivers/media/i2c/soc_camera/ov5642.c  |   5 +-
 drivers/media/i2c/soc_camera/ov772x.c  |  10 +-
 drivers/media/i2c/soc_camera/ov9640.c  |  10 +-
 drivers/media/i2c/soc_camera/ov9740.c  |  10 +-
 drivers/media/i2c/soc_camera/rj54n1cb0c.c  |  12 +-
 drivers/media/i2c/soc_camera/tw9910.c  |  13 +-
 drivers/media/i2c/tc358743.c   |  10 +-
 drivers/media/i2c/tvp5150.c|   6 +-
 drivers/media/platform/pxa_camera.c|   8 +-
 drivers/media/platform/rcar-vin/rcar-core.c|   4 +-
 drivers/media/platform/rcar-vin/rcar-dma.c |   4 +-
 .../platform/soc_camera/sh_mobile_ceu_camera.c |   2 +-
 drivers/media/platform/soc_camera/soc_camera.c |   3 +-
 .../platform/soc_camera/soc_camera_platform.c  |   2 +-
 drivers/media/platform/soc_camera/soc_mediabus.c   |   2 +-
 drivers/media/v4l2-core/v4l2-fwnode.c  |   5 +-
 drivers/staging/media/imx/imx-media-csi.c  |   7 +-
 include/media/v4l2-fwnode.h|   4 +-
 include/media/v4l2-mediabus.h  | 145 ++---
 28 files changed, 222 insertions(+), 136 deletions(-)

diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index 25d24a3f10a7..4bf25a72ef4f 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -743,16 +743,16 @@ static int adv7180_g_mbus_config(struct v4l2_subdev *sd,
 
if (state->chip_info->flags & ADV7180_FLAG_MIPI_CSI2) {
cfg->type = V4L2_MBUS_CSI2;
-   cfg->flags = V4L2_MBUS_CSI2_1_LANE |
-   V4L2_MBUS_CSI2_CHANNEL_0 |
-   V4L2_MBUS_CSI2_CONTINUOUS_CLOCK;
+   cfg->csi2_flags = V4L2_MBUS_CSI2_1_LANE
+ | V4L2_MBUS_CSI2_CHANNEL_0
+ | V4L2_MBUS_CSI2_CONTINUOUS_CLOCK;
} else {
/*
 * The ADV7180 sensor supports BT.601/656 output modes.
 * The BT.656 is default and not yet configurable by s/w.
 */
-   cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING |
-V4L2_MBUS_DATA_ACTIVE_HIGH;
+   cfg->pb_flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING
+   | V4L2_MBUS_DATA_ACTIVE_HIGH;
cfg->type = V4L2_MBUS_BT656;
}
 
diff --git a/drivers/media/i2c/ml86v7667.c b/drivers/media/i2c/ml86v7667.c
index 57ef901edb06..a25114d0c31f 100644
--- a/drivers/media/i2c/ml86v7667.c
+++ b/drivers/media/i2c/ml86v7667.c
@@ -226,8 +226,9 @@ static int ml86v7667_fill_fmt(struct v4l2_subdev *sd,
 static int ml86v7667_g_mbus_config(struct v4l2_subdev *sd,
   struct v4l2_mbus_config *cfg)
 {
-   cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING |
-V4L2_MBUS_DATA_ACTIVE_HIGH;
+   cfg->pb_flags = V4L2_MBUS_MASTER
+   | V4L2_MBUS_PCLK_SAMPLE_RISING
+   | V4L2_MBUS_DATA_ACTIVE_HIGH;
cfg->type = V4L2_MBUS_BT656;
 
return 0;
diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c
index b1665d97e0fd..d9698b535080 100644
--- a/drivers/media/i2c/mt9m111.c
+++ b/drivers/media/i2c/mt9m111.c
@@ -857,9 +857,11 @@ static int mt9m111_enum_mbus_code(struct v4l2_subdev *sd,
 static int mt9m111

Re: [PATCH v2 5/8] media: v4l2-mediabus: convert flags to enums and document them

2017-12-19 Thread Philipp Zabel
On Tue, 2017-12-19 at 09:18 -0200, Mauro Carvalho Chehab wrote:
> There is a mess with media bus flags: there are two sets of
> flags, one used by parallel and ITU-R BT.656 outputs,
> and another one for CSI2.
> 
> Depending on the type, the same bit has different meanings.
> 
> That's very confusing, and counter-intuitive. So, split them
> into two sets of flags, inside an enum.
> 
> This way, it becomes clearer that there are two separate sets
> of flags. It also makes easier if CSI1, CSP, CSI3, etc. would
> need a different set of flags.
> 
> As a side effect, enums can be documented via kernel-docs,
> so there will be an improvement at flags documentation.
> 
> Unfortunately, soc_camera and pxa_camera do a mess with
> the flags, using either one set of flags without proper
> checks about the type. That could be fixed, but, as both drivers
> are obsolete and in the process of cleanings, I opted to just
> keep the behavior, using an unsigned int inside those two
> drivers.
> 
> Acked-by: Hans Verkuil 
> Signed-off-by: Mauro Carvalho Chehab 

For imx-media,
Acked-by: Philipp Zabel 

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


Re: [PATCH v4 1/3] media: atomisp: convert default struct values to use compound-literals with designated initializers.

2017-12-19 Thread Sakari Ailus
Hi Jeremy,

On Sat, Dec 02, 2017 at 10:11:59PM +, Jeremy Sowden wrote:
> The CSS API uses a lot of nested anonymous structs defined in object
> macros to assign default values to its data-structures.  These have been
> changed to use compound-literals and designated initializers to make
> them more comprehensible and less fragile.
> 
> The compound-literals can also be used in assignment, which means we can
> get rid of some temporary variables whose only purpose is to be
> initialized by one of these anonymous structs and then serve as the
> rvalue in an assignment expression.
> 
> Signed-off-by: Jeremy Sowden 

I don't think it's useful to change the struct definition macros only to
remove a large number of assigned fields in the next patch. How about
merging the two patches?

Please also start a new thread when re-posting a set.

Thanks.

-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4 3/3] media: atomisp: delete empty default struct values.

2017-12-19 Thread Sakari Ailus
On Sat, Dec 02, 2017 at 10:12:01PM +, Jeremy Sowden wrote:
> Removing zero-valued struct-members left a number of the default
> struct-values empty.  These values have now been removed.
> 
> Signed-off-by: Jeremy Sowden 

This one should be squashed as well.

-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH RFC 2/7] KVM: nVMX: modify vmcs12 fields to match Hyper-V enlightened VMCS

2017-12-19 Thread Vitaly Kuznetsov
Jim Mattson  writes:

> At this point in time, I don't think you can just blithely change the
> virtual VMCS layout and revision number. Existing VMs using the old
> layout and revision number must continue to work on versions of kvm
> past this point. You could tie the layout and revision number changes
> to KVM_CAP_HYPERV_ENLIGHTENED_VMCS if you like, but kvm must be able
> to continue to service VMs using the previous layout and revision
> number in perpetuity.
>

I see what you mean. In case we need to keep migration of nested
workloads working between KVMs of different versions we can't (ever)
touch vmcs12.

The way to go in this case, I think, is to create a completely separate
enlightened_vmcs12 struct and use it when appropriate. We can't possibly
support migrating workloads which use enlightened VMCS to an old KVM
which doesn't support it.

P.S. "If there are changes in this struct, VMCS12_REVISION must be
changed." comment needs to be replaced with "Don't even think about
changing this" :-)

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


Re: [PATCH RFC 2/7] KVM: nVMX: modify vmcs12 fields to match Hyper-V enlightened VMCS

2017-12-19 Thread Paolo Bonzini
On 19/12/2017 13:25, Vitaly Kuznetsov wrote:
> 
>> At this point in time, I don't think you can just blithely change the
>> virtual VMCS layout and revision number. Existing VMs using the old
>> layout and revision number must continue to work on versions of kvm
>> past this point. You could tie the layout and revision number changes
>> to KVM_CAP_HYPERV_ENLIGHTENED_VMCS if you like, but kvm must be able
>> to continue to service VMs using the previous layout and revision
>> number in perpetuity.
>>
> I see what you mean. In case we need to keep migration of nested
> workloads working between KVMs of different versions we can't (ever)
> touch vmcs12.

Actually we can, for two reasons.

First, the active VMCS is stored in host RAM (not in guest RAM).  This
means there are clear points where to do the translation, namely vmptrld
and the (not yet upstream) ioctl to set VMX state.

Therefore you only need to keep an (offset, type) map from old to new
layout map; at those two points if you detect an old VMCS12_REVISION you
copy the fields one by one instead of doing a memcpy.  The next vmclear
or vmptrld or get-VMX-state ioctl will automatically update to the new
VMCS12_REVISION.  Of course, this is a one-way street unless you also
add support for writing old VMCS12_REVISIONs.

But, second, VMX state migration is not upstream yet, so nested
hypervisors are currently not migratable: the active VMCS12 state will
not be migrated at all!  So in upstream KVM we wouldn't even need to
upgrade the VMCS12_REVISION to make changes to vmcs12.

That said...

> The way to go in this case, I think, is to create a completely separate
> enlightened_vmcs12 struct and use it when appropriate. We can't possibly
> support migrating workloads which use enlightened VMCS to an old KVM
> which doesn't support it.

... this is probably a good idea as well.

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


Re: [PATCH RFC 0/7] KVM: nVMX: enlightened VMCS initial implementation

2017-12-19 Thread Paolo Bonzini
On 18/12/2017 18:17, Vitaly Kuznetsov wrote:
> The original author of these patches does no longer work at Red Hat, I
> agreed to take this over and send upstream. Here is his original
> description:
> 
> "Makes KVM implement the enlightened VMCS feature per Hyper-V TLFS 5.0b.
> I've measured about %5 improvement in cost of a nested VM exit (Hyper-V
> enabled Windows Server 2016 nested in KVM)."

Can you try reproducing this and see how much a simple CPUID loop costs in:

* Hyper-V on Hyper-V (with enlightened VMCS, as a proxy for a full
implementation including the clean fields mask)

* Hyper-V on KVM, with and without enlightened VMCS

The latest kvm/queue branch already cut a lot of the cost of a nested VM
exit (from ~22000 to ~14000 clock cycles for KVM on KVM), so we could
also see if Hyper-V needs shadowing of more fields.

> This is just an initial implementation. By leveraging clean fields mask
> we can further improve performance. I'm also interested in implementing
> the other part of the feature: consuming enlightened VMCS when KVM is
> running on top of Hyper-V.

I'm also interested in consuming enlightened VMCS on Hyper-V if that can
provide better performance for KVM on Azure.

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


Re: [PATCH RFC 0/7] KVM: nVMX: enlightened VMCS initial implementation

2017-12-19 Thread Vitaly Kuznetsov
Paolo Bonzini  writes:

> On 18/12/2017 18:17, Vitaly Kuznetsov wrote:
>> The original author of these patches does no longer work at Red Hat, I
>> agreed to take this over and send upstream. Here is his original
>> description:
>> 
>> "Makes KVM implement the enlightened VMCS feature per Hyper-V TLFS 5.0b.
>> I've measured about %5 improvement in cost of a nested VM exit (Hyper-V
>> enabled Windows Server 2016 nested in KVM)."
>
> Can you try reproducing this and see how much a simple CPUID loop costs in:
>
> * Hyper-V on Hyper-V (with enlightened VMCS, as a proxy for a full
> implementation including the clean fields mask)
>
> * Hyper-V on KVM, with and without enlightened VMCS
>
> The latest kvm/queue branch already cut a lot of the cost of a nested VM
> exit (from ~22000 to ~14000 clock cycles for KVM on KVM), so we could
> also see if Hyper-V needs shadowing of more fields.

I tested this series before sending out and was able to reproduce said
5% improvement with the feature (but didn't keep record of clock
cycles). I'll try doing tests you mentioned on the same hardware and
come back with the result. Hopefully I'll manage that before holidays.

Thanks,

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


Re: [PATCH v3] staging: comedi: ni_*: Fix style warnings.

2017-12-19 Thread Greg Kroah-Hartman
On Thu, Dec 14, 2017 at 01:31:05AM -0600, Aniruddha Shastri wrote:
> Two of these warnings are now line-too-long warnings. I think these 
> warnings are preferable to the ones listed below. The longest line is
> only 85 chars wide, which is reasonable.
> 
> Warnings fixed:
> ni_atmio.c:239: WARNING: Avoid multiple line dereference
>   - prefer 'ni_boards[i].isapnp_id'
> ni_labpc_common.c:573: WARNING: Avoid multiple line dereference
>   - prefer 'cmd->scan_begin_arg'
> ni_mio_common.c:736: WARNING: Avoid multiple line dereference
>   - prefer 'devpriv->counter_dev->counters[gpct_index]'
> ni_mio_common.c:1977: WARNING: Prefer using '"%s...", __func__'
>   to using 'ni_cmd_set_mite_transfer', this function's name, in a string
> ni_mio_common.c:1990: WARNING: Prefer using '"%s...", __func__'
>   to using 'ni_cmd_set_mite_transfer', this function's name, in a string
> ni_mio_common.c:4302: WARNING: function definition argument
>   'int' should also have an identifier name
> ni_mio_common.c:4302: WARNING: function definition argument
>   'int' should also have an identifier name
> ni_mio_common.c:4302: WARNING: function definition argument
>   'int *' should also have an identifier name
> ni_mio_common.c:4699: WARNING: Prefer using '"%s...", __func__'
>   to using 'cs5529_do_conversion', this function's name, in a string
> ni_stc.h:21: WARNING: Block comments should align the * on each line
> 
> Signed-off-by: Aniruddha Shastri 
> ---
> Changes in v3:
> No longer add 'const' to sizeof(struct comedi_lrange) in ni_670x.c:212

Please only fix one "type" of issue per patch.  This should be broken up
into multiple patches and sent as a patch series.

thanks,

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


Re: [PATCH 6/8 v4] staging: pi433: remove unused function

2017-12-19 Thread Greg Kroah-Hartman
On Thu, Dec 14, 2017 at 04:20:20PM +0100, Valentin Vidic wrote:
> As it turns out rf69_get_lna_gain is not used at all.
> 
> Signed-off-by: Valentin Vidic 
> ---
> v2: - drop change for SHIFT_DATAMODUL_MODULATION_TYPE
> - move shifting to the header file
> v3: - drop auto case
> - use CURRENT suffix
> - precompute define values
> v4: - drop the whole function since it is not called
>   from anywhere

This patch series is crazy, I have no idea how to pick out the "correct"
patches here at all.

Please just resend the whole thing, as 'v5', in order, so that I know
what to do.

thanks,

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


Re: [PATCH] Staging: Pi433: Bugfix for wrong argument for sizeof() in TX thread

2017-12-19 Thread Greg KH
On Mon, Dec 18, 2017 at 07:27:58PM +0200, Marcus Wolf wrote:
> sizeof(array) != sizeof(pointer to array)
> Fixes: "staging: pi433: reduce stack size in tx thread"
> 
> Signed-off-by: Marcus Wolf 

This should be listed as:
Fixes: 62f39d49d168 ("staging: pi433: reduce stack size in tx thread")

right above your signed-off-by line, so we know what patch it really
fixes.  I'll do that now, but next time it would be great if you could
do it.

thanks,

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


Re: [PATCH 1/3] staging: dgnc: dgnc_tty.c: remove unnecessary parentheses

2017-12-19 Thread Greg KH
On Sat, Dec 16, 2017 at 10:15:59PM +0200, Kamal Heib wrote:
> Cleanup the "Unnecessary parentheses around " checkpatch.pl error.
> 
> Signed-off-by: Kamal Heib 
> ---
>  drivers/staging/dgnc/dgnc_tty.c | 38 +++---
>  1 file changed, 19 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
> index d3736daf8cf2..4bf2ae3bf3be 100644
> --- a/drivers/staging/dgnc/dgnc_tty.c
> +++ b/drivers/staging/dgnc/dgnc_tty.c
> @@ -525,7 +525,7 @@ void dgnc_carrier(struct channel_t *ch)
>  
>   /* Test for a VIRTUAL carrier transition to HIGH. */
>  
> - if (((ch->ch_flags & CH_FCAR) == 0) && (virt_carrier == 1)) {
> + if (((ch->ch_flags & CH_FCAR) == 0) && virt_carrier == 1) {

Wait, now I need to go look up to see if && or == comes first in
precedence.  That's not good, horrible checkpatch warning, don't make it
harder to read :(

thanks,

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


Re: [PATCH 2/3] staging: dgnc: dgnc_cls.c: remove unnecessary parentheses

2017-12-19 Thread Greg KH
On Sat, Dec 16, 2017 at 10:16:00PM +0200, Kamal Heib wrote:
> Cleanup the "Unnecessary parentheses around " checkpatch.pl error.
> 
> Signed-off-by: Kamal Heib 
> ---
>  drivers/staging/dgnc/dgnc_cls.c | 16 
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
> index e264fe11cba4..aed6e9cb24a6 100644
> --- a/drivers/staging/dgnc/dgnc_cls.c
> +++ b/drivers/staging/dgnc/dgnc_cls.c
> @@ -706,7 +706,7 @@ static void cls_param(struct tty_struct *tty)
>* unit is NOT open
>*/
>   if (!(ch->ch_tun.un_flags & UN_ISOPEN) &&
> - (un->un_type == DGNC_PRINT))
> + un->un_type == DGNC_PRINT)

Same complaint here.  Checkpatch is a "hint", don't do things that make
it harder to understand the code.

thanks,

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


Re: [PATCH 3/3] staging: dgnc: dgnc_neo.c: remove unnecessary parentheses

2017-12-19 Thread Greg KH
On Sat, Dec 16, 2017 at 10:16:01PM +0200, Kamal Heib wrote:
> Cleanup the "Unnecessary parentheses around " checkpatch.pl error.
> 
> Signed-off-by: Kamal Heib 
> ---
>  drivers/staging/dgnc/dgnc_neo.c | 22 +++---
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
> index 0ae229c3..45bf2dd01bb9 100644
> --- a/drivers/staging/dgnc/dgnc_neo.c
> +++ b/drivers/staging/dgnc/dgnc_neo.c
> @@ -651,7 +651,7 @@ static void neo_param(struct tty_struct *tty)
>* is NOT open
>*/
>   if (!(ch->ch_tun.un_flags & UN_ISOPEN) &&
> - (un->un_type == DGNC_PRINT))
> + un->un_type == DGNC_PRINT)

And again, same issue :(
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: wilc1000: Fix lines ending with parentheses

2017-12-19 Thread Greg KH
On Sat, Dec 16, 2017 at 01:25:19PM +0530, Aditya Shankar wrote:
> This patch fixes the "Lines should not end with a '('"
> problem reported by checkpatch
> 
> Signed-off-by: Aditya Shankar 
> ---
>  drivers/staging/wilc1000/linux_mon.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)

This does not apply to my tree, can you redo it against linux-next and
resend?

thanks,

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


[RFC PATCH] Staging: rtl8723bs: initinterrupt8723bsdio() can be static

2017-12-19 Thread kbuild test robot

Fixes: 8642fab9ea22 ("Staging: rtl8723bs: Change names to conform to the kernel 
code")
Signed-off-by: Fengguang Wu 
---
 sdio_ops.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c 
b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index 00b20c0..7f3dbe1 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -778,7 +778,7 @@ static s32 ReadInterrupt8723BSdio(struct adapter *adapter, 
u32 *phisr)
 /*  */
 /* Created by Roger, 2011.02.11. */
 /*  */
-void initinterrupt8723bsdio(struct adapter *adapter)
+static void initinterrupt8723bsdio(struct adapter *adapter)
 {
struct hal_com_data *haldata;
 
@@ -812,7 +812,7 @@ void initinterrupt8723bsdio(struct adapter *adapter)
 /*  */
 /* Created by Roger, 2011.08.03. */
 /*  */
-void initsysinterrupt8723bsdio(struct adapter *adapter)
+static void initsysinterrupt8723bsdio(struct adapter *adapter)
 {
struct hal_com_data *haldata;
 
@@ -870,7 +870,7 @@ void clearinterrupt8723bsdio(struct adapter *adapter)
 /*  */
 /* Created by Roger, 2011.02.11. */
 /*  */
-void enable_interrupt8723bsdio(struct adapter *adapter)
+static void enable_interrupt8723bsdio(struct adapter *adapter)
 {
struct hal_com_data *haldata;
__le32 himr;
@@ -922,7 +922,7 @@ void enable_interrupt8723bsdio(struct adapter *adapter)
 /*  */
 /* Created by Roger, 2011.02.11. */
 /*  */
-void disable_interrupt8723bsdio(struct adapter *adapter)
+static void disable_interrupt8723bsdio(struct adapter *adapter)
 {
__le32 himr;
 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


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

2017-12-19 Thread Greg KH
On Wed, Nov 29, 2017 at 12:08:44PM +0200, laurentiu.tu...@nxp.com wrote:
> 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:
> -v4:
>   - regenerated patch with renames detection disabled (Andrew Lunn)
> -v3:
>   - rebased

Ok, meta-comments on the structure of the code.

You have 8 .h files that are "private" to your bus logic.  That's 7 too
many, some of them have a bigger license header than actual content :)

Please consolidate into 1.

Also, the headers should be moved to SPDX format to get rid of the
boilerplate.  I _think_ it's BSD/GPL, right?  Hard to tell :(

Your "public" .h file does not need to go into a subdirectory, just name
it fsl-mc.h and put it in include/linux/.

One comment on the fields in your .h file, all of the user/kernel
crossing boundry structures need to use the "__" variant of types, like
"__u8" and the like.  You mix and match them for some reason, you need
to be consistent.

Also, what's up with the .h files in drivers/staging/fsl-bus/include?
You didn't touch those with this movement, right?  Why?

For this initial move, only move the bus "core" code out, not the other
stuff like:

>  drivers/irqchip/Makefile   |   1 +
>  drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c| 119 +++

these should be a separate file move, right?

>  drivers/staging/fsl-dpaa2/ethernet/README  |   2 +-

Why does a README file for a different driver need to be touched?

>  drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |   2 +-
>  drivers/staging/fsl-dpaa2/ethernet/dpni.c  |   2 +-
>  drivers/staging/fsl-mc/README.txt  | 386 -

This file gets moved to the Documentation directory, yet it is not tied
into the documentation build process, that's not good.  It doesn't need
to have a separate directory either, right?

And speaking of documentation, you have directories in sysfs, yet no
Documentation/ABI/ files describing them.  Please fix that up.

that's a good start :)

thanks,

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


[PATCH 4/6 v5] staging: pi433: avoid logging ENOMEM messages

2017-12-19 Thread Valentin Vidic
Fixes checkpatch warning:

  WARNING: Possible unnecessary 'out of memory' message

Signed-off-by: Valentin Vidic 
---
v5: resend patchset based on comments

 drivers/staging/pi433/pi433_if.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 6e147cd351c7..287bfa4e270f 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -937,10 +937,8 @@ static int pi433_open(struct inode *inode, struct file 
*filp)
 
if (!device->rx_buffer) {
device->rx_buffer = kmalloc(MAX_MSG_SIZE, GFP_KERNEL);
-   if (!device->rx_buffer) {
-   dev_dbg(device->dev, "open/ENOMEM\n");
+   if (!device->rx_buffer)
return -ENOMEM;
-   }
}
 
device->users++;
-- 
2.15.0

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


[PATCH 2/6 v5] staging: pi433: cleanup local variable declaration

2017-12-19 Thread Valentin Vidic
Fix variable naming and checkpatch warning:

  WARNING: Missing a blank line after declarations

Signed-off-by: Valentin Vidic 
---
v5: resend patchset based on comments

 drivers/staging/pi433/pi433_if.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 02887988d2ea..86709a7100ad 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -699,13 +699,15 @@ pi433_tx_thread(void *data)
repetitions = tx_cfg.repetitions;
while ((repetitions > 0) && (size > position)) {
if ((size - position) > device->free_in_fifo) {
+   int write_size;
+
/* msg to big for fifo - take a part */
-   int temp = device->free_in_fifo;
+   write_size = device->free_in_fifo;
device->free_in_fifo = 0;
rf69_write_fifo(spi,
&buffer[position],
-   temp);
-   position += temp;
+   write_size);
+   position += write_size;
} else {
/* msg fits into fifo - take all */
device->free_in_fifo -= size;
-- 
2.15.0

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


[PATCH 5/6 v5] staging: pi433: replace printk calls with dev_dbg

2017-12-19 Thread Valentin Vidic
Fixes checkpatch warning:

  WARNING: printk() should include KERN_ facility level

Signed-off-by: Valentin Vidic 
---
v5: resend patchset based on comments

 drivers/staging/pi433/pi433_if.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 287bfa4e270f..1aa83cb3f15a 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -721,7 +721,7 @@ pi433_tx_thread(void *data)
retval = 
wait_event_interruptible(device->fifo_wait_queue,
  device->free_in_fifo 
> 0);
if (retval) {
-   printk("ABORT\n");
+   dev_dbg(device->dev, "ABORT\n");
goto abort;
}
}
@@ -732,7 +732,7 @@ pi433_tx_thread(void *data)
 device->free_in_fifo == FIFO_SIZE ||
 kthread_should_stop());
if (kthread_should_stop())
-   printk("ABORT\n");
+   dev_dbg(device->dev, "ABORT\n");
 
/* STOP_TRANSMISSION */
dev_dbg(device->dev, "thread: Packet sent. Set mode to stby.");
-- 
2.15.0

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


[PATCH 3/6 v5] staging: pi433: replace unsigned with unsigned int

2017-12-19 Thread Valentin Vidic
Fixes checkpatch warning:

  WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: Valentin Vidic 
---
v5: resend patchset based on comments

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

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 86709a7100ad..6e147cd351c7 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -78,7 +78,7 @@ struct pi433_device {
struct device   *dev;
struct cdev *cdev;
struct spi_device   *spi;
-   unsignedusers;
+   unsigned intusers;
 
/* irq related values */
struct gpio_desc*gpiod[NUM_DIO];
-- 
2.15.0

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


[PATCH 6/6 v5] staging: pi433: remove unused function

2017-12-19 Thread Valentin Vidic
As it turns out rf69_get_lna_gain is not used at all.

Signed-off-by: Valentin Vidic 
---
v5: resend patchset based on comments

 drivers/staging/pi433/rf69.c | 18 --
 drivers/staging/pi433/rf69.h |  1 -
 2 files changed, 19 deletions(-)

diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index d777e31688ad..f58b925bb1da 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -334,24 +334,6 @@ int rf69_set_lna_gain(struct spi_device *spi, enum lnaGain 
lnaGain)
}
 }
 
-enum lnaGain rf69_get_lna_gain(struct spi_device *spi)
-{
-   u8 currentValue;
-
-   currentValue = rf69_read_reg(spi, REG_LNA);
-
-   switch (currentValue & MASK_LNA_CURRENT_GAIN >> 3) { // improvement: 
change 3 to define
-   case LNA_GAIN_AUTO: return automatic;
-   case LNA_GAIN_MAX:  return max;
-   case LNA_GAIN_MAX_MINUS_6:  return maxMinus6;
-   case LNA_GAIN_MAX_MINUS_12: return maxMinus12;
-   case LNA_GAIN_MAX_MINUS_24: return maxMinus24;
-   case LNA_GAIN_MAX_MINUS_36: return maxMinus36;
-   case LNA_GAIN_MAX_MINUS_48: return maxMinus48;
-   default:return undefined;
-   }
-}
-
 int rf69_set_dc_cut_off_frequency_intern(struct spi_device *spi, u8 reg, enum 
dcc_percent dcc_percent)
 {
switch (dcc_percent) {
diff --git a/drivers/staging/pi433/rf69.h b/drivers/staging/pi433/rf69.h
index 079acbd8a366..e90228a0ca29 100644
--- a/drivers/staging/pi433/rf69.h
+++ b/drivers/staging/pi433/rf69.h
@@ -39,7 +39,6 @@ int rf69_set_output_power_level(struct spi_device *spi, u8 
powerLevel);
 int rf69_set_pa_ramp(struct spi_device *spi, enum paRamp paRamp);
 int rf69_set_antenna_impedance(struct spi_device *spi, enum antennaImpedance 
antennaImpedance);
 int rf69_set_lna_gain(struct spi_device *spi, enum lnaGain lnaGain);
-enum lnaGain rf69_get_lna_gain(struct spi_device *spi);
 int rf69_set_dc_cut_off_frequency_intern(struct spi_device *spi, u8 reg, enum 
dcc_percent dcc_percent);
 int rf69_set_dc_cut_off_frequency(struct spi_device *spi, enum dcc_percent 
dcc_percent);
 int rf69_set_dc_cut_off_frequency_during_afc(struct spi_device *spi, enum 
dcc_percent dcc_percent);
-- 
2.15.0

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


[PATCH 1/6 v5] staging: pi433: collapse else block after return statement

2017-12-19 Thread Valentin Vidic
Fixes checkpatch warning:

  WARNING: else is not generally useful after a break or return

Signed-off-by: Valentin Vidic 
---
v5: resend patchset based on comments

 drivers/staging/pi433/pi433_if.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index b4e6094ad553..02887988d2ea 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -773,11 +773,11 @@ pi433_read(struct file *filp, char __user *buf, size_t 
size, loff_t *f_pos)
if (device->rx_active) {
mutex_unlock(&device->rx_lock);
return -EAGAIN;
-   } else {
-   device->rx_active = true;
-   mutex_unlock(&device->rx_lock);
}
 
+   device->rx_active = true;
+   mutex_unlock(&device->rx_lock);
+
/* start receiving */
/* will block until something was received*/
device->rx_buffer_size = size;
@@ -1117,12 +1117,12 @@ static int pi433_probe(struct spi_device *spi)
if (retval) {
dev_dbg(&spi->dev, "configuration of SPI interface failed!\n");
return retval;
-   } else {
-   dev_dbg(&spi->dev,
-   "spi interface setup: mode 0x%2x, %d bits per word, 
%dhz max speed",
-   spi->mode, spi->bits_per_word, spi->max_speed_hz);
}
 
+   dev_dbg(&spi->dev,
+   "spi interface setup: mode 0x%2x, %d bits per word, %dhz max 
speed",
+   spi->mode, spi->bits_per_word, spi->max_speed_hz);
+
/* Ping the chip by reading the version register */
retval = spi_w8r8(spi, 0x10);
if (retval < 0)
-- 
2.15.0

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


[staging:staging-testing 284/298] drivers/staging/ccree/ssi_driver.c:83:6: error: conflicting types for '__dump_byte_array'

2017-12-19 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
staging-testing
head:   893b103a3e9ce255e9afe8103d90f28ac2124eb8
commit: 3f268f5d6669b61e38ad65095480cdf80389ae40 [284/298] staging: ccree: turn 
compile time debug log to params
config: i386-randconfig-x073-201751 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
git checkout 3f268f5d6669b61e38ad65095480cdf80389ae40
# save the attached .config to linux build tree
make ARCH=i386 

All error/warnings (new ones prefixed by >>):

>> drivers/staging/ccree/ssi_driver.c:83:6: error: conflicting types for 
>> '__dump_byte_array'
void __dump_byte_array(const char *name, const u8 *buf, size_t len)
 ^
   In file included from drivers/staging/ccree/ssi_driver.c:63:0:
   drivers/staging/ccree/ssi_driver.h:175:6: note: previous declaration of 
'__dump_byte_array' was here
void __dump_byte_array(const char *name, const u8 *the_array,
 ^
   drivers/staging/ccree/ssi_driver.c: In function '__dump_byte_array':
>> drivers/staging/ccree/ssi_driver.c:90:41: warning: format '%lu' expects 
>> argument of type 'long unsigned int', but argument 5 has type 'size_t {aka 
>> unsigned int}' [-Wformat=]
 snprintf(prefix, sizeof(prefix), "%s[%lu]: ", name, len);
  ~~^
  %u

vim +/__dump_byte_array +83 drivers/staging/ccree/ssi_driver.c

82  
  > 83  void __dump_byte_array(const char *name, const u8 *buf, size_t len)
84  {
85  char prefix[64];
86  
87  if (!buf)
88  return;
89  
  > 90  snprintf(prefix, sizeof(prefix), "%s[%lu]: ", name, len);
91  
92  print_hex_dump(KERN_DEBUG, prefix, DUMP_PREFIX_ADDRESS, 16, 1, 
buf,
93 len, false);
94  }
95  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


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

2017-12-19 Thread Laurentiu Tudor


On 12/19/2017 04:48 PM, Greg KH wrote:
> On Wed, Nov 29, 2017 at 12:08:44PM +0200, laurentiu.tu...@nxp.com wrote:
>> 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:
>>  -v4:
>>- regenerated patch with renames detection disabled (Andrew Lunn)
>>  -v3:
>>- rebased
>
> Ok, meta-comments on the structure of the code.
>
> You have 8 .h files that are "private" to your bus logic.  That's 7 too
> many, some of them have a bigger license header than actual content :)
>
> Please consolidate into 1.
>
> Also, the headers should be moved to SPDX format to get rid of the
> boilerplate.  I _think_ it's BSD/GPL, right?  Hard to tell :(

It's 3-clause BSD and GPLv2. Will make it clear when moving to SPDX.

>
> Your "public" .h file does not need to go into a subdirectory, just name
> it fsl-mc.h and put it in include/linux/.

There's already a "fsl" subdirectory in include/linux/ so it seemed to 
make sense to use it.

> One comment on the fields in your .h file, all of the user/kernel
> crossing boundry structures need to use the "__" variant of types, like
> "__u8" and the like.  You mix and match them for some reason, you need
> to be consistent.
>
> Also, what's up with the .h files in drivers/staging/fsl-bus/include?
> You didn't touch those with this movement, right?  Why?

Those are not part of the bus "core". Some of them are part of the DPBP 
and DPCON device types APIs and are used by drivers probing on this bus 
and the rest are part of the DPIO driver which is also used by other 
drivers. Since these devices (DPBP, DPCON, DPIO) are interfaces used by 
all the other drivers it made sense to group them together with the bus.

> For this initial move, only move the bus "core" code out, not the other
> stuff like:
>
>>   drivers/irqchip/Makefile   |   1 +
>>   drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c| 119 +++
>
> these should be a separate file move, right?

This bus uses msi interrupts and this file contains glue code needed to 
enable interrupts in the GICv3 irqchip. Without this I don't think the 
bus driver can work because itself makes use of interrupts.

>>   drivers/staging/fsl-dpaa2/ethernet/README  |   2 +-
>
> Why does a README file for a different driver need to be touched?

It mentions a file in the old location of the bus. This is how the diff 
looks:

-   drivers/staging/fsl-mc/README.txt
+   Documentation/dpaa2/overview.txt


>>   drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |   2 +-
>>   drivers/staging/fsl-dpaa2/ethernet/dpni.c  |   2 +-
>>   drivers/staging/fsl-mc/README.txt  | 386 -
>
> This file gets moved to the Documentation directory, yet it is not tied
> into the documentation build process, that's not good.

Will look into that.

> It doesn't need to have a separate directory either, right?

Agreed, maybe the destination directory isn't the best choice. Maybe 
bus-devices/fsl-mc.txt makes more sense? Can you please suggest?

> And speaking of documentation, you have directories in sysfs, yet no
> Documentation/ABI/ files describing them.  Please fix that up.

Hmm, I was under the impression that we did have sysfs documentation.
Will look into it.

> that's a good start :)

Yep. :)

---
Thanks & Best Regards, Laurentiu
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


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

2017-12-19 Thread Greg KH
On Tue, Dec 19, 2017 at 03:21:19PM +, Laurentiu Tudor wrote:
> 
> 
> On 12/19/2017 04:48 PM, Greg KH wrote:
> > On Wed, Nov 29, 2017 at 12:08:44PM +0200, laurentiu.tu...@nxp.com wrote:
> >> 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:
> >>  -v4:
> >>- regenerated patch with renames detection disabled (Andrew Lunn)
> >>  -v3:
> >>- rebased
> >
> > Ok, meta-comments on the structure of the code.
> >
> > You have 8 .h files that are "private" to your bus logic.  That's 7 too
> > many, some of them have a bigger license header than actual content :)
> >
> > Please consolidate into 1.
> >
> > Also, the headers should be moved to SPDX format to get rid of the
> > boilerplate.  I _think_ it's BSD/GPL, right?  Hard to tell :(
> 
> It's 3-clause BSD and GPLv2. Will make it clear when moving to SPDX.

Thanks.

> > Your "public" .h file does not need to go into a subdirectory, just name
> > it fsl-mc.h and put it in include/linux/.
> 
> There's already a "fsl" subdirectory in include/linux/ so it seemed to 
> make sense to use it.

Ah, missed that.  Ok, nevermind :)`

> > One comment on the fields in your .h file, all of the user/kernel
> > crossing boundry structures need to use the "__" variant of types, like
> > "__u8" and the like.  You mix and match them for some reason, you need
> > to be consistent.
> >
> > Also, what's up with the .h files in drivers/staging/fsl-bus/include?
> > You didn't touch those with this movement, right?  Why?
> 
> Those are not part of the bus "core". Some of them are part of the DPBP 
> and DPCON device types APIs and are used by drivers probing on this bus 
> and the rest are part of the DPIO driver which is also used by other 
> drivers. Since these devices (DPBP, DPCON, DPIO) are interfaces used by 
> all the other drivers it made sense to group them together with the bus.

But all of these .h files are only used by the code in this specific
directory, no where else.  So just mush them all together, having
individual .h files doesn't really help anyone here, right?  It's just
more files for no good reason.  And, it might help you see if you really
need all of the info in those files :)

> > For this initial move, only move the bus "core" code out, not the other
> > stuff like:
> >
> >>   drivers/irqchip/Makefile   |   1 +
> >>   drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c| 119 +++
> >
> > these should be a separate file move, right?
> 
> This bus uses msi interrupts and this file contains glue code needed to 
> enable interrupts in the GICv3 irqchip. Without this I don't think the 
> bus driver can work because itself makes use of interrupts.

How is this all working today?  Just leave the non-bus code alone, and
move the irqchip code as a separate patch.

> >>   drivers/staging/fsl-dpaa2/ethernet/README  |   2 +-
> >
> > Why does a README file for a different driver need to be touched?
> 
> It mentions a file in the old location of the bus. This is how the diff 
> looks:
> 
> -   drivers/staging/fsl-mc/README.txt
> +   Documentation/dpaa2/overview.txt

Ah.

> >>   drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |   2 +-
> >>   drivers/staging/fsl-dpaa2/ethernet/dpni.c  |   2 +-
> >>   drivers/staging/fsl-mc/README.txt  | 386 -
> >
> > This file gets moved to the Documentation directory, yet it is not tied
> > into the documentation build process, that's not good.
> 
> Will look into that.
> 
> > It doesn't need to have a separate directory either, right?
> 
> Agreed, maybe the destination directory isn't the best choice. Maybe 
> bus-devices/fsl-mc.txt makes more sense? Can you please suggest?

It should be in .rst format, and tied into the documentation build
somehow, I don't really know where new stuff is going, you should look
at recent changes in that directory for more examples.

thanks,

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


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

2017-12-19 Thread Laurentiu Tudor
On 12/19/2017 05:29 PM, Greg KH wrote:
> On Tue, Dec 19, 2017 at 03:21:19PM +, Laurentiu Tudor wrote:
>>
>>
>> On 12/19/2017 04:48 PM, Greg KH wrote:
>>> On Wed, Nov 29, 2017 at 12:08:44PM +0200, laurentiu.tu...@nxp.com wrote:
 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:
   -v4:
 - regenerated patch with renames detection disabled (Andrew Lunn)
   -v3:
 - rebased
>>>
>>> Ok, meta-comments on the structure of the code.
>>>
>>> You have 8 .h files that are "private" to your bus logic.  That's 7 too
>>> many, some of them have a bigger license header than actual content :)
>>>
>>> Please consolidate into 1.
>>>
>>> Also, the headers should be moved to SPDX format to get rid of the
>>> boilerplate.  I _think_ it's BSD/GPL, right?  Hard to tell :(
>>
>> It's 3-clause BSD and GPLv2. Will make it clear when moving to SPDX.
>
> Thanks.
>
>>> Your "public" .h file does not need to go into a subdirectory, just name
>>> it fsl-mc.h and put it in include/linux/.
>>
>> There's already a "fsl" subdirectory in include/linux/ so it seemed to
>> make sense to use it.
>
> Ah, missed that.  Ok, nevermind :)`
>
>>> One comment on the fields in your .h file, all of the user/kernel
>>> crossing boundry structures need to use the "__" variant of types, like
>>> "__u8" and the like.  You mix and match them for some reason, you need
>>> to be consistent.
>>>
>>> Also, what's up with the .h files in drivers/staging/fsl-bus/include?
>>> You didn't touch those with this movement, right?  Why?
>>
>> Those are not part of the bus "core". Some of them are part of the DPBP
>> and DPCON device types APIs and are used by drivers probing on this bus
>> and the rest are part of the DPIO driver which is also used by other
>> drivers. Since these devices (DPBP, DPCON, DPIO) are interfaces used by
>> all the other drivers it made sense to group them together with the bus.
>
> But all of these .h files are only used by the code in this specific
> directory, no where else.

They are also used by our ethernet driver, see:
   drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h

> So just mush them all together, having
> individual .h files doesn't really help anyone here, right?  It's just
> more files for no good reason.  And, it might help you see if you really
> need all of the info in those files :)

Ok, I'll try to come up with something that reduces the number of header 
files.

>>> For this initial move, only move the bus "core" code out, not the other
>>> stuff like:
>>>
drivers/irqchip/Makefile   |   1 +
drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c| 119 +++
>>>
>>> these should be a separate file move, right?
>>
>> This bus uses msi interrupts and this file contains glue code needed to
>> enable interrupts in the GICv3 irqchip. Without this I don't think the
>> bus driver can work because itself makes use of interrupts.
>
> How is this all working today?  Just leave the non-bus code alone, and
> move the irqchip code as a separate patch.

Ok, i can do this.

drivers/staging/fsl-dpaa2/ethernet/README  |   2 +-
>>>
>>> Why does a README file for a different driver need to be touched?
>>
>> It mentions a file in the old location of the bus. This is how the diff
>> looks:
>>
>> -   drivers/staging/fsl-mc/README.txt
>> +   Documentation/dpaa2/overview.txt
>
> Ah.
>
drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |   2 +-
drivers/staging/fsl-dpaa2/ethernet/dpni.c  |   2 +-
drivers/staging/fsl-mc/README.txt  | 386 -
>>>
>>> This file gets moved to the Documentation directory, yet it is not tied
>>> into the documentation build process, that's not good.
>>
>> Will look into that.
>>
>>> It doesn't need to have a separate directory either, right?
>>
>> Agreed, maybe the destination directory isn't the best choice. Maybe
>> bus-devices/fsl-mc.txt makes more sense? Can you please suggest?
>
> It should be in .rst format, and tied into the documentation build
> somehow, I don't really know where new stuff is going, you should look
> at recent changes in that directory for more examples.

Ok, will do.

---
Thanks & Best Regards, Laurentiu
___

[PATCH] staging: pi433: fix CamelCase for fifo variables

2017-12-19 Thread Valentin Vidic
Fixes checkpatch warnings:

  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 

Signed-off-by: Valentin Vidic 
---
 drivers/staging/pi433/Documentation/pi433.txt |  4 +--
 drivers/staging/pi433/rf69.c  | 46 +--
 drivers/staging/pi433/rf69.h  |  2 +-
 drivers/staging/pi433/rf69_enum.h | 16 +-
 4 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/pi433/Documentation/pi433.txt 
b/drivers/staging/pi433/Documentation/pi433.txt
index f79e998112fd..c082878be0b1 100644
--- a/drivers/staging/pi433/Documentation/pi433.txt
+++ b/drivers/staging/pi433/Documentation/pi433.txt
@@ -110,9 +110,9 @@ rf params:
ramp12  - amp ramps up in 12us
ramp10  - amp ramps up in 10us
tx_start_condition
-   fifoLevel   - transmission starts, if fifo is filled to
+   fifo_level  - transmission starts, if fifo is filled to
  threshold level
-   fifoNotEmpty- transmission starts, as soon as there is one
+   fifo_not_empty  - transmission starts, as soon as there is one
  byte in internal fifo
repetitions
This gives the option, to send a telegram multiple times. 
Default: 1
diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index d777e31688ad..82b65832d39f 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -523,24 +523,24 @@ int rf69_set_dio_mapping(struct spi_device *spi, u8 
DIONumber, u8 value)
 bool rf69_get_flag(struct spi_device *spi, enum flag flag)
 {
switch (flag) {
-   case modeSwitchCompleted: return (rf69_read_reg(spi, REG_IRQFLAGS1) 
& MASK_IRQFLAGS1_MODE_READY);
-   case readyToReceive:  return (rf69_read_reg(spi, REG_IRQFLAGS1) 
& MASK_IRQFLAGS1_RX_READY);
-   case readyToSend: return (rf69_read_reg(spi, REG_IRQFLAGS1) 
& MASK_IRQFLAGS1_TX_READY);
-   case pllLocked:   return (rf69_read_reg(spi, REG_IRQFLAGS1) 
& MASK_IRQFLAGS1_PLL_LOCK);
-   case rssiExceededThreshold:   return (rf69_read_reg(spi, REG_IRQFLAGS1) 
& MASK_IRQFLAGS1_RSSI);
-   case timeout: return (rf69_read_reg(spi, REG_IRQFLAGS1) 
& MASK_IRQFLAGS1_TIMEOUT);
-   case automode:return (rf69_read_reg(spi, REG_IRQFLAGS1) 
& MASK_IRQFLAGS1_AUTOMODE);
-   case syncAddressMatch:return (rf69_read_reg(spi, REG_IRQFLAGS1) 
& MASK_IRQFLAGS1_SYNC_ADDRESS_MATCH);
-   case fifoFull:return (rf69_read_reg(spi, REG_IRQFLAGS2) 
& MASK_IRQFLAGS2_FIFO_FULL);
-/* case fifoNotEmpty:return (rf69_read_reg(spi, REG_IRQFLAGS2) 
& MASK_IRQFLAGS2_FIFO_NOT_EMPTY); */
-   case fifoEmpty:   return !(rf69_read_reg(spi, 
REG_IRQFLAGS2) & MASK_IRQFLAGS2_FIFO_NOT_EMPTY);
-   case fifoLevelBelowThreshold: return (rf69_read_reg(spi, REG_IRQFLAGS2) 
& MASK_IRQFLAGS2_FIFO_LEVEL);
-   case fifoOverrun: return (rf69_read_reg(spi, REG_IRQFLAGS2) 
& MASK_IRQFLAGS2_FIFO_OVERRUN);
-   case packetSent:  return (rf69_read_reg(spi, REG_IRQFLAGS2) 
& MASK_IRQFLAGS2_PACKET_SENT);
-   case payloadReady:return (rf69_read_reg(spi, REG_IRQFLAGS2) 
& MASK_IRQFLAGS2_PAYLOAD_READY);
-   case crcOk:   return (rf69_read_reg(spi, REG_IRQFLAGS2) 
& MASK_IRQFLAGS2_CRC_OK);
-   case batteryLow:  return (rf69_read_reg(spi, REG_IRQFLAGS2) 
& MASK_IRQFLAGS2_LOW_BAT);
-   default:  return false;
+   case modeSwitchCompleted:return (rf69_read_reg(spi, 
REG_IRQFLAGS1) & MASK_IRQFLAGS1_MODE_READY);
+   case readyToReceive: return (rf69_read_reg(spi, 
REG_IRQFLAGS1) & MASK_IRQFLAGS1_RX_READY);
+   case readyToSend:return (rf69_read_reg(spi, 
REG_IRQFLAGS1) & MASK_IRQFLAGS1_TX_READY);
+   case pllLocked:  return (rf69_read_reg(spi, 
REG_IRQFLAGS1) & MASK_IRQFLAGS1_PLL_LOCK);
+   case rssiExceededThreshold:  return (rf69_read_reg(spi, 
REG_IRQFLAGS1) & MASK_IRQFLAGS1_RSSI);
+   case timeout:return (rf69_read_reg(spi, 
REG_IRQFLAGS1) & MASK_IRQFLAGS1_TIMEOUT);
+   case automode:   return (rf69_read_reg(spi, 
REG_IRQFLAGS1) & MASK_IRQFLAGS1_AUTOMODE);
+   case syncAddressMatch:   return (rf69_read_reg(spi, 
REG_IRQFLAGS1) & MASK_IRQFLAGS1_SYNC_ADDRESS_MATCH);
+   case fifo_full:  return (rf69_read_reg(spi, 
REG_IRQFLAGS2) & MASK_IRQFLAGS2_FIFO_FULL);
+/* case fifo_not_empty: return (rf69_read_reg(spi, 
REG_IRQFLAGS2) & MASK_IRQFLAGS2_FIFO_NOT_EMPTY); */
+   case fifo_empty: return !(rf69

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

2017-12-19 Thread Greg KH
On Tue, Dec 19, 2017 at 03:39:44PM +, Laurentiu Tudor wrote:
> On 12/19/2017 05:29 PM, Greg KH wrote:
> > On Tue, Dec 19, 2017 at 03:21:19PM +, Laurentiu Tudor wrote:
> >>
> >>
> >> On 12/19/2017 04:48 PM, Greg KH wrote:
> >>> On Wed, Nov 29, 2017 at 12:08:44PM +0200, laurentiu.tu...@nxp.com wrote:
>  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:
>    -v4:
>  - regenerated patch with renames detection disabled (Andrew Lunn)
>    -v3:
>  - rebased
> >>>
> >>> Ok, meta-comments on the structure of the code.
> >>>
> >>> You have 8 .h files that are "private" to your bus logic.  That's 7 too
> >>> many, some of them have a bigger license header than actual content :)
> >>>
> >>> Please consolidate into 1.
> >>>
> >>> Also, the headers should be moved to SPDX format to get rid of the
> >>> boilerplate.  I _think_ it's BSD/GPL, right?  Hard to tell :(
> >>
> >> It's 3-clause BSD and GPLv2. Will make it clear when moving to SPDX.
> >
> > Thanks.
> >
> >>> Your "public" .h file does not need to go into a subdirectory, just name
> >>> it fsl-mc.h and put it in include/linux/.
> >>
> >> There's already a "fsl" subdirectory in include/linux/ so it seemed to
> >> make sense to use it.
> >
> > Ah, missed that.  Ok, nevermind :)`
> >
> >>> One comment on the fields in your .h file, all of the user/kernel
> >>> crossing boundry structures need to use the "__" variant of types, like
> >>> "__u8" and the like.  You mix and match them for some reason, you need
> >>> to be consistent.
> >>>
> >>> Also, what's up with the .h files in drivers/staging/fsl-bus/include?
> >>> You didn't touch those with this movement, right?  Why?
> >>
> >> Those are not part of the bus "core". Some of them are part of the DPBP
> >> and DPCON device types APIs and are used by drivers probing on this bus
> >> and the rest are part of the DPIO driver which is also used by other
> >> drivers. Since these devices (DPBP, DPCON, DPIO) are interfaces used by
> >> all the other drivers it made sense to group them together with the bus.
> >
> > But all of these .h files are only used by the code in this specific
> > directory, no where else.
> 
> They are also used by our ethernet driver, see:
>drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h

Ick, really?  Then they should not be buried in a bus-specific
location, but rather be in include/linux/SOMEWHERE, right?

thanks,

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


[PATCH v3 3/5] staging: rtl8712: style fix indentation

2017-12-19 Thread Martin Homuth
This patch fixes various coding style issues in the rtl8712 module as
noted by checkpatch.pl related to indentation.

It fixes the following checkpatch.pl warning:

WARNING: suspect code indent for conditional statements

Signed-off-by: Martin Homuth 
---
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 12 ++--
 drivers/staging/rtl8712/rtl871x_security.c| 12 ++--
 drivers/staging/rtl8712/usb_ops_linux.c   |  2 +-
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index e756b3d6f12e..ae8c61910b82 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -1722,12 +1722,12 @@ static int r871x_wx_set_auth(struct net_device *dev,
 */
if (padapter->securitypriv.ndisencryptstatus ==
Ndis802_11Encryption1Enabled) {
-   /* it means init value, or using wep,
-* ndisencryptstatus =
-*  Ndis802_11Encryption1Enabled,
-* then it needn't reset it;
-*/
-   break;
+   /* it means init value, or using wep,
+* ndisencryptstatus =
+*  Ndis802_11Encryption1Enabled,
+* then it needn't reset it;
+*/
+   break;
}
 
if (paramval) {
diff --git a/drivers/staging/rtl8712/rtl871x_security.c 
b/drivers/staging/rtl8712/rtl871x_security.c
index fff0acf7954d..7bc74d7d8a3a 100644
--- a/drivers/staging/rtl8712/rtl871x_security.c
+++ b/drivers/staging/rtl8712/rtl871x_security.c
@@ -1069,16 +1069,16 @@ static sint aes_cipher(u8 *key, uinthdrlen,
if ((frtype == WIFI_DATA_CFACK) ||
 (frtype == WIFI_DATA_CFPOLL) ||
 (frtype == WIFI_DATA_CFACKPOLL)) {
-   qc_exists = 1;
-   if (hdrlen !=  WLAN_HDR_A3_QOS_LEN)
-   hdrlen += 2;
+   qc_exists = 1;
+   if (hdrlen !=  WLAN_HDR_A3_QOS_LEN)
+   hdrlen += 2;
} else if ((frsubtype == 0x08) ||
   (frsubtype == 0x09) ||
   (frsubtype == 0x0a) ||
   (frsubtype == 0x0b)) {
-   if (hdrlen !=  WLAN_HDR_A3_QOS_LEN)
-   hdrlen += 2;
-   qc_exists = 1;
+   if (hdrlen !=  WLAN_HDR_A3_QOS_LEN)
+   hdrlen += 2;
+   qc_exists = 1;
} else {
qc_exists = 0;
}
diff --git a/drivers/staging/rtl8712/usb_ops_linux.c 
b/drivers/staging/rtl8712/usb_ops_linux.c
index 441e76b8959d..6d12a96fa65f 100644
--- a/drivers/staging/rtl8712/usb_ops_linux.c
+++ b/drivers/staging/rtl8712/usb_ops_linux.c
@@ -145,7 +145,7 @@ static unsigned int ffaddr2pipehdl(struct dvobj_priv 
*pdvobj, u32 addr)
break;
}
} else {
-  pipe = 0;
+   pipe = 0;
}
return pipe;
 }
-- 
2.15.1

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


[PATCH v3 2/5] staging: rtl8712: style fix multiple line dereferences

2017-12-19 Thread Martin Homuth
This patch fixes various coding style issues in the rtl8712 module as
noted by checkpatch.pl related to dereferencing over multiple lines.

It fixes the following checkpatch.pl warning:

WARNING: Avoid multiple line dereference - prefer %s

Signed-off-by: Martin Homuth 
---
 drivers/staging/rtl8712/rtl8712_recv.c| 13 +++---
 drivers/staging/rtl8712/rtl871x_cmd.c | 36 
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 61 ++-
 drivers/staging/rtl8712/rtl871x_mlme.c|  9 ++--
 drivers/staging/rtl8712/rtl871x_security.c| 25 +--
 5 files changed, 71 insertions(+), 73 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_recv.c 
b/drivers/staging/rtl8712/rtl8712_recv.c
index 8f555e6e1b3f..4b3eaa4d81ba 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -899,6 +899,7 @@ static void process_link_qual(struct _adapter *padapter,
 {
u32 last_evm = 0, tmpVal;
struct rx_pkt_attrib *pattrib;
+   struct smooth_rssi_data *sqd = &padapter->recvpriv.signal_qual_data;
 
if (prframe == NULL || padapter == NULL)
return;
@@ -918,9 +919,7 @@ static void process_link_qual(struct _adapter *padapter,
}
padapter->recvpriv.signal_qual_data.total_val +=
  pattrib->signal_qual;
-   padapter->recvpriv.signal_qual_data.elements[padapter->
- recvpriv.signal_qual_data.index++] =
- pattrib->signal_qual;
+   sqd->elements[sqd->index++] = pattrib->signal_qual;
if (padapter->recvpriv.signal_qual_data.index >=
PHY_LINKQUALITY_SLID_WIN_MAX)
padapter->recvpriv.signal_qual_data.index = 0;
@@ -936,20 +935,18 @@ static void process_rssi(struct _adapter *padapter, union 
recv_frame *prframe)
 {
u32 last_rssi, tmp_val;
struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib;
+   struct smooth_rssi_data *ssd = &padapter->recvpriv.signal_strength_data;
 
if (padapter->recvpriv.signal_strength_data.total_num++ >=
PHY_RSSI_SLID_WIN_MAX) {
padapter->recvpriv.signal_strength_data.total_num =
 PHY_RSSI_SLID_WIN_MAX;
-   last_rssi = padapter->recvpriv.signal_strength_data.elements
-   [padapter->recvpriv.signal_strength_data.index];
+   last_rssi = ssd->elements[ssd->index];
padapter->recvpriv.signal_strength_data.total_val -= last_rssi;
}
padapter->recvpriv.signal_strength_data.total_val +=
pattrib->signal_strength;
-   padapter->recvpriv.signal_strength_data.elements[padapter->recvpriv.
-   signal_strength_data.index++] =
-   pattrib->signal_strength;
+   ssd->elements[ssd->index++] = pattrib->signal_strength;
if (padapter->recvpriv.signal_strength_data.index >=
PHY_RSSI_SLID_WIN_MAX)
padapter->recvpriv.signal_strength_data.index = 0;
diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c 
b/drivers/staging/rtl8712/rtl871x_cmd.c
index a424f447a725..620cee8b8514 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -455,8 +455,8 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct 
wlan_network *pnetwork)
struct qos_priv *pqospriv = &pmlmepriv->qospriv;
struct security_priv*psecuritypriv = &padapter->securitypriv;
struct registry_priv*pregistrypriv = &padapter->registrypriv;
-   enum NDIS_802_11_NETWORK_INFRASTRUCTURE ndis_network_mode = pnetwork->
-   network.InfrastructureMode;
+   enum NDIS_802_11_NETWORK_INFRASTRUCTURE ndis_network_mode =
+   pnetwork->network.InfrastructureMode;
 
padapter->ledpriv.LedControlHandler(padapter, LED_CTL_START_TO_LINK);
pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
@@ -862,22 +862,22 @@ void r8712_createbss_cmd_callback(struct _adapter 
*padapter,
pnetwork->Privacy = le32_to_cpu(pnetwork->Privacy);
pnetwork->Rssi = le32_to_cpu(pnetwork->Rssi);
pnetwork->NetworkTypeInUse = le32_to_cpu(pnetwork->NetworkTypeInUse);
-   pnetwork->Configuration.ATIMWindow = le32_to_cpu(pnetwork->
-   Configuration.ATIMWindow);
-   pnetwork->Configuration.DSConfig = le32_to_cpu(pnetwork->
-   Configuration.DSConfig);
-   pnetwork->Configuration.FHConfig.DwellTime = le32_to_cpu(pnetwork->
-   Configuration.FHConfig.DwellTime);
-   pnetwork->Configuration.FHConfig.HopPattern = le32_to_cpu(pnetwork->
-   Configuration.FHConfig.HopPattern);
-   pnetwork->Configuration.FHConfig.HopSet = le

[PATCH v3 5/5] staging: rtl8712: style fix returned error code

2017-12-19 Thread Martin Homuth
This patch fixes a coding style issues in the rtl8712 module as noted
by checkpatch.pl regarding the returned error code.

It fixes the following checkpatch.pl warning:

WARNING: ENOSYS means 'invalid syscall nr' and nothing else

Signed-off-by: Martin Homuth 
---
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index ae8c61910b82..ed3a9a8faf9d 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -1856,7 +1856,7 @@ static int dummy(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
 {
-   return -ENOSYS;
+   return -EINVAL;
 }
 
 static int r8711_drvext_hdl(struct net_device *dev,
-- 
2.15.1

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


[PATCH v3 0/5] staging: rtl8712: fix several checkpatch style issues

2017-12-19 Thread Martin Homuth
This patch series fixes some coding style issues reported by checkpatch.pl.

It is based on next-20171218

v2:
 - avoid line-wrapping by thunderbird
 - use temporary pointers to avoid index in separate line ([2/5])

v3:
 - missed one reference simplification ([2/5])
 - fix some checkpatch checks
 - missed one line length warning ([1/5])

Martin Homuth (5):
  staging: rtl8712: style fix over 80 characters warnings
  staging: rtl8712: style fix multiple line dereferences
  staging: rtl8712: style fix indentation
  staging: rtl8712: style fix unneeded else
  staging: rtl8712: style fix returned error code

 drivers/staging/rtl8712/ieee80211.c   |  6 ++-
 drivers/staging/rtl8712/os_intfs.c|  5 +-
 drivers/staging/rtl8712/rtl8712_cmd.c | 18 ---
 drivers/staging/rtl8712/rtl8712_recv.c| 13 ++---
 drivers/staging/rtl8712/rtl8712_xmit.c|  3 +-
 drivers/staging/rtl8712/rtl871x_cmd.c | 36 ++---
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 75 ++-
 drivers/staging/rtl8712/rtl871x_ioctl_set.c   | 72 +
 drivers/staging/rtl8712/rtl871x_mlme.c|  9 ++--
 drivers/staging/rtl8712/rtl871x_mlme.h|  3 +-
 drivers/staging/rtl8712/rtl871x_security.c| 37 ++---
 drivers/staging/rtl8712/usb_ops_linux.c   |  2 +-
 12 files changed, 142 insertions(+), 137 deletions(-)

-- 
2.15.1

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


[PATCH v3 4/5] staging: rtl8712: style fix unneeded else

2017-12-19 Thread Martin Homuth
This patch fixes a coding style issues in the rtl8712 module as noted
by checkpatch.pl where an unnecessary else is used.

It fixes the following checkpatch.pl warning:

WARNING: else is not generally useful after a break or return

Signed-off-by: Martin Homuth 
---
 drivers/staging/rtl8712/rtl871x_ioctl_set.c | 72 ++---
 1 file changed, 35 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_set.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_set.c
index 8a5ced4fa9d3..7797ab19e92d 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_set.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_set.c
@@ -55,6 +55,7 @@ static u8 do_join(struct _adapter *padapter)
u8 *pibss = NULL;
struct  mlme_priv   *pmlmepriv = &(padapter->mlmepriv);
struct  __queue *queue  = &(pmlmepriv->scanned_queue);
+   int ret;
 
phead = &queue->queue;
plist = phead->next;
@@ -74,45 +75,42 @@ static u8 do_join(struct _adapter *padapter)
if (!pmlmepriv->sitesurveyctrl.traffic_busy)
r8712_sitesurvey_cmd(padapter, &pmlmepriv->assoc_ssid);
return true;
-   } else {
-   int ret;
+   }
 
-   ret = r8712_select_and_join_from_scan(pmlmepriv);
-   if (ret == _SUCCESS) {
-   mod_timer(&pmlmepriv->assoc_timer,
- jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT));
+   ret = r8712_select_and_join_from_scan(pmlmepriv);
+   if (ret == _SUCCESS) {
+   mod_timer(&pmlmepriv->assoc_timer,
+ jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT));
+   } else {
+   if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
+   /* submit r8712_createbss_cmd to change to an
+* ADHOC_MASTER pmlmepriv->lock has been
+* acquired by caller...
+*/
+   struct wlan_bssid_ex *pdev_network =
+   &padapter->registrypriv.dev_network;
+   pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE;
+   pibss = padapter->registrypriv.dev_network.MacAddress;
+   memcpy(&pdev_network->Ssid,
+  &pmlmepriv->assoc_ssid,
+  sizeof(struct ndis_802_11_ssid));
+   r8712_update_registrypriv_dev_network(padapter);
+   r8712_generate_random_ibss(pibss);
+   if (r8712_createbss_cmd(padapter) != _SUCCESS)
+   return false;
+   pmlmepriv->to_join = false;
} else {
-   if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
-   /* submit r8712_createbss_cmd to change to an
-* ADHOC_MASTER pmlmepriv->lock has been
-* acquired by caller...
-*/
-   struct wlan_bssid_ex *pdev_network =
-   &(padapter->registrypriv.dev_network);
-   pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE;
-   pibss = padapter->registrypriv.dev_network.
-   MacAddress;
-   memcpy(&pdev_network->Ssid,
-   &pmlmepriv->assoc_ssid,
-   sizeof(struct ndis_802_11_ssid));
-   r8712_update_registrypriv_dev_network(padapter);
-   r8712_generate_random_ibss(pibss);
-   if (r8712_createbss_cmd(padapter) != _SUCCESS)
-   return false;
-   pmlmepriv->to_join = false;
-   } else {
-   /* can't associate ; reset under-linking */
-   if (pmlmepriv->fw_state & _FW_UNDER_LINKING)
-   pmlmepriv->fw_state ^=
-_FW_UNDER_LINKING;
-   /* when set_ssid/set_bssid for do_join(), but
-* there are no desired bss in scanning queue
-* we try to issue sitesurvey first
-*/
-   if (!pmlmepriv->sitesurveyctrl.traffic_busy)
-   r8712_sitesurvey_cmd(padapter,
-  &pmlmepriv->assoc_ssid);
-   }
+   /* can't associate ; reset under-linking */
+   if (pmlmepriv->fw_state & _FW_UNDER_LINKING)
+   pmlmepriv->fw

[PATCH v3 1/5] staging: rtl8712: style fix over 80 characters warnings

2017-12-19 Thread Martin Homuth
This patch fixes various coding style issues in the rtl8712 module as
noted by checkpatch.pl by reducing the characters per line to under
80.

It fixes the following checkpatch.pl warning:

WARNING: line over 80 characters

Signed-off-by: Martin Homuth 
---
 drivers/staging/rtl8712/ieee80211.c|  6 --
 drivers/staging/rtl8712/os_intfs.c |  5 -
 drivers/staging/rtl8712/rtl8712_cmd.c  | 18 ++
 drivers/staging/rtl8712/rtl8712_xmit.c |  3 ++-
 drivers/staging/rtl8712/rtl871x_mlme.c |  3 ++-
 drivers/staging/rtl8712/rtl871x_mlme.h |  3 ++-
 6 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/rtl8712/ieee80211.c 
b/drivers/staging/rtl8712/ieee80211.c
index 33e82a9dd462..1f1d6768f4b1 100644
--- a/drivers/staging/rtl8712/ieee80211.c
+++ b/drivers/staging/rtl8712/ieee80211.c
@@ -169,12 +169,13 @@ int r8712_generate_ie(struct registry_priv *pregistrypriv)
int sz = 0, rate_len;
struct wlan_bssid_ex *pdev_network = &pregistrypriv->dev_network;
u8 *ie = pdev_network->IEs;
+   u16 bp = (u16)pdev_network->Configuration.BeaconPeriod;
 
/*timestamp will be inserted by hardware*/
sz += 8;
ie += sz;
/*beacon interval : 2bytes*/
-   *(__le16 *)ie = 
cpu_to_le16((u16)pdev_network->Configuration.BeaconPeriod);
+   *(__le16 *)ie = cpu_to_le16(bp);
sz += 2;
ie += 2;
/*capability info*/
@@ -221,7 +222,8 @@ unsigned char *r8712_get_wpa_ie(unsigned char *pie, int 
*wpa_ie_len, int limit)
pbuf = r8712_get_ie(pbuf, _WPA_IE_ID_, &len, limit);
if (pbuf) {
/*check if oui matches...*/
-   if (memcmp((pbuf + 2), wpa_oui_type, 
sizeof(wpa_oui_type)))
+   if (memcmp((pbuf + 2), wpa_oui_type,
+  sizeof(wpa_oui_type)))
goto check_next_ie;
/*check version...*/
memcpy((u8 *)&val16, (pbuf + 6), sizeof(val16));
diff --git a/drivers/staging/rtl8712/os_intfs.c 
b/drivers/staging/rtl8712/os_intfs.c
index 95caf8df9a13..e7df5d7986fc 100644
--- a/drivers/staging/rtl8712/os_intfs.c
+++ b/drivers/staging/rtl8712/os_intfs.c
@@ -238,10 +238,13 @@ static u32 start_drv_threads(struct _adapter *padapter)
 
 void r8712_stop_drv_threads(struct _adapter *padapter)
 {
+   struct completion *completion =
+   &padapter->cmdpriv.terminate_cmdthread_comp;
+
/*Below is to terminate r8712_cmd_thread & event_thread...*/
complete(&padapter->cmdpriv.cmd_queue_comp);
if (padapter->cmdThread)
-   
wait_for_completion_interruptible(&padapter->cmdpriv.terminate_cmdthread_comp);
+   wait_for_completion_interruptible(completion);
padapter->cmdpriv.cmd_seq = 1;
 }
 
diff --git a/drivers/staging/rtl8712/rtl8712_cmd.c 
b/drivers/staging/rtl8712/rtl8712_cmd.c
index 3c88994fdfcd..9c8e0c50a804 100644
--- a/drivers/staging/rtl8712/rtl8712_cmd.c
+++ b/drivers/staging/rtl8712/rtl8712_cmd.c
@@ -321,10 +321,13 @@ int r8712_cmd_thread(void *context)
void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj *pcmd);
struct _adapter *padapter = context;
struct  cmd_priv*pcmdpriv = &(padapter->cmdpriv);
+   struct completion *cmd_queue_comp =
+   &pcmdpriv->cmd_queue_comp;
+   struct mutex *pwctrl_lock = &padapter->pwrctrlpriv.mutex_lock;
 
allow_signal(SIGTERM);
while (1) {
-   if 
(wait_for_completion_interruptible(&pcmdpriv->cmd_queue_comp))
+   if (wait_for_completion_interruptible(cmd_queue_comp))
break;
if (padapter->bDriverStopped || padapter->bSurpriseRemoved)
break;
@@ -343,6 +346,7 @@ int r8712_cmd_thread(void *context)
if (pcmd) { /* if pcmd != NULL, cmd will be handled by f/w */
struct dvobj_priv *pdvobj = &padapter->dvobjpriv;
u8 blnPending = 0;
+   u16 cmdcode = pcmd->cmdcode;
 
pcmdpriv->cmd_issued_cnt++;
cmdsz = round_up(pcmd->cmdsz, 8);
@@ -387,20 +391,18 @@ int r8712_cmd_thread(void *context)
r8712_write_mem(padapter, RTL8712_DMA_H2CCMD, wr_sz,
(u8 *)pdesc);
pcmdpriv->cmd_seq++;
-   if (pcmd->cmdcode == GEN_CMD_CODE(_CreateBss)) {
+   if (cmdcode == GEN_CMD_CODE(_CreateBss)) {
pcmd->res = H2C_SUCCESS;
-   pcmd_callback = cmd_callback[pcmd->
-   cmdcode].callback;
+   pcmd_callback = cmd_callback[cmdcode].callback;
if (pcmd_callback)
pcmd_callba

Re: [staging:staging-testing 284/298] drivers/staging/ccree/ssi_driver.c:83:6: error: conflicting types for '__dump_byte_array'

2017-12-19 Thread Greg Kroah-Hartman
On Tue, Dec 19, 2017 at 11:02:33PM +0800, kbuild test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
> staging-testing
> head:   893b103a3e9ce255e9afe8103d90f28ac2124eb8
> commit: 3f268f5d6669b61e38ad65095480cdf80389ae40 [284/298] staging: ccree: 
> turn compile time debug log to params
> config: i386-randconfig-x073-201751 (attached as .config)
> compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
> reproduce:
> git checkout 3f268f5d6669b61e38ad65095480cdf80389ae40
> # save the attached .config to linux build tree
> make ARCH=i386 
> 
> All error/warnings (new ones prefixed by >>):
> 
> >> drivers/staging/ccree/ssi_driver.c:83:6: error: conflicting types for 
> >> '__dump_byte_array'
> void __dump_byte_array(const char *name, const u8 *buf, size_t len)
>  ^
>In file included from drivers/staging/ccree/ssi_driver.c:63:0:
>drivers/staging/ccree/ssi_driver.h:175:6: note: previous declaration of 
> '__dump_byte_array' was here
> void __dump_byte_array(const char *name, const u8 *the_array,
>  ^
>drivers/staging/ccree/ssi_driver.c: In function '__dump_byte_array':
> >> drivers/staging/ccree/ssi_driver.c:90:41: warning: format '%lu' expects 
> >> argument of type 'long unsigned int', but argument 5 has type 'size_t {aka 
> >> unsigned int}' [-Wformat=]
>  snprintf(prefix, sizeof(prefix), "%s[%lu]: ", name, len);
>   ~~^
>   %u
> 

Gilad, can you send me a patch for this?  It should be pretty simple :)

thanks,

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


Re: [PATCH v3 2/5] staging: rtl8712: style fix multiple line dereferences

2017-12-19 Thread Joe Perches
On Tue, 2017-12-19 at 17:32 +0100, Martin Homuth wrote:
> This patch fixes various coding style issues in the rtl8712 module as
> noted by checkpatch.pl related to dereferencing over multiple lines.
[]
> diff --git a/drivers/staging/rtl8712/rtl8712_recv.c 
> b/drivers/staging/rtl8712/rtl8712_recv.c
[]
> @@ -899,6 +899,7 @@ static void process_link_qual(struct _adapter *padapter,
>  {
>   u32 last_evm = 0, tmpVal;
>   struct rx_pkt_attrib *pattrib;
> + struct smooth_rssi_data *sqd = &padapter->recvpriv.signal_qual_data;
>  
>   if (prframe == NULL || padapter == NULL)
>   return;
> @@ -918,9 +919,7 @@ static void process_link_qual(struct _adapter *padapter,
>   }
>   padapter->recvpriv.signal_qual_data.total_val +=
> pattrib->signal_qual;

You missed more than one substitution.

sqd->total_val += pattrib->signal_qual;

> - padapter->recvpriv.signal_qual_data.elements[padapter->
> -   recvpriv.signal_qual_data.index++] =
> -   pattrib->signal_qual;
> + sqd->elements[sqd->index++] = pattrib->signal_qual;
>   if (padapter->recvpriv.signal_qual_data.index >=
>   PHY_LINKQUALITY_SLID_WIN_MAX)
>   padapter->recvpriv.signal_qual_data.index = 0;

And here too

sqd->index = 0;

Dunno if there are more, but if you are
modifying the function, you should do the
appropriate function local sed.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4] staging: lustre: Replace 'uint32_t' with 'u32' and 'uint64_t' with 'u64'

2017-12-19 Thread Roman Storozhenko
There are two reasons for replacing 'uint32_t' with 'u32'
and 'uint64_t' with 'u64':

1) As Linus Torvalds have said we should use kernel types:
http://lkml.iu.edu/hypermail//linux/kernel/1506.0/00160.html

2) There are only few places in the lustre codebase that use such types.
In the most cases it uses 'u32' and 'u64'.

Signed-off-by: Roman Storozhenko 

---
In the third version of that patch Dan Carpenter pointed out that the patch
body should be self-explanatory:
"
> There are two reasons for that:
What I'm asking is there are two reasons for what?  Where is the first
part of that paragraph?
"

In the second version of this patch I forgot to add subsystem and
driver. As Greg K-H mentioned:
"Please fix up the subject to have the subsystem and driver name in it:
Subject: [PATCH] staging: lustre: ..."

In the first version of this patch I replaced 'uint32_t' with '__u32' and
'uint64_t' with '__u64'. I was suggested to fix that by Greg K-H:

"The __ types are only needed for when you cross the user/kernel boundry.
Otherwise just use the "normal" types of u32 and u64.

Do the changes you made here all cross that boundry?  If not, please fix
this up."

I asked lustre community whether those code used only in the kernel
space and Andreas Dilger said:

"These headers are for kernel code only, so should use the "u32" and
similar
types, rather than the "__u32" that are used for user-kernel
structures."

So I have replaced my first patch version with this one.

 drivers/staging/lustre/lustre/include/lustre_sec.h |  4 ++--
 drivers/staging/lustre/lustre/llite/vvp_dev.c  |  2 +-
 drivers/staging/lustre/lustre/lov/lov_internal.h   | 12 ++--
 drivers/staging/lustre/lustre/osc/osc_internal.h   |  6 +++---
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_sec.h 
b/drivers/staging/lustre/lustre/include/lustre_sec.h
index a40f706..64b6fd4 100644
--- a/drivers/staging/lustre/lustre/include/lustre_sec.h
+++ b/drivers/staging/lustre/lustre/include/lustre_sec.h
@@ -341,8 +341,8 @@ void sptlrpc_conf_client_adapt(struct obd_device *obd);
 #define SPTLRPC_MAX_PAYLOAD (1024)
 
 struct vfs_cred {
-   uint32_tvc_uid;
-   uint32_tvc_gid;
+   u32 vc_uid;
+   u32 vc_gid;
 };
 
 struct ptlrpc_ctx_ops {
diff --git a/drivers/staging/lustre/lustre/llite/vvp_dev.c 
b/drivers/staging/lustre/lustre/llite/vvp_dev.c
index 8ccc8b7..987c03b 100644
--- a/drivers/staging/lustre/lustre/llite/vvp_dev.c
+++ b/drivers/staging/lustre/lustre/llite/vvp_dev.c
@@ -384,7 +384,7 @@ int cl_sb_fini(struct super_block *sb)
 struct vvp_pgcache_id {
unsigned int vpi_bucket;
unsigned int vpi_depth;
-   uint32_t vpi_index;
+   u32  vpi_index;
 
unsigned int vpi_curdep;
struct lu_object_header *vpi_obj;
diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h 
b/drivers/staging/lustre/lustre/lov/lov_internal.h
index ae28ddf..a56d71c 100644
--- a/drivers/staging/lustre/lustre/lov/lov_internal.h
+++ b/drivers/staging/lustre/lustre/lov/lov_internal.h
@@ -115,19 +115,19 @@ static inline const struct lsm_operations 
*lsm_op_find(int magic)
  */
 #if BITS_PER_LONG == 64
 # define lov_do_div64(n, base) ({  \
-   uint64_t __base = (base);   \
-   uint64_t __rem; \
-   __rem = ((uint64_t)(n)) % __base;   \
-   (n) = ((uint64_t)(n)) / __base; \
+   u64 __base = (base);\
+   u64 __rem;  \
+   __rem = ((u64)(n)) % __base;\
+   (n) = ((u64)(n)) / __base;  \
__rem;  \
 })
 #elif BITS_PER_LONG == 32
 # define lov_do_div64(n, base) ({  \
-   uint64_t __rem; \
+   u64 __rem;  \
if ((sizeof(base) > 4) && (((base) & 0xULL) != 0)) {  \
int __remainder;  \
LASSERTF(!((base) & (LOV_MIN_STRIPE_SIZE - 1)), "64 bit lov " \
-"division %llu / %llu\n", (n), (uint64_t)(base));\
+"division %llu / %llu\n", (n), (u64)(base));\
__remainder = (n) & (LOV_MIN_STRIPE_SIZE - 1);  \
(n) >>= LOV_MIN_STRIPE_BITS;\
__rem = do_div(n, (base) >> LOV_MIN_STRIPE_BITS);   \
diff --git a/drivers/staging/lustre/lustre/osc/osc_internal.h 
b/drivers/staging/lustre/lustre/osc/osc

[staging:staging-next 284/304] drivers/staging/ccree/ssi_driver.c:90:2: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t'

2017-12-19 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
staging-next
head:   f772fa121d50d980457dc0c37152e30bf60c6452
commit: 3f268f5d6669b61e38ad65095480cdf80389ae40 [284/304] staging: ccree: turn 
compile time debug log to params
config: i386-randconfig-b0-12200126 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
git checkout 3f268f5d6669b61e38ad65095480cdf80389ae40
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/staging/ccree/ssi_driver.c:83:6: error: conflicting types for 
'__dump_byte_array'
void __dump_byte_array(const char *name, const u8 *buf, size_t len)
 ^
   In file included from drivers/staging/ccree/ssi_driver.c:63:0:
   drivers/staging/ccree/ssi_driver.h:175:6: note: previous declaration of 
'__dump_byte_array' was here
void __dump_byte_array(const char *name, const u8 *the_array,
 ^
   drivers/staging/ccree/ssi_driver.c: In function '__dump_byte_array':
>> drivers/staging/ccree/ssi_driver.c:90:2: warning: format '%lu' expects 
>> argument of type 'long unsigned int', but argument 5 has type 'size_t' 
>> [-Wformat=]
 snprintf(prefix, sizeof(prefix), "%s[%lu]: ", name, len);
 ^

vim +90 drivers/staging/ccree/ssi_driver.c

3f268f5d Gilad Ben-Yossef 2017-12-14  82  
3f268f5d Gilad Ben-Yossef 2017-12-14 @83  void __dump_byte_array(const char 
*name, const u8 *buf, size_t len)
abefd674 Gilad Ben-Yossef 2017-04-23  84  {
3f268f5d Gilad Ben-Yossef 2017-12-14  85char prefix[64];
abefd674 Gilad Ben-Yossef 2017-04-23  86  
bdd0873d Gilad Ben-Yossef 2017-10-03  87if (!buf)
abefd674 Gilad Ben-Yossef 2017-04-23  88return;
abefd674 Gilad Ben-Yossef 2017-04-23  89  
bdd0873d Gilad Ben-Yossef 2017-10-03 @90snprintf(prefix, 
sizeof(prefix), "%s[%lu]: ", name, len);
abefd674 Gilad Ben-Yossef 2017-04-23  91  
3f268f5d Gilad Ben-Yossef 2017-12-14  92print_hex_dump(KERN_DEBUG, 
prefix, DUMP_PREFIX_ADDRESS, 16, 1, buf,
3f268f5d Gilad Ben-Yossef 2017-12-14  93   len, false);
abefd674 Gilad Ben-Yossef 2017-04-23  94  }
abefd674 Gilad Ben-Yossef 2017-04-23  95  

:: The code at line 90 was first introduced by commit
:: bdd0873dc28d57651ae2ed4e42bb79526ed684ac staging: ccree: move to generic 
device log infra

:: TO: Gilad Ben-Yossef 
:: CC: Greg Kroah-Hartman 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[-next PATCH 3/4] treewide: Use DEVICE_ATTR_RO

2017-12-19 Thread Joe Perches
Convert DEVICE_ATTR uses to DEVICE_ATTR_RO where possible.

Done with perl script:

$ git grep -w --name-only DEVICE_ATTR | \
  xargs perl -i -e 'local $/; while (<>) { 
s/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,\s*\(?(?:\s*S_IRUGO\s*|\s*0444\s*)\)?\s*,\s*\1_show\s*,\s*NULL\s*\)/DEVICE_ATTR_RO(\1)/g;
 print;}'

Signed-off-by: Joe Perches 
---
 arch/arm/mach-pxa/sharpsl_pm.c   |  4 ++--
 arch/sh/drivers/push-switch.c|  2 +-
 arch/tile/kernel/sysfs.c | 10 +-
 drivers/acpi/device_sysfs.c  |  6 +++---
 drivers/char/ipmi/ipmi_msghandler.c  | 17 -
 drivers/gpu/drm/i915/i915_sysfs.c|  6 +++---
 drivers/nvme/host/core.c | 10 +-
 drivers/s390/cio/css.c   |  8 
 drivers/s390/cio/device.c|  8 
 drivers/s390/crypto/ap_card.c|  2 +-
 drivers/scsi/hpsa.c  | 10 +-
 drivers/scsi/lpfc/lpfc_attr.c| 18 --
 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c |  8 
 drivers/thermal/thermal_sysfs.c  |  6 +++---
 sound/soc/soc-core.c |  2 +-
 sound/soc/soc-dapm.c |  2 +-
 16 files changed, 58 insertions(+), 61 deletions(-)

diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
index 398ba9ba2632..ef9fd9b759cb 100644
--- a/arch/arm/mach-pxa/sharpsl_pm.c
+++ b/arch/arm/mach-pxa/sharpsl_pm.c
@@ -802,8 +802,8 @@ static ssize_t battery_voltage_show(struct device *dev, 
struct device_attribute
return sprintf(buf, "%d\n", sharpsl_pm.battstat.mainbat_voltage);
 }
 
-static DEVICE_ATTR(battery_percentage, 0444, battery_percentage_show, NULL);
-static DEVICE_ATTR(battery_voltage, 0444, battery_voltage_show, NULL);
+static DEVICE_ATTR_RO(battery_percentage);
+static DEVICE_ATTR_RO(battery_voltage);
 
 extern void (*apm_get_power_status)(struct apm_power_info *);
 
diff --git a/arch/sh/drivers/push-switch.c b/arch/sh/drivers/push-switch.c
index a17181160233..762bc5619910 100644
--- a/arch/sh/drivers/push-switch.c
+++ b/arch/sh/drivers/push-switch.c
@@ -24,7 +24,7 @@ static ssize_t switch_show(struct device *dev,
struct push_switch_platform_info *psw_info = dev->platform_data;
return sprintf(buf, "%s\n", psw_info->name);
 }
-static DEVICE_ATTR(switch, S_IRUGO, switch_show, NULL);
+static DEVICE_ATTR_RO(switch);
 
 static void switch_timer(struct timer_list *t)
 {
diff --git a/arch/tile/kernel/sysfs.c b/arch/tile/kernel/sysfs.c
index af5024f0fb5a..b09456a3d77a 100644
--- a/arch/tile/kernel/sysfs.c
+++ b/arch/tile/kernel/sysfs.c
@@ -38,7 +38,7 @@ static ssize_t chip_width_show(struct device *dev,
 {
return sprintf(page, "%u\n", smp_width);
 }
-static DEVICE_ATTR(chip_width, 0444, chip_width_show, NULL);
+static DEVICE_ATTR_RO(chip_width);
 
 static ssize_t chip_height_show(struct device *dev,
struct device_attribute *attr,
@@ -46,7 +46,7 @@ static ssize_t chip_height_show(struct device *dev,
 {
return sprintf(page, "%u\n", smp_height);
 }
-static DEVICE_ATTR(chip_height, 0444, chip_height_show, NULL);
+static DEVICE_ATTR_RO(chip_height);
 
 static ssize_t chip_serial_show(struct device *dev,
struct device_attribute *attr,
@@ -54,7 +54,7 @@ static ssize_t chip_serial_show(struct device *dev,
 {
return get_hv_confstr(page, HV_CONFSTR_CHIP_SERIAL_NUM);
 }
-static DEVICE_ATTR(chip_serial, 0444, chip_serial_show, NULL);
+static DEVICE_ATTR_RO(chip_serial);
 
 static ssize_t chip_revision_show(struct device *dev,
  struct device_attribute *attr,
@@ -62,7 +62,7 @@ static ssize_t chip_revision_show(struct device *dev,
 {
return get_hv_confstr(page, HV_CONFSTR_CHIP_REV);
 }
-static DEVICE_ATTR(chip_revision, 0444, chip_revision_show, NULL);
+static DEVICE_ATTR_RO(chip_revision);
 
 
 static ssize_t type_show(struct device *dev,
@@ -71,7 +71,7 @@ static ssize_t type_show(struct device *dev,
 {
return sprintf(page, "tilera\n");
 }
-static DEVICE_ATTR(type, 0444, type_show, NULL);
+static DEVICE_ATTR_RO(type);
 
 #define HV_CONF_ATTR(name, conf)   \
static ssize_t name ## _show(struct device *dev,\
diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
index a041689e5701..545e91420cde 100644
--- a/drivers/acpi/device_sysfs.c
+++ b/drivers/acpi/device_sysfs.c
@@ -357,7 +357,7 @@ static ssize_t real_power_state_show(struct device *dev,
return sprintf(buf, "%s\n", acpi_power_state_string(state));
 }
 
-static DEVICE_ATTR(real_power_state, 0444, real_power_state_show, NULL);
+static DEVICE_ATTR_RO(real_power_state);
 
 static ssize_t power_state_show(stru

[-next PATCH 0/4] sysfs and DEVICE_ATTR_

2017-12-19 Thread Joe Perches
Joe Perches (4):
  sysfs.h: Use octal permissions
  treewide: Use DEVICE_ATTR_RW
  treewide: Use DEVICE_ATTR_RO
  treewide: Use DEVICE_ATTR_WO

 arch/arm/mach-pxa/sharpsl_pm.c |  4 +-
 arch/s390/kernel/smp.c |  2 +-
 arch/s390/kernel/topology.c|  3 +-
 arch/sh/drivers/push-switch.c  |  2 +-
 arch/tile/kernel/sysfs.c   | 12 ++--
 arch/x86/kernel/cpu/microcode/core.c   |  2 +-
 drivers/acpi/device_sysfs.c|  6 +-
 drivers/char/ipmi/ipmi_msghandler.c| 17 +++---
 drivers/gpu/drm/i915/i915_sysfs.c  | 12 ++--
 drivers/input/touchscreen/elants_i2c.c |  2 +-
 drivers/net/ethernet/ibm/ibmvnic.c |  2 +-
 drivers/net/wimax/i2400m/sysfs.c   |  3 +-
 drivers/nvme/host/core.c   | 10 ++--
 drivers/platform/x86/compal-laptop.c   | 18 ++
 drivers/s390/cio/css.c |  8 +--
 drivers/s390/cio/device.c  | 10 ++--
 drivers/s390/crypto/ap_card.c  |  2 +-
 drivers/scsi/hpsa.c| 10 ++--
 drivers/scsi/lpfc/lpfc_attr.c  | 64 --
 .../staging/media/atomisp/pci/atomisp2/hmm/hmm.c   |  8 +--
 drivers/thermal/thermal_sysfs.c| 17 +++---
 drivers/tty/serial/sh-sci.c|  2 +-
 drivers/usb/host/xhci-dbgcap.c |  2 +-
 drivers/usb/phy/phy-tahvo.c|  2 +-
 drivers/video/fbdev/auo_k190x.c|  4 +-
 drivers/video/fbdev/w100fb.c   |  4 +-
 include/linux/sysfs.h  | 14 ++---
 lib/test_firmware.c| 14 ++---
 lib/test_kmod.c| 14 ++---
 sound/soc/omap/mcbsp.c |  4 +-
 sound/soc/soc-core.c   |  2 +-
 sound/soc/soc-dapm.c   |  2 +-
 32 files changed, 120 insertions(+), 158 deletions(-)

-- 
2.15.0

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


[PATCH] scsi: storvsc: Fix scsi_cmd error assignments in storvsc_handle_error

2017-12-19 Thread Cathy Avery
When an I/O is returned with an srb_status of SRB_STATUS_INVALID_LUN
which has zero good_bytes it must be assigned an error. Otherwise
the I/O will be continuously requeued and will cause a deadlock in the
case where disks are being hot added and removed. sd_probe_async will
wait forever for its I/O to complete while holding scsi_sd_probe_domain.

Also returning the default error of DID_TARGET_FAILURE causes
multipath to not retry the I/O resulting in applications receiving I/O
errors before a failover can occur.

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

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 1b06cf0..3b3d1d0 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -953,10 +953,11 @@ static void storvsc_handle_error(struct vmscsi_request 
*vm_srb,
case TEST_UNIT_READY:
break;
default:
-   set_host_byte(scmnd, DID_TARGET_FAILURE);
+   set_host_byte(scmnd, DID_ERROR);
}
break;
case SRB_STATUS_INVALID_LUN:
+   set_host_byte(scmnd, DID_NO_CONNECT);
do_work = true;
process_err_fn = storvsc_remove_lun;
break;
-- 
2.5.0

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


Re: [PATCH] scsi: storvsc: Fix scsi_cmd error assignments in storvsc_handle_error

2017-12-19 Thread Stephen Hemminger
On Tue, 19 Dec 2017 13:32:48 -0500
Cathy Avery  wrote:

> When an I/O is returned with an srb_status of SRB_STATUS_INVALID_LUN
> which has zero good_bytes it must be assigned an error. Otherwise
> the I/O will be continuously requeued and will cause a deadlock in the
> case where disks are being hot added and removed. sd_probe_async will
> wait forever for its I/O to complete while holding scsi_sd_probe_domain.
> 
> Also returning the default error of DID_TARGET_FAILURE causes
> multipath to not retry the I/O resulting in applications receiving I/O
> errors before a failover can occur.
> 
> Signed-off-by: Cathy Avery 
> Signed-off-by: Long Li 

When working on the DVD probe issue I saw that error handling was
problematic. Thanks for fixing.

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


Re: [-next PATCH 0/4] sysfs and DEVICE_ATTR_

2017-12-19 Thread Jani Nikula
On Tue, 19 Dec 2017, Joe Perches  wrote:
>  drivers/gpu/drm/i915/i915_sysfs.c  | 12 ++--

For i915,

Acked-by: Jani Nikula 


-- 
Jani Nikula, Intel Open Source Technology Center
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: first try to send data with pi433 on Raspberry Pi

2017-12-19 Thread Oliver Graute
On 12/12/17, Marcin Ciupak wrote:
> 
> this is due to fact that pi433_write returns 0 on successful copy while
> it should return 'copied' value. So it is a bug :)
> 
> '0' means nothing was copied so userpsace calls pi433_write again and
> again, data is put to fifo and when it is full it goes to abort and
> returns -EAGAIN and logs message write to fifo failed: 0x0

indeed you are right. I changed the return value and the error is gone!

+++ b/drivers/staging/pi433/pi433_if.c
@@ -845,7 +845,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id)
wake_up_interruptible(&device->tx_wait_queue);
dev_dbg(device->dev, "write: generated new msg with %d bytes.", copied);
 
-   return 0;
+   return copied;

If this is the only change here I can provide a patch. 

Best regards,

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


[PATCH] Staging: rtl8723bs: Do not check for NOT NULL before kfree()

2017-12-19 Thread Shreeya Patel
Do not check for NOT NULL before calling kfree because
if the pointer is NULL, no action occurs.
Done using the following semantic patch by coccinelle.

@@
expression ptr;
@@

- if (ptr != NULL)
  kfree(ptr);

Signed-off-by: Shreeya Patel 
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 9ac2dea..af0a9e0 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -846,9 +846,7 @@ u8 rtw_joinbss_cmd(struct adapter  *padapter, struct 
wlan_network *pnetwork)
 
psecnetwork = (struct wlan_bssid_ex *)&psecuritypriv->sec_bss;
if (psecnetwork == NULL) {
-   if (pcmd != NULL)
-   kfree(pcmd);
-
+   kfree(pcmd);
res = _FAIL;
 
RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd 
:psecnetwork == NULL!!!\n"));
-- 
2.7.4

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


[PATCH v1 1/4] lib/net_utils: Relax NULL-termination requirement on input string

2017-12-19 Thread Andy Shevchenko
We have not been caring about garbage at the end of input string and this
change doesn't affect it. What we prevent here is possibility to go over
boundaries when input string is not NULL terminated at all.

Allow mac_pton() work on non-NULL terminated strings.

Signed-off-by: Andy Shevchenko 
---
 lib/net_utils.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/net_utils.c b/lib/net_utils.c
index af525353395d..d32c6961fe0f 100644
--- a/lib/net_utils.c
+++ b/lib/net_utils.c
@@ -4,12 +4,14 @@
 #include 
 #include 
 
+#define MAC_PTON_MINLEN(3 * ETH_ALEN - 1)
+
 bool mac_pton(const char *s, u8 *mac)
 {
int i;
 
/* XX:XX:XX:XX:XX:XX */
-   if (strlen(s) < 3 * ETH_ALEN - 1)
+   if (strnlen(s, MAC_PTON_MINLEN) < MAC_PTON_MINLEN)
return false;
 
/* Don't dirty result unless string is valid MAC. */
-- 
2.15.1

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


[PATCH v1 4/4] staging: rtl8712: Replace mac address parsing

2017-12-19 Thread Andy Shevchenko
Replace copy_from_user() + mac_pton() with mac_pton_from_user().

Signed-off-by: Andy Shevchenko 
---
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 18 ++
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index e30a5be5f318..3f82c39eb071 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -1953,7 +1953,7 @@ static int r871x_get_ap_info(struct net_device *dev,
struct list_head *plist, *phead;
unsigned char *pbuf;
u8 bssid[ETH_ALEN];
-   char data[33];
+   int ret;
 
if (padapter->bDriverStopped || (pdata == NULL))
return -EINVAL;
@@ -1967,9 +1967,11 @@ static int r871x_get_ap_info(struct net_device *dev,
pdata->flags = 0;
if (pdata->length < 32)
return -EINVAL;
-   if (copy_from_user(data, pdata->pointer, 32))
-   return -EINVAL;
-   data[32] = 0;
+   ret = mac_pton_from_user(pdata->pointer, 32, bssid);
+   if (ret)
+   return ret;
+
+   netdev_info(dev, "r8712u: BSSID:%pM\n", bssid);
 
spin_lock_irqsave(&(pmlmepriv->scanned_queue.lock), irqL);
phead = &queue->queue;
@@ -1978,14 +1980,6 @@ static int r871x_get_ap_info(struct net_device *dev,
if (end_of_queue_search(phead, plist))
break;
pnetwork = container_of(plist, struct wlan_network, list);
-   if (!mac_pton(data, bssid)) {
-   netdev_info(dev, "r8712u: Invalid BSSID '%s'.\n",
-   (u8 *)data);
-   spin_unlock_irqrestore(&(pmlmepriv->scanned_queue.lock),
-  irqL);
-   return -EINVAL;
-   }
-   netdev_info(dev, "r8712u: BSSID:%pM\n", bssid);
if (ether_addr_equal(bssid, pnetwork->network.MacAddress)) {
/* BSSID match, then check if supporting wpa/wpa2 */
pbuf = r8712_get_wpa_ie(&pnetwork->network.IEs[12],
-- 
2.15.1

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


[PATCH v1 3/4] staging: rtl8723bs: Replace mac address parsing

2017-12-19 Thread Andy Shevchenko
Replace copy_from_user() + sscanf() with mac_pton_from_user().

While here, replace memcpy(..., ETH_ALEN) with ether_addr_copy().

Signed-off-by: Andy Shevchenko 
---
 drivers/staging/rtl8723bs/core/rtw_debug.c | 18 ++
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_debug.c 
b/drivers/staging/rtl8723bs/core/rtw_debug.c
index b5dd244fee8f..79ac91a6c3ba 100644
--- a/drivers/staging/rtl8723bs/core/rtw_debug.c
+++ b/drivers/staging/rtl8723bs/core/rtw_debug.c
@@ -380,21 +380,15 @@ ssize_t proc_set_roam_tgt_addr(struct file *file, const 
char __user *buffer, siz
 {
struct net_device *dev = data;
struct adapter *adapter = (struct adapter *)rtw_netdev_priv(dev);
-
-   char tmp[32];
u8 addr[ETH_ALEN];
+   int ret;
 
-   if (count < 1)
-   return -EFAULT;
-
-   if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
-
-   int num = sscanf(tmp, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", addr, 
addr+1, addr+2, addr+3, addr+4, addr+5);
-   if (num == 6)
-   memcpy(adapter->mlmepriv.roam_tgt_addr, addr, ETH_ALEN);
+   ret = mac_pton_from_user(buffer, count, addr);
+   if (ret)
+   return ret;
 
-   DBG_871X("set roam_tgt_addr to "MAC_FMT"\n", 
MAC_ARG(adapter->mlmepriv.roam_tgt_addr));
-   }
+   ether_addr_copy(adapter->mlmepriv.roam_tgt_addr, addr);
+   DBG_871X("set roam_tgt_addr to "MAC_FMT"\n", 
MAC_ARG(adapter->mlmepriv.roam_tgt_addr));
 
return count;
 }
-- 
2.15.1

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


[PATCH v1 2/4] lib/net_utils: Introduce mac_pton_from_user()

2017-12-19 Thread Andy Shevchenko
Some drivers are getting MAC from user space. Make a helper for them.

Signed-off-by: Andy Shevchenko 
---
 include/linux/kernel.h |  1 +
 lib/net_utils.c| 12 
 2 files changed, 13 insertions(+)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index ce51455e2adf..e203b313608d 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -587,6 +587,7 @@ extern int __must_check hex2bin(u8 *dst, const char *src, 
size_t count);
 extern char *bin2hex(char *dst, const void *src, size_t count);
 
 bool mac_pton(const char *s, u8 *mac);
+int __must_check mac_pton_from_user(const char __user *s, size_t count, u8 
*mac);
 
 /*
  * General tracing related utility functions - trace_printk(),
diff --git a/lib/net_utils.c b/lib/net_utils.c
index d32c6961fe0f..7be3483aece6 100644
--- a/lib/net_utils.c
+++ b/lib/net_utils.c
@@ -3,6 +3,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define MAC_PTON_MINLEN(3 * ETH_ALEN - 1)
 
@@ -27,3 +28,14 @@ bool mac_pton(const char *s, u8 *mac)
return true;
 }
 EXPORT_SYMBOL(mac_pton);
+
+int mac_pton_from_user(const char __user *s, size_t count, u8 *mac)
+{
+   char buf[MAC_PTON_MINLEN];
+
+   count = min(count, sizeof(buf));
+   if (copy_from_user(buf, s, count))
+   return -EFAULT;
+   return mac_pton(buf, mac) ? 0 : -EINVAL;
+}
+EXPORT_SYMBOL(mac_pton_from_user);
-- 
2.15.1

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


Re: first try to send data with pi433 on Raspberry Pi

2017-12-19 Thread Marcin Ciupak
On Tue, Dec 19, 2017 at 07:59:33PM +0100, Oliver Graute wrote:
> On 12/12/17, Marcin Ciupak wrote:
> > 
> > this is due to fact that pi433_write returns 0 on successful copy while
> > it should return 'copied' value. So it is a bug :)
> > 
> > '0' means nothing was copied so userpsace calls pi433_write again and
> > again, data is put to fifo and when it is full it goes to abort and
> > returns -EAGAIN and logs message write to fifo failed: 0x0
> 
> indeed you are right. I changed the return value and the error is gone!
> 
> +++ b/drivers/staging/pi433/pi433_if.c
> @@ -845,7 +845,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id)
>   wake_up_interruptible(&device->tx_wait_queue);
>   dev_dbg(device->dev, "write: generated new msg with %d bytes.", copied);
>  
> - return 0;
> + return copied;
> 
> If this is the only change here I can provide a patch. 
> 
> Best regards,
> 
> Oliver
Yes, please provide the patch if you can. You can use Reported-by me.

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


Re: [-next PATCH 0/4] sysfs and DEVICE_ATTR_

2017-12-19 Thread Corey Minyard

On 12/19/2017 12:15 PM, Joe Perches wrote:

  drivers/char/ipmi/ipmi_msghandler.c| 17 +++---


For ipmi:

Acked-by: Corey Minyard 

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


[PATCH] staging: pi433: pi433_write fixed the return value

2017-12-19 Thread Oliver Graute
The pi433_write function should return the number of processed bytes.
This fix endless sending if write is invoked from userspace.

Signed-off-by: Oliver Graute 
---
 drivers/staging/pi433/pi433_if.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 1f3ba55..109b9ea 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -845,7 +845,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id)
wake_up_interruptible(&device->tx_wait_queue);
dev_dbg(device->dev, "write: generated new msg with %d bytes.", copied);
 
-   return 0;
+   return copied;
 
 abort:
dev_dbg(device->dev, "write to fifo failed: 0x%x", retval);
-- 
1.9.1

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


[PATCH 0/3] staging: greybus: Fix multiple checkpatch errors

2017-12-19 Thread Kamal Heib
This patch set fixes multiple error found by checkpatch.pl in the
greybus drivers.

Kamal Heib (3):
  staging: greybus: arche-apb-ctrl.c: Fix multiple blank lines error
  staging: greybus: audio_codec.c: Fix multiple checkpatch errors
  staging: greybus: audio_codec.h: Fix multiple checkpatch errors

 drivers/staging/greybus/arche-apb-ctrl.c |  1 -
 drivers/staging/greybus/audio_codec.c| 23 ++-
 drivers/staging/greybus/audio_codec.h| 12 ++--
 3 files changed, 16 insertions(+), 20 deletions(-)

-- 
2.14.3

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


[PATCH 1/3] staging: greybus: arche-apb-ctrl.c: Fix multiple blank lines error

2017-12-19 Thread Kamal Heib
Fix "don't use multiple blank lines" error found by checkpatch.pl.

Signed-off-by: Kamal Heib 
---
 drivers/staging/greybus/arche-apb-ctrl.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/greybus/arche-apb-ctrl.c 
b/drivers/staging/greybus/arche-apb-ctrl.c
index cc8d6fc831b4..be5ffed90bcf 100644
--- a/drivers/staging/greybus/arche-apb-ctrl.c
+++ b/drivers/staging/greybus/arche-apb-ctrl.c
@@ -20,7 +20,6 @@
 #include 
 #include "arche_platform.h"
 
-
 static void apb_bootret_deassert(struct device *dev);
 
 struct arche_apb_ctrl_drvdata {
-- 
2.14.3

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


[PATCH 2/3] staging: greybus: audio_codec.c: Fix multiple checkpatch errors

2017-12-19 Thread Kamal Heib
This patch fixes the following errors found by checkpatch:
1- Prefer kernel type 'u32' over 'uint32_t'.
2- Space required around that ':'.
3- Alignment should match open parenthesis.
4- Don't use multiple blank lines.

Signed-off-by: Kamal Heib 
---
 drivers/staging/greybus/audio_codec.c | 23 ++-
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/greybus/audio_codec.c 
b/drivers/staging/greybus/audio_codec.c
index fdb9e83cc34b..35acd55ca5ab 100644
--- a/drivers/staging/greybus/audio_codec.c
+++ b/drivers/staging/greybus/audio_codec.c
@@ -47,7 +47,7 @@ static int gbaudio_module_enable_tx(struct gbaudio_codec_info 
*codec,
int module_state, ret = 0;
u16 data_cport, i2s_port, cportid;
u8 sig_bits, channels;
-   uint32_t format, rate;
+   u32 format, rate;
struct gbaudio_data_connection *data;
struct gbaudio_stream_params *params;
 
@@ -182,7 +182,7 @@ static int gbaudio_module_enable_rx(struct 
gbaudio_codec_info *codec,
int module_state, ret = 0;
u16 data_cport, i2s_port, cportid;
u8 sig_bits, channels;
-   uint32_t format, rate;
+   u32 format, rate;
struct gbaudio_data_connection *data;
struct gbaudio_stream_params *params;
 
@@ -319,7 +319,7 @@ int gbaudio_module_update(struct gbaudio_codec_info *codec,
char intf_name[NAME_SIZE], dir[NAME_SIZE];
 
dev_dbg(module->dev, "%s:Module update %s sequence\n", w->name,
-   enable ? "Enable":"Disable");
+   enable ? "Enable" : "Disable");
 
if ((w->id != snd_soc_dapm_aif_in) && (w->id != snd_soc_dapm_aif_out)) {
dev_dbg(codec->dev, "No action required for %s\n", w->name);
@@ -412,7 +412,7 @@ static int gbcodec_hw_params(struct snd_pcm_substream 
*substream,
 {
int ret;
u8 sig_bits, channels;
-   uint32_t format, rate;
+   u32 format, rate;
struct gbaudio_module_info *module;
struct gbaudio_data_connection *data;
struct gb_bundle *bundle;
@@ -567,7 +567,7 @@ static int gbcodec_prepare(struct snd_pcm_substream 
*substream,
if (ret) {
mutex_unlock(&codec->lock);
dev_err_ratelimited(dai->dev, "set_data_size failed:%d\n",
-ret);
+   ret);
return ret;
}
 
@@ -587,9 +587,8 @@ static int gbcodec_mute_stream(struct snd_soc_dai *dai, int 
mute, int stream)
struct gbaudio_codec_info *codec = dev_get_drvdata(dai->dev);
struct gbaudio_stream_params *params;
 
-
dev_dbg(dai->dev, "Mute:%d, Direction:%s\n", mute,
-   stream ? "CAPTURE":"PLAYBACK");
+   stream ? "CAPTURE" : "PLAYBACK");
 
mutex_lock(&codec->lock);
 
@@ -827,7 +826,7 @@ int gbaudio_register_module(struct gbaudio_module_info 
*module)
  module->num_dapm_widgets);
if (module->controls)
snd_soc_add_codec_controls(codec, module->controls,
-module->num_controls);
+  module->num_controls);
if (module->dapm_routes)
snd_soc_dapm_add_routes(&codec->dapm, module->dapm_routes,
module->num_dapm_routes);
@@ -842,8 +841,8 @@ int gbaudio_register_module(struct gbaudio_module_info 
*module)
 * from codec->jack_list
 */
list_for_each_entry(jack, &codec->jack_list, list) {
-   if ((jack == &module->headset_jack)
-   || (jack == &module->button_jack))
+   if ((jack == &module->headset_jack) ||
+   (jack == &module->button_jack))
snd_device_register(codec->card->snd_card,
jack->jack);
}
@@ -907,7 +906,6 @@ static void gbaudio_codec_clean_data_rx(struct 
gbaudio_data_connection *data)
data->state[1] = GBAUDIO_CODEC_SHUTDOWN;
 }
 
-
 static void gbaudio_codec_cleanup(struct gbaudio_module_info *module)
 {
struct gbaudio_data_connection *data;
@@ -923,7 +921,6 @@ static void gbaudio_codec_cleanup(struct 
gbaudio_module_info *module)
 
if (cap_state > GBAUDIO_CODEC_SHUTDOWN)
gbaudio_codec_clean_data_rx(data);
-
}
 }
 
@@ -972,7 +969,7 @@ void gbaudio_unregister_module(struct gbaudio_module_info 
*module)
dev_dbg(codec->dev, "Removing %d controls\n",
module->num_controls);
snd_soc_remove_codec_controls(codec, module->controls,
- module->num_controls);
+ module->num_controls);
}
if (module->dapm_widgets) {
dev_dbg(codec->dev, "Removing %d w

[PATCH 3/3] staging: greybus: audio_codec.h: Fix multiple checkpatch errors

2017-12-19 Thread Kamal Heib
This patch fixes the following errors found by checkpatch:
1- Prefer kernel type 'u32' over 'uint32_t'.
2- Alignment should match open parenthesis.

Signed-off-by: Kamal Heib 
---
 drivers/staging/greybus/audio_codec.h | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/greybus/audio_codec.h 
b/drivers/staging/greybus/audio_codec.h
index 161b37c8ef17..a1d5440552d4 100644
--- a/drivers/staging/greybus/audio_codec.h
+++ b/drivers/staging/greybus/audio_codec.h
@@ -53,7 +53,7 @@ enum gbaudio_codec_state {
 struct gbaudio_stream_params {
int state;
u8 sig_bits, channels;
-   uint32_t format, rate;
+   u32 format, rate;
 };
 
 struct gbaudio_codec_dai {
@@ -159,7 +159,7 @@ struct gbaudio_module_info {
 };
 
 int gbaudio_tplg_parse_data(struct gbaudio_module_info *module,
-  struct gb_audio_topology *tplg_data);
+   struct gb_audio_topology *tplg_data);
 void gbaudio_tplg_release(struct gbaudio_module_info *module);
 
 int gbaudio_module_update(struct gbaudio_codec_info *codec,
@@ -183,12 +183,12 @@ extern int gb_audio_gb_enable_widget(struct gb_connection 
*connection,
 extern int gb_audio_gb_disable_widget(struct gb_connection *connection,
  u8 widget_id);
 extern int gb_audio_gb_get_pcm(struct gb_connection *connection,
-  u16 data_cport, uint32_t *format,
-  uint32_t *rate, u8 *channels,
+  u16 data_cport, u32 *format,
+  u32 *rate, u8 *channels,
   u8 *sig_bits);
 extern int gb_audio_gb_set_pcm(struct gb_connection *connection,
-  u16 data_cport, uint32_t format,
-  uint32_t rate, u8 channels,
+  u16 data_cport, u32 format,
+  u32 rate, u8 channels,
   u8 sig_bits);
 extern int gb_audio_gb_set_tx_data_size(struct gb_connection *connection,
u16 data_cport, u16 size);
-- 
2.14.3

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


[PATCHv2] staging: pi433: pi433_write fixed the return value

2017-12-19 Thread Oliver Graute
The pi433_write function should return the number of processed bytes

Reported-by: Marcin Ciupak 
Signed-off-by: Oliver Graute 
---
Changes in v2:

- added Reported-By Tag

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

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 1f3ba55..109b9ea 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -845,7 +845,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id)
wake_up_interruptible(&device->tx_wait_queue);
dev_dbg(device->dev, "write: generated new msg with %d bytes.", copied);
 
-   return 0;
+   return copied;
 
 abort:
dev_dbg(device->dev, "write to fifo failed: 0x%x", retval);
-- 
1.9.1

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


Re: [PATCH v3 2/5] staging: rtl8712: style fix multiple line dereferences

2017-12-19 Thread Martin Homuth
On 12/19/2017 05:41 PM, Joe Perches wrote:
> On Tue, 2017-12-19 at 17:32 +0100, Martin Homuth wrote:
>> This patch fixes various coding style issues in the rtl8712 module as
>> noted by checkpatch.pl related to dereferencing over multiple lines.
> []
>> diff --git a/drivers/staging/rtl8712/rtl8712_recv.c 
>> b/drivers/staging/rtl8712/rtl8712_recv.c
> []
>> @@ -899,6 +899,7 @@ static void process_link_qual(struct _adapter *padapter,
>>  {
>>  u32 last_evm = 0, tmpVal;
>>  struct rx_pkt_attrib *pattrib;
>> +struct smooth_rssi_data *sqd = &padapter->recvpriv.signal_qual_data;
>>  
>>  if (prframe == NULL || padapter == NULL)
>>  return;
>> @@ -918,9 +919,7 @@ static void process_link_qual(struct _adapter *padapter,
>>  }
>>  padapter->recvpriv.signal_qual_data.total_val +=
>>pattrib->signal_qual;
> 
> You missed more than one substitution.
> 
>   sqd->total_val += pattrib->signal_qual;
> 
>> -padapter->recvpriv.signal_qual_data.elements[padapter->
>> -  recvpriv.signal_qual_data.index++] =
>> -  pattrib->signal_qual;
>> +sqd->elements[sqd->index++] = pattrib->signal_qual;
>>  if (padapter->recvpriv.signal_qual_data.index >=
>>  PHY_LINKQUALITY_SLID_WIN_MAX)
>>  padapter->recvpriv.signal_qual_data.index = 0;
> 
> And here too
> 
>   sqd->index = 0;
> 
> Dunno if there are more, but if you are
> modifying the function, you should do the
> appropriate function local sed.
> 

Of course! For some reason I figured further changes within that
function would break the original reason for the change (as the other
changes wouldn't fix checkpatch errors) but it totally makes sense.
Sorry for the noise, v4 will contain the final fixes regarding this matter.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v2 3/8] media: v4l2-async: simplify v4l2_async_subdev structure

2017-12-19 Thread Hyun Kwon
Hi Mauro,

Thanks for the patch.

> -Original Message-
> From: Mauro Carvalho Chehab [mailto:mche...@smtp.s-opensource.com]
> On Behalf Of Mauro Carvalho Chehab
> Sent: Tuesday, December 19, 2017 3:18 AM
> To: Linux Media Mailing List 
> Cc: Mauro Carvalho Chehab ; Mauro
> Carvalho Chehab ; Lad, Prabhakar
> ; Songjun Wu
> ; Nicolas Ferre
> ; Alexandre Belloni  electrons.com>; Ludovic Desroches ;
> Kyungmin Park ; Sylwester Nawrocki
> ; Kukjin Kim ; Krzysztof
> Kozlowski ; Todor Tomov ;
> Niklas Söderlund ; Ramesh
> Shanmugasundaram ;
> Guennadi Liakhovetski ; Maxime Coquelin
> ; Alexandre Torgue
> ; Benoit Parrot ; Hyun Kwon
> ; Laurent Pinchart
> ; Michal Simek
> ; Steve Longerbeam ;
> Philipp Zabel ; Greg Kroah-Hartman
> ; Hans Verkuil ; Petr
> Cvek ; Sakari Ailus ; Julia Lawall
> ; Arnd Bergmann ; Hugues Fruchet
> ; Gustavo A. R. Silva
> ; Sebastian Reichel ; Tomasz
> Figa ; linux-arm-ker...@lists.infradead.org; linux-
> samsung-...@vger.kernel.org; linux-renesas-...@vger.kernel.org;
> de...@driverdev.osuosl.org
> Subject: [PATCH v2 3/8] media: v4l2-async: simplify v4l2_async_subdev
> structure
> 
> The V4L2_ASYNC_MATCH_FWNODE match criteria requires just one
> struct to be filled (struct fwnode_handle). The
> V4L2_ASYNC_MATCH_DEVNAME
> match criteria requires just a device name.
> 
> So, it doesn't make sense to enclose those into structs,
> as the criteria can go directly into the union.
> 
> That makes easier to document it, as we don't need to document
> weird senseless structs.
> 
> At drivers, this makes even clearer about the match criteria.
> 
> Acked-by: Sylwester Nawrocki 
> Acked-by: Benoit Parrot 
> Acked-by: Alexandre Belloni 
> Acked-by: Sakari Ailus 
> Acked-by: Philipp Zabel 
> Signed-off-by: Mauro Carvalho Chehab 

For xilinx-vipp.c, please add,

Acked-by: Hyun Kwon 

Thanks,
-hyun

> ---
>  drivers/media/platform/am437x/am437x-vpfe.c|  6 +++---
>  drivers/media/platform/atmel/atmel-isc.c   |  2 +-
>  drivers/media/platform/atmel/atmel-isi.c   |  2 +-
>  drivers/media/platform/davinci/vpif_capture.c  |  4 ++--
>  drivers/media/platform/exynos4-is/media-dev.c  |  4 ++--
>  drivers/media/platform/pxa_camera.c|  2 +-
>  drivers/media/platform/qcom/camss-8x16/camss.c |  2 +-
>  drivers/media/platform/rcar-vin/rcar-core.c|  2 +-
>  drivers/media/platform/rcar_drif.c |  4 ++--
>  drivers/media/platform/soc_camera/soc_camera.c |  2 +-
>  drivers/media/platform/stm32/stm32-dcmi.c  |  2 +-
>  drivers/media/platform/ti-vpe/cal.c|  2 +-
>  drivers/media/platform/xilinx/xilinx-vipp.c|  2 +-
>  drivers/media/v4l2-core/v4l2-async.c   | 16 
>  drivers/media/v4l2-core/v4l2-fwnode.c  | 10 +-
>  drivers/staging/media/imx/imx-media-dev.c  |  4 ++--
>  include/media/v4l2-async.h |  8 ++--
>  17 files changed, 35 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/media/platform/am437x/am437x-vpfe.c
> b/drivers/media/platform/am437x/am437x-vpfe.c
> index 0997c640191d..601ae6487617 100644
> --- a/drivers/media/platform/am437x/am437x-vpfe.c
> +++ b/drivers/media/platform/am437x/am437x-vpfe.c
> @@ -2304,8 +2304,8 @@ vpfe_async_bound(struct v4l2_async_notifier
> *notifier,
>   vpfe_dbg(1, vpfe, "vpfe_async_bound\n");
> 
>   for (i = 0; i < ARRAY_SIZE(vpfe->cfg->asd); i++) {
> - if (vpfe->cfg->asd[i]->match.fwnode.fwnode ==
> - asd[i].match.fwnode.fwnode) {
> + if (vpfe->cfg->asd[i]->match.fwnode ==
> + asd[i].match.fwnode) {
>   sdinfo = &vpfe->cfg->sub_devs[i];
>   vpfe->sd[i] = subdev;
>   vpfe->sd[i]->grp_id = sdinfo->grp_id;
> @@ -2510,7 +2510,7 @@ vpfe_get_pdata(struct platform_device *pdev)
>   }
> 
>   pdata->asd[i]->match_type =
> V4L2_ASYNC_MATCH_FWNODE;
> - pdata->asd[i]->match.fwnode.fwnode =
> of_fwnode_handle(rem);
> + pdata->asd[i]->match.fwnode = of_fwnode_handle(rem);
>   of_node_put(rem);
>   }
> 
> diff --git a/drivers/media/platform/atmel/atmel-isc.c
> b/drivers/media/platform/atmel/atmel-isc.c
> index 0c2635647f69..34676409ca08 100644
> --- a/drivers/media/platform/atmel/atmel-isc.c
> +++ b/drivers/media/platform/atmel/atmel-isc.c
> @@ -2088,7 +2088,7 @@ static int isc_parse_dt(struct device *dev, struct
> isc_device *isc)
>   subdev_entity->pfe_cfg0 |=
> ISC_PFE_CFG0_PPOL_LOW;
> 
>   subdev_entity->asd->match_type =
> V4L2_ASYNC_MATCH_FWNODE;
> - subdev_entity->asd->match.fwnode.fwnode =
> + subdev_entity->asd->match.fwnode =
>   of_fwnode_handle(rem);
>   list_add_tail(&subdev_entity->list, &isc->subdev_entities);
>   }
> diff --git a/drivers/media/platform/atmel/atmel-isi.c
> b/drivers/media/platform/atmel/atmel-isi.c
> index e900995143a3..9958918e2449 100644
> --- a/

[PATCH v4 3/5] staging: rtl8712: style fix indentation

2017-12-19 Thread Martin Homuth
This patch fixes various coding style issues in the rtl8712 module as
noted by checkpatch.pl related to indentation.

It fixes the following checkpatch.pl warning:

WARNING: suspect code indent for conditional statements

Signed-off-by: Martin Homuth 
---
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 12 ++--
 drivers/staging/rtl8712/rtl871x_security.c| 12 ++--
 drivers/staging/rtl8712/usb_ops_linux.c   |  2 +-
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index 294b206a3f18..855b46e766f3 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -1719,12 +1719,12 @@ static int r871x_wx_set_auth(struct net_device *dev,
 */
if (padapter->securitypriv.ndisencryptstatus ==
Ndis802_11Encryption1Enabled) {
-   /* it means init value, or using wep,
-* ndisencryptstatus =
-*  Ndis802_11Encryption1Enabled,
-* then it needn't reset it;
-*/
-   break;
+   /* it means init value, or using wep,
+* ndisencryptstatus =
+*  Ndis802_11Encryption1Enabled,
+* then it needn't reset it;
+*/
+   break;
}
 
if (paramval) {
diff --git a/drivers/staging/rtl8712/rtl871x_security.c 
b/drivers/staging/rtl8712/rtl871x_security.c
index fff0acf7954d..7bc74d7d8a3a 100644
--- a/drivers/staging/rtl8712/rtl871x_security.c
+++ b/drivers/staging/rtl8712/rtl871x_security.c
@@ -1069,16 +1069,16 @@ static sint aes_cipher(u8 *key, uinthdrlen,
if ((frtype == WIFI_DATA_CFACK) ||
 (frtype == WIFI_DATA_CFPOLL) ||
 (frtype == WIFI_DATA_CFACKPOLL)) {
-   qc_exists = 1;
-   if (hdrlen !=  WLAN_HDR_A3_QOS_LEN)
-   hdrlen += 2;
+   qc_exists = 1;
+   if (hdrlen !=  WLAN_HDR_A3_QOS_LEN)
+   hdrlen += 2;
} else if ((frsubtype == 0x08) ||
   (frsubtype == 0x09) ||
   (frsubtype == 0x0a) ||
   (frsubtype == 0x0b)) {
-   if (hdrlen !=  WLAN_HDR_A3_QOS_LEN)
-   hdrlen += 2;
-   qc_exists = 1;
+   if (hdrlen !=  WLAN_HDR_A3_QOS_LEN)
+   hdrlen += 2;
+   qc_exists = 1;
} else {
qc_exists = 0;
}
diff --git a/drivers/staging/rtl8712/usb_ops_linux.c 
b/drivers/staging/rtl8712/usb_ops_linux.c
index 441e76b8959d..6d12a96fa65f 100644
--- a/drivers/staging/rtl8712/usb_ops_linux.c
+++ b/drivers/staging/rtl8712/usb_ops_linux.c
@@ -145,7 +145,7 @@ static unsigned int ffaddr2pipehdl(struct dvobj_priv 
*pdvobj, u32 addr)
break;
}
} else {
-  pipe = 0;
+   pipe = 0;
}
return pipe;
 }
-- 
2.15.1

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


[PATCH v4 2/5] staging: rtl8712: style fix multiple line dereferences

2017-12-19 Thread Martin Homuth
This patch fixes various coding style issues in the rtl8712 module as
noted by checkpatch.pl related to dereferencing over multiple lines.

It fixes the following checkpatch.pl warning:

WARNING: Avoid multiple line dereference - prefer %s

Signed-off-by: Martin Homuth 
---
 drivers/staging/rtl8712/rtl8712_recv.c| 55 ++--
 drivers/staging/rtl8712/rtl871x_cmd.c | 36 +--
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 92 +--
 drivers/staging/rtl8712/rtl871x_mlme.c|  9 +--
 drivers/staging/rtl8712/rtl871x_security.c| 25 
 5 files changed, 100 insertions(+), 117 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_recv.c 
b/drivers/staging/rtl8712/rtl8712_recv.c
index 8f555e6e1b3f..4264cd341f03 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -899,6 +899,7 @@ static void process_link_qual(struct _adapter *padapter,
 {
u32 last_evm = 0, tmpVal;
struct rx_pkt_attrib *pattrib;
+   struct smooth_rssi_data *sqd = &padapter->recvpriv.signal_qual_data;
 
if (prframe == NULL || padapter == NULL)
return;
@@ -907,27 +908,18 @@ static void process_link_qual(struct _adapter *padapter,
/*
 * 1. Record the general EVM to the sliding window.
 */
-   if (padapter->recvpriv.signal_qual_data.total_num++ >=
- PHY_LINKQUALITY_SLID_WIN_MAX) {
-   padapter->recvpriv.signal_qual_data.total_num =
- PHY_LINKQUALITY_SLID_WIN_MAX;
-   last_evm = padapter->recvpriv.signal_qual_data.elements
- [padapter->recvpriv.signal_qual_data.index];
-   padapter->recvpriv.signal_qual_data.total_val -=
- last_evm;
+   if (sqd->total_num++ >= PHY_LINKQUALITY_SLID_WIN_MAX) {
+   sqd->total_num = PHY_LINKQUALITY_SLID_WIN_MAX;
+   last_evm = sqd->elements[sqd->index];
+   sqd->total_val -= last_evm;
}
-   padapter->recvpriv.signal_qual_data.total_val +=
- pattrib->signal_qual;
-   padapter->recvpriv.signal_qual_data.elements[padapter->
- recvpriv.signal_qual_data.index++] =
- pattrib->signal_qual;
-   if (padapter->recvpriv.signal_qual_data.index >=
-   PHY_LINKQUALITY_SLID_WIN_MAX)
-   padapter->recvpriv.signal_qual_data.index = 0;
+   sqd->total_val += pattrib->signal_qual;
+   sqd->elements[sqd->index++] = pattrib->signal_qual;
+   if (sqd->index >= PHY_LINKQUALITY_SLID_WIN_MAX)
+   sqd->index = 0;
 
/* <1> Showed on UI for user, in percentage. */
-   tmpVal = padapter->recvpriv.signal_qual_data.total_val /
-padapter->recvpriv.signal_qual_data.total_num;
+   tmpVal = sqd->total_val / sqd->total_num;
padapter->recvpriv.signal = (u8)tmpVal;
}
 }
@@ -936,25 +928,18 @@ static void process_rssi(struct _adapter *padapter, union 
recv_frame *prframe)
 {
u32 last_rssi, tmp_val;
struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib;
+   struct smooth_rssi_data *ssd = &padapter->recvpriv.signal_strength_data;
 
-   if (padapter->recvpriv.signal_strength_data.total_num++ >=
-   PHY_RSSI_SLID_WIN_MAX) {
-   padapter->recvpriv.signal_strength_data.total_num =
-PHY_RSSI_SLID_WIN_MAX;
-   last_rssi = padapter->recvpriv.signal_strength_data.elements
-   [padapter->recvpriv.signal_strength_data.index];
-   padapter->recvpriv.signal_strength_data.total_val -= last_rssi;
+   if (ssd->total_num++ >= PHY_RSSI_SLID_WIN_MAX) {
+   ssd->total_num = PHY_RSSI_SLID_WIN_MAX;
+   last_rssi = ssd->elements[ssd->index];
+   ssd->total_val -= last_rssi;
}
-   padapter->recvpriv.signal_strength_data.total_val +=
-   pattrib->signal_strength;
-   padapter->recvpriv.signal_strength_data.elements[padapter->recvpriv.
-   signal_strength_data.index++] =
-   pattrib->signal_strength;
-   if (padapter->recvpriv.signal_strength_data.index >=
-   PHY_RSSI_SLID_WIN_MAX)
-   padapter->recvpriv.signal_strength_data.index = 0;
-   tmp_val = padapter->recvpriv.signal_strength_data.total_val /
- padapter->recvpriv.signal_strength_data.total_num;
+   ssd->total_val += pattrib->signal_strength;
+   ssd->elements[ssd->index++] = pattrib->signal_strength;
+   if (ssd->index >= PHY_RSSI_SLID_WIN_MAX)
+   ssd->index

[PATCH v4 0/5] staging: rtl8712: fix several checkpatch style issues

2017-12-19 Thread Martin Homuth
This patch series fixes some coding style issues reported by checkpatch.pl.

It is based on next-20171218

v2:
 - avoid line-wrapping by thunderbird
 - use temporary pointers to avoid index in separate line ([2/5])

v3:
 - missed one reference simplification ([2/5])
 - fix some checkpatch checks
 - missed one line length warning ([1/5])

v4:
 - fix remaining reference simplifications ([2/5])

Martin Homuth (5):
  staging: rtl8712: style fix over 80 characters warnings
  staging: rtl8712: style fix multiple line dereferences
  staging: rtl8712: style fix indentation
  staging: rtl8712: style fix unneeded else
  staging: rtl8712: style fix returned error code

 drivers/staging/rtl8712/ieee80211.c   |  6 +-
 drivers/staging/rtl8712/os_intfs.c|  5 +-
 drivers/staging/rtl8712/rtl8712_cmd.c | 18 ++---
 drivers/staging/rtl8712/rtl8712_recv.c| 55 ++-
 drivers/staging/rtl8712/rtl8712_xmit.c|  3 +-
 drivers/staging/rtl8712/rtl871x_cmd.c | 36 +-
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 98 +--
 drivers/staging/rtl8712/rtl871x_ioctl_set.c   | 72 ++--
 drivers/staging/rtl8712/rtl871x_mlme.c| 12 ++--
 drivers/staging/rtl8712/rtl871x_mlme.h|  3 +-
 drivers/staging/rtl8712/rtl871x_security.c| 37 +-
 drivers/staging/rtl8712/usb_ops_linux.c   |  2 +-
 12 files changed, 169 insertions(+), 178 deletions(-)

-- 
2.15.1

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


[PATCH v4 1/5] staging: rtl8712: style fix over 80 characters warnings

2017-12-19 Thread Martin Homuth
This patch fixes various coding style issues in the rtl8712 module as
noted by checkpatch.pl by reducing the characters per line to under
80.

It fixes the following checkpatch.pl warning:

WARNING: line over 80 characters

Signed-off-by: Martin Homuth 
---
 drivers/staging/rtl8712/ieee80211.c|  6 --
 drivers/staging/rtl8712/os_intfs.c |  5 -
 drivers/staging/rtl8712/rtl8712_cmd.c  | 18 ++
 drivers/staging/rtl8712/rtl8712_xmit.c |  3 ++-
 drivers/staging/rtl8712/rtl871x_mlme.c |  3 ++-
 drivers/staging/rtl8712/rtl871x_mlme.h |  3 ++-
 6 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/rtl8712/ieee80211.c 
b/drivers/staging/rtl8712/ieee80211.c
index 33e82a9dd462..1f1d6768f4b1 100644
--- a/drivers/staging/rtl8712/ieee80211.c
+++ b/drivers/staging/rtl8712/ieee80211.c
@@ -169,12 +169,13 @@ int r8712_generate_ie(struct registry_priv *pregistrypriv)
int sz = 0, rate_len;
struct wlan_bssid_ex *pdev_network = &pregistrypriv->dev_network;
u8 *ie = pdev_network->IEs;
+   u16 bp = (u16)pdev_network->Configuration.BeaconPeriod;
 
/*timestamp will be inserted by hardware*/
sz += 8;
ie += sz;
/*beacon interval : 2bytes*/
-   *(__le16 *)ie = 
cpu_to_le16((u16)pdev_network->Configuration.BeaconPeriod);
+   *(__le16 *)ie = cpu_to_le16(bp);
sz += 2;
ie += 2;
/*capability info*/
@@ -221,7 +222,8 @@ unsigned char *r8712_get_wpa_ie(unsigned char *pie, int 
*wpa_ie_len, int limit)
pbuf = r8712_get_ie(pbuf, _WPA_IE_ID_, &len, limit);
if (pbuf) {
/*check if oui matches...*/
-   if (memcmp((pbuf + 2), wpa_oui_type, 
sizeof(wpa_oui_type)))
+   if (memcmp((pbuf + 2), wpa_oui_type,
+  sizeof(wpa_oui_type)))
goto check_next_ie;
/*check version...*/
memcpy((u8 *)&val16, (pbuf + 6), sizeof(val16));
diff --git a/drivers/staging/rtl8712/os_intfs.c 
b/drivers/staging/rtl8712/os_intfs.c
index 95caf8df9a13..e7df5d7986fc 100644
--- a/drivers/staging/rtl8712/os_intfs.c
+++ b/drivers/staging/rtl8712/os_intfs.c
@@ -238,10 +238,13 @@ static u32 start_drv_threads(struct _adapter *padapter)
 
 void r8712_stop_drv_threads(struct _adapter *padapter)
 {
+   struct completion *completion =
+   &padapter->cmdpriv.terminate_cmdthread_comp;
+
/*Below is to terminate r8712_cmd_thread & event_thread...*/
complete(&padapter->cmdpriv.cmd_queue_comp);
if (padapter->cmdThread)
-   
wait_for_completion_interruptible(&padapter->cmdpriv.terminate_cmdthread_comp);
+   wait_for_completion_interruptible(completion);
padapter->cmdpriv.cmd_seq = 1;
 }
 
diff --git a/drivers/staging/rtl8712/rtl8712_cmd.c 
b/drivers/staging/rtl8712/rtl8712_cmd.c
index 3c88994fdfcd..9c8e0c50a804 100644
--- a/drivers/staging/rtl8712/rtl8712_cmd.c
+++ b/drivers/staging/rtl8712/rtl8712_cmd.c
@@ -321,10 +321,13 @@ int r8712_cmd_thread(void *context)
void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj *pcmd);
struct _adapter *padapter = context;
struct  cmd_priv*pcmdpriv = &(padapter->cmdpriv);
+   struct completion *cmd_queue_comp =
+   &pcmdpriv->cmd_queue_comp;
+   struct mutex *pwctrl_lock = &padapter->pwrctrlpriv.mutex_lock;
 
allow_signal(SIGTERM);
while (1) {
-   if 
(wait_for_completion_interruptible(&pcmdpriv->cmd_queue_comp))
+   if (wait_for_completion_interruptible(cmd_queue_comp))
break;
if (padapter->bDriverStopped || padapter->bSurpriseRemoved)
break;
@@ -343,6 +346,7 @@ int r8712_cmd_thread(void *context)
if (pcmd) { /* if pcmd != NULL, cmd will be handled by f/w */
struct dvobj_priv *pdvobj = &padapter->dvobjpriv;
u8 blnPending = 0;
+   u16 cmdcode = pcmd->cmdcode;
 
pcmdpriv->cmd_issued_cnt++;
cmdsz = round_up(pcmd->cmdsz, 8);
@@ -387,20 +391,18 @@ int r8712_cmd_thread(void *context)
r8712_write_mem(padapter, RTL8712_DMA_H2CCMD, wr_sz,
(u8 *)pdesc);
pcmdpriv->cmd_seq++;
-   if (pcmd->cmdcode == GEN_CMD_CODE(_CreateBss)) {
+   if (cmdcode == GEN_CMD_CODE(_CreateBss)) {
pcmd->res = H2C_SUCCESS;
-   pcmd_callback = cmd_callback[pcmd->
-   cmdcode].callback;
+   pcmd_callback = cmd_callback[cmdcode].callback;
if (pcmd_callback)
pcmd_callba

[PATCH v4 5/5] staging: rtl8712: style fix returned error code

2017-12-19 Thread Martin Homuth
This patch fixes a coding style issues in the rtl8712 module as noted
by checkpatch.pl regarding the returned error code.

It fixes the following checkpatch.pl warning:

WARNING: ENOSYS means 'invalid syscall nr' and nothing else

Signed-off-by: Martin Homuth 
---
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index 855b46e766f3..c3ff7c3e6681 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -1853,7 +1853,7 @@ static int dummy(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
 {
-   return -ENOSYS;
+   return -EINVAL;
 }
 
 static int r8711_drvext_hdl(struct net_device *dev,
-- 
2.15.1

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


[PATCH v4 4/5] staging: rtl8712: style fix unneeded else

2017-12-19 Thread Martin Homuth
This patch fixes a coding style issues in the rtl8712 module as noted
by checkpatch.pl where an unnecessary else is used.

It fixes the following checkpatch.pl warning:

WARNING: else is not generally useful after a break or return

Signed-off-by: Martin Homuth 
---
 drivers/staging/rtl8712/rtl871x_ioctl_set.c | 72 ++---
 1 file changed, 35 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_set.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_set.c
index 8a5ced4fa9d3..7797ab19e92d 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_set.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_set.c
@@ -55,6 +55,7 @@ static u8 do_join(struct _adapter *padapter)
u8 *pibss = NULL;
struct  mlme_priv   *pmlmepriv = &(padapter->mlmepriv);
struct  __queue *queue  = &(pmlmepriv->scanned_queue);
+   int ret;
 
phead = &queue->queue;
plist = phead->next;
@@ -74,45 +75,42 @@ static u8 do_join(struct _adapter *padapter)
if (!pmlmepriv->sitesurveyctrl.traffic_busy)
r8712_sitesurvey_cmd(padapter, &pmlmepriv->assoc_ssid);
return true;
-   } else {
-   int ret;
+   }
 
-   ret = r8712_select_and_join_from_scan(pmlmepriv);
-   if (ret == _SUCCESS) {
-   mod_timer(&pmlmepriv->assoc_timer,
- jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT));
+   ret = r8712_select_and_join_from_scan(pmlmepriv);
+   if (ret == _SUCCESS) {
+   mod_timer(&pmlmepriv->assoc_timer,
+ jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT));
+   } else {
+   if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
+   /* submit r8712_createbss_cmd to change to an
+* ADHOC_MASTER pmlmepriv->lock has been
+* acquired by caller...
+*/
+   struct wlan_bssid_ex *pdev_network =
+   &padapter->registrypriv.dev_network;
+   pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE;
+   pibss = padapter->registrypriv.dev_network.MacAddress;
+   memcpy(&pdev_network->Ssid,
+  &pmlmepriv->assoc_ssid,
+  sizeof(struct ndis_802_11_ssid));
+   r8712_update_registrypriv_dev_network(padapter);
+   r8712_generate_random_ibss(pibss);
+   if (r8712_createbss_cmd(padapter) != _SUCCESS)
+   return false;
+   pmlmepriv->to_join = false;
} else {
-   if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
-   /* submit r8712_createbss_cmd to change to an
-* ADHOC_MASTER pmlmepriv->lock has been
-* acquired by caller...
-*/
-   struct wlan_bssid_ex *pdev_network =
-   &(padapter->registrypriv.dev_network);
-   pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE;
-   pibss = padapter->registrypriv.dev_network.
-   MacAddress;
-   memcpy(&pdev_network->Ssid,
-   &pmlmepriv->assoc_ssid,
-   sizeof(struct ndis_802_11_ssid));
-   r8712_update_registrypriv_dev_network(padapter);
-   r8712_generate_random_ibss(pibss);
-   if (r8712_createbss_cmd(padapter) != _SUCCESS)
-   return false;
-   pmlmepriv->to_join = false;
-   } else {
-   /* can't associate ; reset under-linking */
-   if (pmlmepriv->fw_state & _FW_UNDER_LINKING)
-   pmlmepriv->fw_state ^=
-_FW_UNDER_LINKING;
-   /* when set_ssid/set_bssid for do_join(), but
-* there are no desired bss in scanning queue
-* we try to issue sitesurvey first
-*/
-   if (!pmlmepriv->sitesurveyctrl.traffic_busy)
-   r8712_sitesurvey_cmd(padapter,
-  &pmlmepriv->assoc_ssid);
-   }
+   /* can't associate ; reset under-linking */
+   if (pmlmepriv->fw_state & _FW_UNDER_LINKING)
+   pmlmepriv->fw

Re: [PATCH 1/5] staging: rtl8712: style fix over 80 characters warnings

2017-12-19 Thread Dan Carpenter
The patch is corrupt.  Read Documentation/process/email-clients.rst

regards,
dan carpenter

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


[PATCH v1 02/10] staging: atomisp: Remove duplicate NULL-check

2017-12-19 Thread Andy Shevchenko
GPIO framework checks for NULL pointer when gpiod_set_value() is called.

Signed-off-by: Andy Shevchenko 
---
 .../staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c 
b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
index a5d0dd88a8bc..8fb5147531a5 100644
--- a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
@@ -394,7 +394,7 @@ static int gmin_gpio0_ctrl(struct v4l2_subdev *subdev, int 
on)
 {
struct gmin_subdev *gs = find_gmin_subdev(subdev);
 
-   if (gs && gs->gpio0) {
+   if (gs) {
gpiod_set_value(gs->gpio0, on);
return 0;
}
@@ -405,7 +405,7 @@ static int gmin_gpio1_ctrl(struct v4l2_subdev *subdev, int 
on)
 {
struct gmin_subdev *gs = find_gmin_subdev(subdev);
 
-   if (gs && gs->gpio1) {
+   if (gs) {
gpiod_set_value(gs->gpio1, on);
return 0;
}
-- 
2.15.1

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


[PATCH v1 03/10] staging: atomisp: lm3554: Fix control values

2017-12-19 Thread Andy Shevchenko
Driver fails to initialize due to insane settings in the
control init array.

Fix this by moving to sanity.

Signed-off-by: Andy Shevchenko 
---
 drivers/staging/media/atomisp/i2c/atomisp-lm3554.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c 
b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
index 4fd9f538ac95..974b6ff50c7a 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
@@ -562,10 +562,10 @@ static const struct v4l2_ctrl_config lm3554_controls[] = {
{
 .ops = &ctrl_ops,
 .id = V4L2_CID_FLASH_STATUS,
-.type = V4L2_CTRL_TYPE_BOOLEAN,
+.type = V4L2_CTRL_TYPE_INTEGER,
 .name = "Flash Status",
-.min = 0,
-.max = 100,
+.min = ATOMISP_FLASH_STATUS_OK,
+.max = ATOMISP_FLASH_STATUS_TIMEOUT,
 .step = 1,
 .def = ATOMISP_FLASH_STATUS_OK,
 .flags = 0,
@@ -574,10 +574,10 @@ static const struct v4l2_ctrl_config lm3554_controls[] = {
{
 .ops = &ctrl_ops,
 .id = V4L2_CID_FLASH_STATUS_REGISTER,
-.type = V4L2_CTRL_TYPE_BOOLEAN,
+.type = V4L2_CTRL_TYPE_INTEGER,
 .name = "Flash Status Register",
 .min = 0,
-.max = 100,
+.max = 255,
 .step = 1,
 .def = 0,
 .flags = 0,
-- 
2.15.1

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


[PATCH v1 06/10] staging: atomisp: Switch to use struct device_driver directly

2017-12-19 Thread Andy Shevchenko
In a preparation of split PCI glue driver from core part, convert
the driver to use more generic struct device_driver.

Signed-off-by: Andy Shevchenko 
---
 .../staging/media/atomisp/pci/atomisp2/atomisp_drvfs.c  | 17 -
 .../staging/media/atomisp/pci/atomisp2/atomisp_drvfs.h  |  5 ++---
 .../staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c   |  4 +---
 3 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.c 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.c
index 7129b88456cb..ceedb82b6beb 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.c
@@ -15,9 +15,9 @@
  *
  */
 
+#include 
 #include 
 #include 
-#include 
 
 #include "atomisp_compat.h"
 #include "atomisp_internal.h"
@@ -33,7 +33,7 @@
  *bit 2: memory statistic
 */
 struct _iunit_debug {
-   struct pci_driver   *drv;
+   struct device_driver*drv;
struct atomisp_device   *isp;
unsigned intdbglvl;
unsigned intdbgfun;
@@ -164,26 +164,25 @@ static const struct driver_attribute iunit_drvfs_attrs[] 
= {
__ATTR(dbgopt, 0644, iunit_dbgopt_show, iunit_dbgopt_store),
 };
 
-static int iunit_drvfs_create_files(struct pci_driver *drv)
+static int iunit_drvfs_create_files(struct device_driver *drv)
 {
int i, ret = 0;
 
for (i = 0; i < ARRAY_SIZE(iunit_drvfs_attrs); i++)
-   ret |= driver_create_file(&(drv->driver),
-   &iunit_drvfs_attrs[i]);
+   ret |= driver_create_file(drv, &iunit_drvfs_attrs[i]);
 
return ret;
 }
 
-static void iunit_drvfs_remove_files(struct pci_driver *drv)
+static void iunit_drvfs_remove_files(struct device_driver *drv)
 {
int i;
 
for (i = 0; i < ARRAY_SIZE(iunit_drvfs_attrs); i++)
-   driver_remove_file(&(drv->driver), &iunit_drvfs_attrs[i]);
+   driver_remove_file(drv, &iunit_drvfs_attrs[i]);
 }
 
-int atomisp_drvfs_init(struct pci_driver *drv, struct atomisp_device *isp)
+int atomisp_drvfs_init(struct device_driver *drv, struct atomisp_device *isp)
 {
int ret;
 
@@ -193,7 +192,7 @@ int atomisp_drvfs_init(struct pci_driver *drv, struct 
atomisp_device *isp)
ret = iunit_drvfs_create_files(iunit_debug.drv);
if (ret) {
dev_err(atomisp_dev, "drvfs_create_files error: %d\n", ret);
-   iunit_drvfs_remove_files(drv);
+   iunit_drvfs_remove_files(iunit_debug.drv);
}
 
return ret;
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.h 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.h
index b91bfef21639..7c99240d107a 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.h
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.h
@@ -18,8 +18,7 @@
 #ifndef__ATOMISP_DRVFS_H__
 #define__ATOMISP_DRVFS_H__
 
-extern int atomisp_drvfs_init(struct pci_driver *drv, struct atomisp_device
-   *isp);
-extern void atomisp_drvfs_exit(void);
+int atomisp_drvfs_init(struct device_driver *drv, struct atomisp_device *isp);
+void atomisp_drvfs_exit(void);
 
 #endif /* __ATOMISP_DRVFS_H__ */
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c
index 3c260f8b52e2..7a9efc6847ca 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c
@@ -1152,8 +1152,6 @@ static int init_atomisp_wdts(struct atomisp_device *isp)
return err;
 }
 
-static struct pci_driver atomisp_pci_driver;
-
 #define ATOM_ISP_PCI_BAR   0
 
 static int atomisp_pci_probe(struct pci_dev *dev,
@@ -1451,7 +1449,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
isp->firmware = NULL;
isp->css_env.isp_css_fw.data = NULL;
 
-   atomisp_drvfs_init(&atomisp_pci_driver, isp);
+   atomisp_drvfs_init(&dev->driver->driver, isp);
 
return 0;
 
-- 
2.15.1

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


[PATCH v1 05/10] staging: atomisp: Remove non-ACPI leftovers

2017-12-19 Thread Andy Shevchenko
Since all drivers are solely requiring ACPI enumeration, there is no
need to additionally check for legacy platform data or ACPI handle.

Remove leftovers from the sensors and platform code.

Signed-off-by: Andy Shevchenko 
---
 drivers/staging/media/atomisp/i2c/atomisp-gc0310.c | 10 ++---
 drivers/staging/media/atomisp/i2c/atomisp-gc2235.c |  8 +---
 drivers/staging/media/atomisp/i2c/atomisp-lm3554.c | 28 --
 .../staging/media/atomisp/i2c/atomisp-mt9m114.c|  8 ++--
 drivers/staging/media/atomisp/i2c/atomisp-ov2680.c | 10 ++---
 drivers/staging/media/atomisp/i2c/atomisp-ov2722.c | 17 ++---
 .../media/atomisp/i2c/ov5693/atomisp-ov5693.c  | 12 ++
 drivers/staging/media/atomisp/i2c/ov8858.c | 43 +++---
 .../platform/intel-mid/atomisp_gmin_platform.c |  6 +--
 9 files changed, 49 insertions(+), 93 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c 
b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
index e70d8afcc229..61b7598469eb 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
@@ -1370,13 +1370,9 @@ static int gc0310_probe(struct i2c_client *client)
dev->fmt_idx = 0;
v4l2_i2c_subdev_init(&(dev->sd), client, &gc0310_ops);
 
-   if (ACPI_COMPANION(&client->dev))
-   pdata = gmin_camera_platform_data(&dev->sd,
- ATOMISP_INPUT_FORMAT_RAW_8,
- atomisp_bayer_order_grbg);
-   else
-   pdata = client->dev.platform_data;
-
+   pdata = gmin_camera_platform_data(&dev->sd,
+ ATOMISP_INPUT_FORMAT_RAW_8,
+ atomisp_bayer_order_grbg);
if (!pdata) {
ret = -EINVAL;
goto out_free;
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c 
b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
index 85da5fe24033..d8de46da64ae 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
@@ -1108,9 +1108,7 @@ static int gc2235_probe(struct i2c_client *client)
dev->fmt_idx = 0;
v4l2_i2c_subdev_init(&(dev->sd), client, &gc2235_ops);
 
-   gcpdev = client->dev.platform_data;
-   if (ACPI_COMPANION(&client->dev))
-   gcpdev = gmin_camera_platform_data(&dev->sd,
+   gcpdev = gmin_camera_platform_data(&dev->sd,
   ATOMISP_INPUT_FORMAT_RAW_10,
   atomisp_bayer_order_grbg);
 
@@ -1147,10 +1145,8 @@ static int gc2235_probe(struct i2c_client *client)
if (ret)
gc2235_remove(client);
 
-   if (ACPI_HANDLE(&client->dev))
-   ret = atomisp_register_i2c_module(&dev->sd, gcpdev, RAW_CAMERA);
+   return atomisp_register_i2c_module(&dev->sd, gcpdev, RAW_CAMERA);
 
-   return ret;
 out_free:
v4l2_device_unregister_subdev(&dev->sd);
kfree(dev);
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c 
b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
index 974b6ff50c7a..7098bf317f16 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
@@ -824,22 +824,15 @@ static void *lm3554_platform_data_func(struct i2c_client 
*client)
 {
static struct lm3554_platform_data platform_data;
 
-   if (ACPI_COMPANION(&client->dev)) {
-   platform_data.gpio_reset =
-   desc_to_gpio(gpiod_get_index(&(client->dev),
+   platform_data.gpio_reset =
+   desc_to_gpio(gpiod_get_index(&client->dev,
 NULL, 2, GPIOD_OUT_LOW));
-   platform_data.gpio_strobe =
-   desc_to_gpio(gpiod_get_index(&(client->dev),
+   platform_data.gpio_strobe =
+   desc_to_gpio(gpiod_get_index(&client->dev,
 NULL, 0, GPIOD_OUT_LOW));
-   platform_data.gpio_torch =
-   desc_to_gpio(gpiod_get_index(&(client->dev),
+   platform_data.gpio_torch =
+   desc_to_gpio(gpiod_get_index(&client->dev,
 NULL, 1, GPIOD_OUT_LOW));
-   } else {
-   platform_data.gpio_reset = -1;
-   platform_data.gpio_strobe = -1;
-   platform_data.gpio_torch = -1;
-   }
-
dev_info(&client->dev, "camera pdata: lm3554: reset: %d strobe %d torch 
%d\n",
platform_data.gpio_reset, platform_data.gpio_strobe,
platform_data.gpio_torch);
@@ -868,10 +861,7 @@ static int lm3554_probe(struct i2c_client *client)
if (!flash)
return -ENOMEM;
 
-   flash->pdata = client->dev.platform_data;
-
-   if (!flash->pdata || ACPI_C

[PATCH v1 10/10] staging: atomisp: Fix DMI matching entry for MRD7

2017-12-19 Thread Andy Shevchenko
MRD7 board has in particular

Base Board Information
Manufacturer: Intel Corp.
Product Name: TABLET
Version: MRD 7

Fix the DMI matching entry for it.

Signed-off-by: Andy Shevchenko 
---
 .../staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c 
b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
index 8408a58ed764..d8b7183db252 100644
--- a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
@@ -286,7 +286,8 @@ static const struct dmi_system_id gmin_vars[] = {
{
.ident = "MRD7",
.matches = {
-   DMI_MATCH(DMI_BOARD_NAME, "MRD7"),
+   DMI_MATCH(DMI_BOARD_NAME, "TABLET"),
+   DMI_MATCH(DMI_BOARD_VERSION, "MRD 7"),
},
.driver_data = mrd7_vars,
},
-- 
2.15.1

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


[PATCH v1 08/10] staging: atomisp: Unexport local function

2017-12-19 Thread Andy Shevchenko
There is no need to export function which is only used once in
the same module where it's defined.

Signed-off-by: Andy Shevchenko 
---
 drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h  | 1 -
 .../staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c | 5 ++---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git 
a/drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h 
b/drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h
index 7e3ca12dd4e9..c52c56a17e17 100644
--- a/drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h
+++ b/drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h
@@ -23,7 +23,6 @@ int atomisp_register_i2c_module(struct v4l2_subdev *subdev,
 struct v4l2_subdev *atomisp_gmin_find_subdev(struct i2c_adapter *adapter,
 struct i2c_board_info *board_info);
 int atomisp_gmin_remove_subdev(struct v4l2_subdev *sd);
-int gmin_get_config_var(struct device *dev, const char *var, char *out, size_t 
*out_len);
 int gmin_get_var_int(struct device *dev, const char *var, int def);
 int camera_sensor_csi(struct v4l2_subdev *sd, u32 port,
   u32 lanes, u32 format, u32 bayer_order, int flag);
diff --git 
a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c 
b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
index 8dcec0e780a1..0f859bb714bf 100644
--- a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
@@ -608,8 +608,8 @@ EXPORT_SYMBOL_GPL(atomisp_gmin_register_vcm_control);
  * argument should be a device with an ACPI companion, as all
  * configuration is based on firmware ID.
  */
-int gmin_get_config_var(struct device *dev, const char *var, char *out,
-   size_t *out_len)
+static int gmin_get_config_var(struct device *dev, const char *var,
+  char *out, size_t *out_len)
 {
char var8[CFG_VAR_NAME_MAX];
efi_char16_t var16[CFG_VAR_NAME_MAX];
@@ -691,7 +691,6 @@ int gmin_get_config_var(struct device *dev, const char 
*var, char *out,
 
return ret;
 }
-EXPORT_SYMBOL_GPL(gmin_get_config_var);
 
 int gmin_get_var_int(struct device *dev, const char *var, int def)
 {
-- 
2.15.1

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


[PATCH v1 04/10] staging: atomisp: Disable custom format for now

2017-12-19 Thread Andy Shevchenko
Custom video format 'M101' is not supported in upstream and as a result
user will get ugly warning:

 Unknown pixelformat 0x3130314d
 [ cut here ]
 WARNING: CPU: 3 PID: 1574 at drivers/media/v4l2-core/v4l2-ioctl.c:1291 
v4l_enum_fmt+0xcf1/0x13a0 [videodev]

Signed-off-by: Andy Shevchenko 
---
 drivers/staging/media/atomisp/include/linux/atomisp.h   | 2 ++
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c  | 5 -
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c | 2 ++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/include/linux/atomisp.h 
b/drivers/staging/media/atomisp/include/linux/atomisp.h
index 15fa5679bae7..ebe193ba3871 100644
--- a/drivers/staging/media/atomisp/include/linux/atomisp.h
+++ b/drivers/staging/media/atomisp/include/linux/atomisp.h
@@ -68,7 +68,9 @@
 #define V4L2_MBUS_FMT_CUSTOM_RGB32 0x800a
 
 /* Custom media bus format for M10MO RAW capture */
+#if 0
 #define V4L2_MBUS_FMT_CUSTOM_M10MO_RAW 0x800b
+#endif
 
 /* Configuration used by Bayer noise reduction and YCC noise reduction */
 struct atomisp_nr_config {
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c
index 339b5d31e1f1..5c84dd63778e 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c
@@ -501,7 +501,9 @@ const struct atomisp_format_bridge atomisp_output_fmts[] = {
.mbus_code = MEDIA_BUS_FMT_JPEG_1X8,
.sh_fmt = CSS_FRAME_FORMAT_BINARY_8,
.description = "JPEG"
-   }, {
+   },
+#if 0
+   {
/* This is a custom format being used by M10MO to send the RAW data */
.pixelformat = V4L2_PIX_FMT_CUSTOM_M10MO_RAW,
.depth = 8,
@@ -509,6 +511,7 @@ const struct atomisp_format_bridge atomisp_output_fmts[] = {
.sh_fmt = CSS_FRAME_FORMAT_BINARY_8,
.description = "Custom RAW for M10MO"
},
+#endif
 };
 
 const struct atomisp_format_bridge *atomisp_get_format_bridge(
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c
index 70b53988553c..f3e18d627b0a 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c
@@ -48,7 +48,9 @@ const struct atomisp_in_fmt_conv atomisp_in_fmt_conv[] = {
{ V4L2_MBUS_FMT_CUSTOM_NV12, 12, 12, CSS_FRAME_FORMAT_NV12, 0, 
CSS_FRAME_FORMAT_NV12 },
{ V4L2_MBUS_FMT_CUSTOM_NV21, 12, 12, CSS_FRAME_FORMAT_NV21, 0, 
CSS_FRAME_FORMAT_NV21 },
{ V4L2_MBUS_FMT_CUSTOM_YUV420, 12, 12, 
ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY, 0, IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY },
+#if 0
{ V4L2_MBUS_FMT_CUSTOM_M10MO_RAW, 8, 8, CSS_FRAME_FORMAT_BINARY_8, 0, 
IA_CSS_STREAM_FORMAT_BINARY_8 },
+#endif
/* no valid V4L2 MBUS code for metadata format, so leave it 0. */
{ 0, 0, 0, ATOMISP_INPUT_FORMAT_EMBEDDED, 0, 
IA_CSS_STREAM_FORMAT_EMBEDDED },
{}
-- 
2.15.1

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


[PATCH v1 09/10] staging: atomisp: Use standard DMI match table

2017-12-19 Thread Andy Shevchenko
The traditional pattern is to use DMI matching table and provide a
corresponding driver_data in it.

Convert driver to use DMI matching table.

Signed-off-by: Andy Shevchenko 
---
 .../platform/intel-mid/atomisp_gmin_platform.c | 109 +
 1 file changed, 70 insertions(+), 39 deletions(-)

diff --git 
a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c 
b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
index 0f859bb714bf..8408a58ed764 100644
--- a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
@@ -209,7 +209,7 @@ struct gmin_cfg_var {
const char *name, *val;
 };
 
-static const struct gmin_cfg_var ffrd8_vars[] = {
+static struct gmin_cfg_var ffrd8_vars[] = {
{ "INTCF1B:00_ImxId","0x134" },
{ "INTCF1B:00_CsiPort",  "1" },
{ "INTCF1B:00_CsiLanes", "4" },
@@ -220,14 +220,14 @@ static const struct gmin_cfg_var ffrd8_vars[] = {
 /* Cribbed from MCG defaults in the mt9m114 driver, not actually verified
  * vs. T100 hardware
  */
-static const struct gmin_cfg_var t100_vars[] = {
+static struct gmin_cfg_var t100_vars[] = {
{ "INT33F0:00_CsiPort",  "0" },
{ "INT33F0:00_CsiLanes", "1" },
{ "INT33F0:00_CamClk",   "1" },
{},
 };
 
-static const struct gmin_cfg_var mrd7_vars[] = {
+static struct gmin_cfg_var mrd7_vars[] = {
{"INT33F8:00_CamType", "1"},
{"INT33F8:00_CsiPort", "1"},
{"INT33F8:00_CsiLanes", "2"},
@@ -243,7 +243,7 @@ static const struct gmin_cfg_var mrd7_vars[] = {
{},
 };
 
-static const struct gmin_cfg_var ecs7_vars[] = {
+static struct gmin_cfg_var ecs7_vars[] = {
{"INT33BE:00_CsiPort", "1"},
{"INT33BE:00_CsiLanes", "2"},
{"INT33BE:00_CsiFmt", "13"},
@@ -258,8 +258,7 @@ static const struct gmin_cfg_var ecs7_vars[] = {
{},
 };
 
-
-static const struct gmin_cfg_var i8880_vars[] = {
+static struct gmin_cfg_var i8880_vars[] = {
{"XXOV2680:00_CsiPort", "1"},
{"XXOV2680:00_CsiLanes", "1"},
{"XXOV2680:00_CamClk", "0"},
@@ -269,18 +268,45 @@ static const struct gmin_cfg_var i8880_vars[] = {
{},
 };
 
-static const struct {
-   const char *dmi_board_name;
-   const struct gmin_cfg_var *vars;
-} hard_vars[] = {
-   { "BYT-T FFD8", ffrd8_vars },
-   { "T100TA", t100_vars },
-   { "MRD7", mrd7_vars },
-   { "ST70408", ecs7_vars },
-   { "VTA0803", i8880_vars },
+static const struct dmi_system_id gmin_vars[] = {
+   {
+   .ident = "BYT-T FFD8",
+   .matches = {
+   DMI_MATCH(DMI_BOARD_NAME, "BYT-T FFD8"),
+   },
+   .driver_data = ffrd8_vars,
+   },
+   {
+   .ident = "T100TA",
+   .matches = {
+   DMI_MATCH(DMI_BOARD_NAME, "T100TA"),
+   },
+   .driver_data = t100_vars,
+   },
+   {
+   .ident = "MRD7",
+   .matches = {
+   DMI_MATCH(DMI_BOARD_NAME, "MRD7"),
+   },
+   .driver_data = mrd7_vars,
+   },
+   {
+   .ident = "ST70408",
+   .matches = {
+   DMI_MATCH(DMI_BOARD_NAME, "ST70408"),
+   },
+   .driver_data = ecs7_vars,
+   },
+   {
+   .ident = "VTA0803",
+   .matches = {
+   DMI_MATCH(DMI_BOARD_NAME, "VTA0803"),
+   },
+   .driver_data = i8880_vars,
+   },
+   {}
 };
 
-
 #define GMIN_CFG_VAR_EFI_GUID EFI_GUID(0xecb54cd9, 0xe5ae, 0x4fdc, \
   0xa9, 0x71, 0xe8, 0x77, \
   0x75, 0x60, 0x68, 0xf7)
@@ -604,6 +630,29 @@ int atomisp_gmin_register_vcm_control(struct 
camera_vcm_control *vcmCtrl)
 }
 EXPORT_SYMBOL_GPL(atomisp_gmin_register_vcm_control);
 
+static int gmin_get_hardcoded_var(struct gmin_cfg_var *varlist,
+ const char *var8, char *out, size_t *out_len)
+{
+   struct gmin_cfg_var *gv;
+
+   for (gv = varlist; gv->name; gv++) {
+   size_t vl;
+
+   if (strcmp(var8, gv->name))
+   continue;
+
+   vl = strlen(gv->val);
+   if (vl > *out_len - 1)
+   return -ENOSPC;
+
+   strcpy(out, gv->val);
+   *out_len = vl;
+   return 0;
+   }
+
+   return -EINVAL;
+}
+
 /* Retrieves a device-specific configuration variable.  The dev
  * argument should be a device with an ACPI companion, as all
  * configuration is based on firmware ID.
@@ -614,7 +663,8 @@ static int gmin_get_config_var(struct device *dev, const 
char *var,
char var8[CFG_VAR_NAME_MAX];
efi_char16_t var16[CFG_VAR_NAME_MAX];
struct efivar_entry *ev;
-

[PATCH v1 07/10] staging: atomisp: Remove redundant PCI code

2017-12-19 Thread Andy Shevchenko
There is no need to keep a reference to PCI root bridge.

Signed-off-by: Andy Shevchenko 
---
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h | 1 -
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c | 8 
 2 files changed, 9 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h
index 52a6f8002048..dc476a3dd271 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h
@@ -227,7 +227,6 @@ struct atomisp_device {
struct media_device media_dev;
struct atomisp_platform_data *pdata;
void *mmu_l1_base;
-   struct pci_dev *pci_root;
const struct firmware *firmware;
 
struct pm_qos_request pm_qos;
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c
index 7a9efc6847ca..548e00e7d67b 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c
@@ -1210,11 +1210,6 @@ static int atomisp_pci_probe(struct pci_dev *dev,
isp->pdev = dev;
isp->dev = &dev->dev;
isp->sw_contex.power_state = ATOM_ISP_POWER_UP;
-   isp->pci_root = pci_get_bus_and_slot(0, 0);
-   if (!isp->pci_root) {
-   dev_err(&dev->dev, "Unable to find PCI host\n");
-   return -ENODEV;
-   }
isp->saved_regs.ispmmadr = start;
 
rt_mutex_init(&isp->mutex);
@@ -1494,7 +1489,6 @@ static int atomisp_pci_probe(struct pci_dev *dev,
/* Address later when we worry about the ...field chips */
if (IS_ENABLED(CONFIG_PM) && atomisp_mrfld_power_down(isp))
dev_err(&dev->dev, "Failed to switch off ISP\n");
-   pci_dev_put(isp->pci_root);
return err;
 }
 
@@ -1515,8 +1509,6 @@ static void atomisp_pci_remove(struct pci_dev *dev)
pm_qos_remove_request(&isp->pm_qos);
 
atomisp_msi_irq_uninit(isp, dev);
-   pci_dev_put(isp->pci_root);
-
atomisp_unregister_entities(isp);
 
destroy_workqueue(isp->wdt_work_queue);
-- 
2.15.1

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


[PATCH v1 01/10] staging: atomisp: Don't leak GPIO resources if clk_get() failed

2017-12-19 Thread Andy Shevchenko
In case devm_clk_get() call fails the previously requested GPIOs are
left requested.

Fix this by moving GPIO request code after devm_clk_get() call.

Signed-off-by: Andy Shevchenko 
---
 .../staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c 
b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
index bf9f34b7ad72..a5d0dd88a8bc 100644
--- a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
@@ -322,8 +322,6 @@ static struct gmin_subdev *gmin_subdev_add(struct 
v4l2_subdev *subdev)
VLV2_CLK_PLL_19P2MHZ);
gmin_subdevs[i].csi_port = gmin_get_var_int(dev, "CsiPort", 0);
gmin_subdevs[i].csi_lanes = gmin_get_var_int(dev, "CsiLanes", 1);
-   gmin_subdevs[i].gpio0 = gpiod_get_index(dev, NULL, 0, GPIOD_OUT_LOW);
-   gmin_subdevs[i].gpio1 = gpiod_get_index(dev, NULL, 1, GPIOD_OUT_LOW);
 
/* get PMC clock with clock framework */
snprintf(gmin_pmc_clk_name,
@@ -356,9 +354,11 @@ static struct gmin_subdev *gmin_subdev_add(struct 
v4l2_subdev *subdev)
if (!ret)
clk_disable_unprepare(gmin_subdevs[i].pmc_clk);
 
+   gmin_subdevs[i].gpio0 = gpiod_get_index(dev, NULL, 0, GPIOD_OUT_LOW);
if (IS_ERR(gmin_subdevs[i].gpio0))
gmin_subdevs[i].gpio0 = NULL;
 
+   gmin_subdevs[i].gpio1 = gpiod_get_index(dev, NULL, 1, GPIOD_OUT_LOW);
if (IS_ERR(gmin_subdevs[i].gpio1))
gmin_subdevs[i].gpio1 = NULL;
 
-- 
2.15.1

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


Re: [PATCH RFC 2/7] KVM: nVMX: modify vmcs12 fields to match Hyper-V enlightened VMCS

2017-12-19 Thread Paolo Bonzini
On 19/12/2017 18:40, Jim Mattson wrote:
> I'm not sure that's really the right way to go, since any guest that
> has already read the IA32_VMX_BASIC MSR has a right to expect the VMCS
> revision to remain unchanged.

Hmm, not just that, "the VMCS revision identifier is never written by
the processor" according to the SDM.  Maybe the code that accesses the
vmcs12 can be placed in a .h file and included more than once in vmx.c.

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


Re: PROBLEM: 4.15.0-rc3 APIC causes lockups on Core 2 Duo laptop

2017-12-19 Thread Thomas Gleixner
On Tue, 19 Dec 2017, Alexandru Chirvasitu wrote:

> I had never heard of 'bisect' before this casual mention (you might tell
> I am a bit out of my depth). I've since applied it to Linus' tree between

> bebc608 Linux 4.14 (good)
> 
> and
> 
> 4fbd8d1 Linux 4.15-rc1 (bad)

Is Linus current head 4.15-rc4 bad as well?

> It took about 13 attempts (I had access to a faster machine to compile
> on, and ccache helped once the cache built up some momentum). The result
> is (as presented by 'git bisect' at the end of the process, between the
> --- dividers added by me for clarity):

> --- start of output ---
> 
> 2b5175c4fa974b6aa05bbd2ee8d443a8036a1714 is the first bad commit
> commit 2b5175c4fa974b6aa05bbd2ee8d443a8036a1714
> Author: Thomas Gleixner 
> Date:   Tue Oct 17 09:54:57 2017 +0200
> 
> genirq: Add config option for reservation mode
> 
> The interrupt reservation mode requires reactivation of PCI/MSI
> interrupts. Create a config option, so the PCI code can set the
> corresponding flag when required.
> 
> Signed-off-by: Thomas Gleixner 
> Cc: Josh Poulson 
> Cc: Mihai Costache 
> Cc: Stephen Hemminger 
> Cc: Marc Zyngier 
> Cc: linux-...@vger.kernel.org
> Cc: Haiyang Zhang 
> Cc: Dexuan Cui 
> Cc: Simon Xiao 
> Cc: Saeed Mahameed 
> Cc: Jork Loeser 
> Cc: Bjorn Helgaas 
> Cc: de...@linuxdriverproject.org
> Cc: KY Srinivasan 
> Link: https://lkml.kernel.org/r/20171017075600.369375...@linutronix.de
> 
> :04 04 5e73031cc0c8411a20722cce7876ab7b82ed3858 
> dcf98e7a6b7d5f7c5353b7ccab02125e6d332ec8 M  kernel
> 
> --- end of output ---
> 
> Consequently, I am cc-ing in the listed addresses.

Thanks for doing that bisect, but unfortunately this commit cannot be the
problematic one, It merily adds a config symbol, but it does not change any
code at all. It has no effect whatsoever. So something might have gone
wrong in your bisecting.

I CC'ed Dou Liyang. He has changed the early APIC setup code and there has
been an issue reported already. Though I lost track of that. Dou, any
pointers?

Thanks,

tglx


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


Re: PROBLEM: 4.15.0-rc3 APIC causes lockups on Core 2 Duo laptop

2017-12-19 Thread Dou Liyang

Hi Thomas,

At 12/20/2017 08:31 AM, Thomas Gleixner wrote:

On Tue, 19 Dec 2017, Alexandru Chirvasitu wrote:


I had never heard of 'bisect' before this casual mention (you might tell
I am a bit out of my depth). I've since applied it to Linus' tree between



bebc608 Linux 4.14 (good)

and

4fbd8d1 Linux 4.15-rc1 (bad)


Is Linus current head 4.15-rc4 bad as well?


[...]


Thanks for doing that bisect, but unfortunately this commit cannot be the
problematic one, It merily adds a config symbol, but it does not change any
code at all. It has no effect whatsoever. So something might have gone
wrong in your bisecting.



Agree.


I CC'ed Dou Liyang. He has changed the early APIC setup code and there has
been an issue reported already. Though I lost track of that. Dou, any

     Is it this one?
               https://marc.info/?l=linux-kernel&m=151188084018443

pointers?



Not sure, but seems the APIC failed to start in that 32-bit system.

I will look into it.

Alex,

Could you give me your .config file and the dmesg-log of 4.15.0-rc3.

Thanks,
dou


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


Re: [PATCH v1 05/10] staging: atomisp: Remove non-ACPI leftovers

2017-12-19 Thread Dan Carpenter
On Tue, Dec 19, 2017 at 10:59:52PM +0200, Andy Shevchenko wrote:
> @@ -1147,10 +1145,8 @@ static int gc2235_probe(struct i2c_client *client)
>   if (ret)
>   gc2235_remove(client);

This error handling is probably wrong...

>  
> - if (ACPI_HANDLE(&client->dev))
> - ret = atomisp_register_i2c_module(&dev->sd, gcpdev, RAW_CAMERA);
> + return atomisp_register_i2c_module(&dev->sd, gcpdev, RAW_CAMERA);

In the end this should look something like:

ret = atomisp_register_i2c_module(&dev->sd, gcpdev, RAW_CAMERA);
if (ret)
goto err_free_something;

return 0;

>  
> - return ret;
>  out_free:
>   v4l2_device_unregister_subdev(&dev->sd);
>   kfree(dev);

regards,
dan carpenter

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


Re: [staging:staging-testing 284/298] drivers/staging/ccree/ssi_driver.c:83:6: error: conflicting types for '__dump_byte_array'

2017-12-19 Thread Gilad Ben-Yossef
On Tue, Dec 19, 2017 at 6:37 PM, Greg Kroah-Hartman
 wrote:
> On Tue, Dec 19, 2017 at 11:02:33PM +0800, kbuild test robot wrote:
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
>> staging-testing
>> head:   893b103a3e9ce255e9afe8103d90f28ac2124eb8
>> commit: 3f268f5d6669b61e38ad65095480cdf80389ae40 [284/298] staging: ccree: 
>> turn compile time debug log to params
>> config: i386-randconfig-x073-201751 (attached as .config)
>> compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
>> reproduce:
>> git checkout 3f268f5d6669b61e38ad65095480cdf80389ae40
>> # save the attached .config to linux build tree
>> make ARCH=i386
>>
>> All error/warnings (new ones prefixed by >>):
>>
>> >> drivers/staging/ccree/ssi_driver.c:83:6: error: conflicting types for 
>> >> '__dump_byte_array'
>> void __dump_byte_array(const char *name, const u8 *buf, size_t len)
>>  ^
>>In file included from drivers/staging/ccree/ssi_driver.c:63:0:
>>drivers/staging/ccree/ssi_driver.h:175:6: note: previous declaration of 
>> '__dump_byte_array' was here
>> void __dump_byte_array(const char *name, const u8 *the_array,
>>  ^
>>drivers/staging/ccree/ssi_driver.c: In function '__dump_byte_array':
>> >> drivers/staging/ccree/ssi_driver.c:90:41: warning: format '%lu' expects 
>> >> argument of type 'long unsigned int', but argument 5 has type 'size_t 
>> >> {aka unsigned int}' [-Wformat=]
>>  snprintf(prefix, sizeof(prefix), "%s[%lu]: ", name, len);
>>   ~~^
>>   %u
>>
>
> Gilad, can you send me a patch for this?  It should be pretty simple :)

Yes, of course. Patch coming right up... Sorry about this.

Gilad



-- 
Gilad Ben-Yossef
Chief Coffee Drinker

"If you take a class in large-scale robotics, can you end up in a
situation where the homework eats your dog?"
 -- Jean-Baptiste Queru
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v1 2/4] lib/net_utils: Introduce mac_pton_from_user()

2017-12-19 Thread Greg Kroah-Hartman
On Tue, Dec 19, 2017 at 09:14:10PM +0200, Andy Shevchenko wrote:
> Some drivers are getting MAC from user space. Make a helper for them.
> 
> Signed-off-by: Andy Shevchenko 
> ---
>  include/linux/kernel.h |  1 +
>  lib/net_utils.c| 12 
>  2 files changed, 13 insertions(+)

Don't do this just for some horrid staging drivers.  They can just drop
that functionality entirely and use the "normal" way of doing this if
they really want it.

thanks,

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


[PATCH] staging: ccree: use size_t consistently

2017-12-19 Thread Gilad Ben-Yossef
Fix declaration, implementation and wrapper function to use
the same size_t type we actually define the parameter to be.

Fixes: 3f268f5d6669 ("staging: ccree: turn compile time debug log to params")
Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_driver.c | 2 +-
 drivers/staging/ccree/ssi_driver.h | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/ccree/ssi_driver.c 
b/drivers/staging/ccree/ssi_driver.c
index 56b5d45..1254c69 100644
--- a/drivers/staging/ccree/ssi_driver.c
+++ b/drivers/staging/ccree/ssi_driver.c
@@ -86,7 +86,7 @@ void __dump_byte_array(const char *name, const u8 *buf, 
size_t len)
if (!buf)
return;
 
-   snprintf(prefix, sizeof(prefix), "%s[%lu]: ", name, len);
+   snprintf(prefix, sizeof(prefix), "%s[%zu]: ", name, len);
 
print_hex_dump(KERN_DEBUG, prefix, DUMP_PREFIX_ADDRESS, 16, 1, buf,
   len, false);
diff --git a/drivers/staging/ccree/ssi_driver.h 
b/drivers/staging/ccree/ssi_driver.h
index 5a56f7a..bf83f3e 100644
--- a/drivers/staging/ccree/ssi_driver.h
+++ b/drivers/staging/ccree/ssi_driver.h
@@ -174,10 +174,9 @@ static inline struct device *drvdata_to_dev(struct 
cc_drvdata *drvdata)
return &drvdata->plat_dev->dev;
 }
 
-void __dump_byte_array(const char *name, const u8 *the_array,
-  unsigned long size);
+void __dump_byte_array(const char *name, const u8 *buf, size_t len);
 static inline void dump_byte_array(const char *name, const u8 *the_array,
-  unsigned long size)
+  size_t size)
 {
if (cc_dump_bytes)
__dump_byte_array(name, the_array, size);
-- 
2.7.4

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


Re: [PATCH] Staging: ccree: Add blank line after declarations

2017-12-19 Thread Gilad Ben-Yossef
Hi,

I've missed this patch as I wasn't CCed and just noticed it in staging-next...

On Sat, Dec 16, 2017 at 1:43 AM, Kamal Heib  wrote:
> This patch adds a blank line after declarations to
> improve code readability.
>
> Issue find by checkpatch.pl script.
> WARNING: Missing a blank line after declarations
>

Thank you Kamal for the patch but in this specific case it is
checkpatch that is wrong.

SHASH_DESC_ON_STACK macro is a definition and should not have a space
before it, just like LIST_HEAD macro. The problem is that checkpatch is missing
correct handling of crypto API definition macros so it complains.

I've sent a patch to fix this awhile back but alas it was not picked up:

https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1431518.html


> Signed-off-by: Kamal Heib 
> ---
>  drivers/staging/ccree/ssi_cipher.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/staging/ccree/ssi_cipher.c 
> b/drivers/staging/ccree/ssi_cipher.c
> index 791fe75b1d78..270d0a43c516 100644
> --- a/drivers/staging/ccree/ssi_cipher.c
> +++ b/drivers/staging/ccree/ssi_cipher.c
> @@ -373,6 +373,7 @@ static int cc_cipher_setkey(struct crypto_ablkcipher 
> *atfm, const u8 *key,
> /* sha256 for key2 - use sw implementation */
> int key_len = keylen >> 1;
> int err;
> +
> SHASH_DESC_ON_STACK(desc, ctx_p->shash_tfm);
>
> desc->tfm = ctx_p->shash_tfm;
> --
> 2.14.3


Thanks,
Gilad

-- 
Gilad Ben-Yossef
Chief Coffee Drinker

"If you take a class in large-scale robotics, can you end up in a
situation where the homework eats your dog?"
 -- Jean-Baptiste Queru
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: ccree: Add blank line after declarations

2017-12-19 Thread Greg Kroah-Hartman
On Wed, Dec 20, 2017 at 09:32:06AM +0200, Gilad Ben-Yossef wrote:
> Hi,
> 
> I've missed this patch as I wasn't CCed and just noticed it in staging-next...
> 
> On Sat, Dec 16, 2017 at 1:43 AM, Kamal Heib  wrote:
> > This patch adds a blank line after declarations to
> > improve code readability.
> >
> > Issue find by checkpatch.pl script.
> > WARNING: Missing a blank line after declarations
> >
> 
> Thank you Kamal for the patch but in this specific case it is
> checkpatch that is wrong.
> 
> SHASH_DESC_ON_STACK macro is a definition and should not have a space
> before it, just like LIST_HEAD macro. The problem is that checkpatch is 
> missing
> correct handling of crypto API definition macros so it complains.

Ugh, sorry about that, I didn't know it.

> I've sent a patch to fix this awhile back but alas it was not picked up:
> 
> https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1431518.html

Resend patches that get ignored :)

thanks,

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


Re: [PATCH] staging: ccree: use size_t consistently

2017-12-19 Thread Greg Kroah-Hartman
On Wed, Dec 20, 2017 at 07:23:31AM +, Gilad Ben-Yossef wrote:
> Fix declaration, implementation and wrapper function to use
> the same size_t type we actually define the parameter to be.
> 
> Fixes: 3f268f5d6669 ("staging: ccree: turn compile time debug log to params")
> Signed-off-by: Gilad Ben-Yossef 

You forgot the reported-by: tag :(

I'll go add it...
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel