Re: [PATCH] staging/ks7010: formatting updates.

2017-02-21 Thread Geert Uytterhoeven
Hi Matthew,

On Tue, Feb 21, 2017 at 5:20 AM, Matthew Giassa  wrote:
> Please pardon the earlier e-mail which was missing the changelog text.

This line should be between the "---" and the diffstat below.

> Some additional style changes to appease checkpatch.

Which additional style changes?

> ---
>  drivers/staging/ks7010/ks_wlan_ioctl.h | 80 
> +-
>  1 file changed, 41 insertions(+), 39 deletions(-)
>
> diff --git a/drivers/staging/ks7010/ks_wlan_ioctl.h 
> b/drivers/staging/ks7010/ks_wlan_ioctl.h
> index 84554b6..00eec18 100644
> --- a/drivers/staging/ks7010/ks_wlan_ioctl.h
> +++ b/drivers/staging/ks7010/ks_wlan_ioctl.h

>  #include "ks_wlan.h"
>  #include 
>
> -int ks_wlan_read_config_file(struct ks_wlan_private *priv);
> -int ks_wlan_setup_parameter(struct ks_wlan_private *priv,
> -unsigned int commit_flag);
> +int ks_wlan_read_config_file(
> +   struct ks_wlan_private *priv);
> +int ks_wlan_setup_parameter(
> +   struct ks_wlan_private *priv,
> +   unsigned int commit_flag);

Really?
If checkpatch complained about the above, you should file a bug report
against checkpatch.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] greybus: fw-management: Replace strncpy with strlcpy

2017-02-21 Thread Tobin Harding
On Thu, Feb 16, 2017, at 03:03 PM, Viresh Kumar wrote:
> Hi Tobin,
> 
> On Wed, Feb 15, 2017 at 5:39 AM, Tobin C. Harding  wrote:
> > Greybus currently uses strncpy() coupled with a check for '\0' on the
> > last byte of various buffers. strncpy() is passed size parameter equal
> > to the size of the buffer in all instances. If the source string is
> > larger than the destination buffer the check catches this and, after
> > logging the error, returns an error value. In one instance the
> > immediate return is not required. Using strncpy() with the manual check
> > adds code that could be removed by the use of strlcpy(), although truncation
> > then needs to be checked.
> >
> > Replace calls to strncpy() with calls to strlcpy(). Replace null
> > termination checks  with checks for truncated string. Add log message
> > if string is truncated but do not return an error code.
> >
> > Signed-off-by: Tobin C. Harding 
> > ---
> >  drivers/staging/greybus/fw-management.c | 59 
> > +++--
> >  1 file changed, 19 insertions(+), 40 deletions(-)
> >
> > diff --git a/drivers/staging/greybus/fw-management.c 
> > b/drivers/staging/greybus/fw-management.c
> > index 3cd6cf0..1cd5a45 100644
> > --- a/drivers/staging/greybus/fw-management.c
> > +++ b/drivers/staging/greybus/fw-management.c
> > @@ -108,6 +108,7 @@ static int 
> > fw_mgmt_interface_fw_version_operation(struct fw_mgmt *fw_mgmt,
> > struct gb_connection *connection = fw_mgmt->connection;
> > struct gb_fw_mgmt_interface_fw_version_response response;
> > int ret;
> > +   size_t len;
> >
> > ret = gb_operation_sync(connection,
> > GB_FW_MGMT_TYPE_INTERFACE_FW_VERSION, NULL, 
> > 0,
> > @@ -121,18 +122,11 @@ static int 
> > fw_mgmt_interface_fw_version_operation(struct fw_mgmt *fw_mgmt,
> > fw_info->major = le16_to_cpu(response.major);
> > fw_info->minor = le16_to_cpu(response.minor);
> >
> > -   strncpy(fw_info->firmware_tag, response.firmware_tag,
> > +   len = strlcpy(fw_info->firmware_tag, response.firmware_tag,
> > GB_FIRMWARE_TAG_MAX_SIZE);
> > -
> > -   /*
> > -* The firmware-tag should be NULL terminated, otherwise throw 
> > error but
> > -* don't fail.
> > -*/
> > -   if (fw_info->firmware_tag[GB_FIRMWARE_TAG_MAX_SIZE - 1] != '\0') {
> > +   if (len >= GB_FIRMWARE_TAG_MAX_SIZE)
> 
> I am not sure if the new code you have written is any better than what
> was already there.
> We still have a strcpy variant followed by a check. What has improved ?
> 
> 
> > @@ -142,6 +136,7 @@ static int fw_mgmt_load_and_validate_operation(struct 
> > fw_mgmt *fw_mgmt,
> >  {
> > struct gb_fw_mgmt_load_and_validate_fw_request request;
> > int ret;
> > +   size_t len;
> >
> > if (load_method != GB_FW_LOAD_METHOD_UNIPRO &&
> > load_method != GB_FW_LOAD_METHOD_INTERNAL) {
> > @@ -151,16 +146,10 @@ static int fw_mgmt_load_and_validate_operation(struct 
> > fw_mgmt *fw_mgmt,
> > }
> >
> > request.load_method = load_method;
> > -   strncpy(request.firmware_tag, tag, GB_FIRMWARE_TAG_MAX_SIZE);
> > -
> > -   /*
> > -* The firmware-tag should be NULL terminated, otherwise throw 
> > error and
> > -* fail.
> > -*/
> > -   if (request.firmware_tag[GB_FIRMWARE_TAG_MAX_SIZE - 1] != '\0') {
> > -   dev_err(fw_mgmt->parent, "load-and-validate: firmware-tag 
> > is not NULL terminated\n");
> > -   return -EINVAL;
> 
> Sorry but the error returns here and at other places were very
> intentional. I
> wrote them to make sure the protocol is followed properly, and the other
> side doesn't break it.
> 
> So far its a NAK from me.
> 
> --
> viresh

thanks for taking the time to review Viresh. I'll drop this patch.

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


Re: [PATCH v4 29/36] media: imx: mipi-csi2: enable setting and getting of frame rates

2017-02-21 Thread Philipp Zabel
On Mon, 2017-02-20 at 16:18 -0800, Steve Longerbeam wrote:
> 
> On 02/20/2017 04:13 PM, Russell King - ARM Linux wrote:
> > On Tue, Feb 21, 2017 at 12:04:10AM +0200, Sakari Ailus wrote:
> >> On Wed, Feb 15, 2017 at 06:19:31PM -0800, Steve Longerbeam wrote:
> >>> From: Russell King 
> >>>
> >>> Setting and getting frame rates is part of the negotiation mechanism
> >>> between subdevs.  The lack of support means that a frame rate at the
> >>> sensor can't be negotiated through the subdev path.
> >>
> >> Just wondering --- what do you need this for?
> >
> > The v4l2 documentation contradicts the media-ctl implementation.
> >
> > While v4l2 documentation says:
> >
> >   These ioctls are used to get and set the frame interval at specific
> >   subdev pads in the image pipeline. The frame interval only makes sense
> >   for sub-devices that can control the frame period on their own. This
> >   includes, for instance, image sensors and TV tuners. Sub-devices that
> >   don't support frame intervals must not implement these ioctls.
> >
> > However, when trying to configure the pipeline using media-ctl, eg:
> >
> > media-ctl -d /dev/media1 --set-v4l2 '"imx219 pixel 
> > 0-0010":0[crop:(0,0)/3264x2464]'
> > media-ctl -d /dev/media1 --set-v4l2 '"imx219 
> > 0-0010":1[fmt:SRGGB10/3264x2464@1/30]'
> > media-ctl -d /dev/media1 --set-v4l2 '"imx219 
> > 0-0010":0[fmt:SRGGB8/816x616@1/30]'
> > media-ctl -d /dev/media1 --set-v4l2 
> > '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616@1/30]'
> > Unable to setup formats: Inappropriate ioctl for device (25)
> > media-ctl -d /dev/media1 --set-v4l2 
> > '"ipu1_csi0_mux":2[fmt:SRGGB8/816x616@1/30]'
> > media-ctl -d /dev/media1 --set-v4l2 '"ipu1_csi0":2[fmt:SRGGB8/816x616@1/30]'
> >
> > The problem there is that the format setting for the csi2 does not get
> > propagated forward:
> >
> > $ strace media-ctl -d /dev/media1 --set-v4l2 
> > '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616@1/30]'
> > ...
> > open("/dev/v4l-subdev16", O_RDWR)   = 3
> > ioctl(3, VIDIOC_SUBDEV_S_FMT, 0xbec16244) = 0
> > ioctl(3, VIDIOC_SUBDEV_S_FRAME_INTERVAL, 0xbec162a4) = -1 ENOTTY 
> > (Inappropriate
> > ioctl for device)
> > fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 2), ...}) = 0
> > write(1, "Unable to setup formats: Inappro"..., 61) = 61
> > Unable to setup formats: Inappropriate ioctl for device (25)
> > close(3)= 0
> > exit_group(1)   = ?
> > +++ exited with 1 +++
> >
> > because media-ctl exits as soon as it encouters the error while trying
> > to set the frame rate.
> >
> > This makes implementing setup of the media pipeline in shell scripts
> > unnecessarily difficult - as you need to then know whether an entity
> > is likely not to support the VIDIOC_SUBDEV_S_FRAME_INTERVAL call,
> > and either avoid specifying a frame rate:
> >
> > $ strace media-ctl -d /dev/media1 --set-v4l2 
> > '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616]'
> > ...
> > open("/dev/v4l-subdev16", O_RDWR)   = 3
> > ioctl(3, VIDIOC_SUBDEV_S_FMT, 0xbeb1a254) = 0
> > open("/dev/v4l-subdev0", O_RDWR)= 4
> > ioctl(4, VIDIOC_SUBDEV_S_FMT, 0xbeb1a254) = 0
> > close(4)= 0
> > close(3)= 0
> > exit_group(0)   = ?
> > +++ exited with 0 +++
> >
> > or manually setting the format on the sink.
> >
> > Allowing the S_FRAME_INTERVAL call seems to me to be more in keeping
> > with the negotiation mechanism that is implemented in subdevs, and
> > IMHO should be implemented inside the kernel as a pad operation along
> > with the format negotiation, especially so as frame skipping is
> > defined as scaling, in just the same way as the frame size is also
> > scaling:
> >
> >-  ``MEDIA_ENT_F_PROC_VIDEO_SCALER``
> >
> >-  Video scaler. An entity capable of video scaling must have
> >   at least one sink pad and one source pad, and scale the
> >   video frame(s) received on its sink pad(s) to a different
> >   resolution output on its source pad(s). The range of
> >   supported scaling ratios is entity-specific and can differ
> >   between the horizontal and vertical directions (in particular
> >   scaling can be supported in one direction only). Binning and
> >   skipping are considered as scaling.
> >
> > Although, this is vague, as it doesn't define what it means by "skipping",
> > whether that's skipping pixels (iow, sub-sampling) or whether that's
> > frame skipping.

I'd interpret this as meaning pixel skipping, not frame skipping.

> > Then there's the issue where, if you have this setup:
> >
> >  camera --> csi2 receiver --> csi --> capture
> >
> > and the "csi" subdev can skip frames, you need to know (a) at the CSI
> > sink pad what the frame rate is of the source (b) what the desired
> > source pad frame rate is, so you can configure the frame skipping.
> > So, does the csi subdev have to walk back through the media graph
> 

Re: [PATCH v4 15/36] platform: add video-multiplexer subdevice driver

2017-02-21 Thread Philipp Zabel
On Sun, 2017-02-19 at 23:02 +0100, Pavel Machek wrote:
> Hi!
> 
> > From: Philipp Zabel 
> > 
> > This driver can handle SoC internal and external video bus multiplexers,
> > controlled either by register bit fields or by a GPIO. The subdevice
> > passes through frame interval and mbus configuration of the active input
> > to the output side.
> > 
> > Signed-off-by: Sascha Hauer 
> > Signed-off-by: Philipp Zabel 
> > --
> >
> 
> Again, this is slightly non-standard format. Normally changes from v1
> go below ---, but in your case it would cut off the signoff...
> 
> > diff --git a/Documentation/devicetree/bindings/media/video-multiplexer.txt 
> > b/Documentation/devicetree/bindings/media/video-multiplexer.txt
> > new file mode 100644
> > index 000..9d133d9
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/media/video-multiplexer.txt
> > @@ -0,0 +1,59 @@
> > +Video Multiplexer
> > +=
> > +
> > +Video multiplexers allow to select between multiple input ports. Video 
> > received
> > +on the active input port is passed through to the output port. Muxes 
> > described
> > +by this binding may be controlled by a syscon register bitfield or by a 
> > GPIO.
> > +
> > +Required properties:
> > +- compatible : should be "video-multiplexer"
> > +- reg: should be register base of the register containing the control 
> > bitfield
> > +- bit-mask: bitmask of the control bitfield in the control register
> > +- bit-shift: bit offset of the control bitfield in the control register
> > +- gpios: alternatively to reg, bit-mask, and bit-shift, a single GPIO 
> > phandle
> > +  may be given to switch between two inputs
> > +- #address-cells: should be <1>
> > +- #size-cells: should be <0>
> > +- port@*: at least three port nodes containing endpoints connecting to the
> > +  source and sink devices according to of_graph bindings. The last port is
> > +  the output port, all others are inputs.
> 
> At least three? I guess it is exactly three with the gpio?

Yes. With the mmio bitfield muxes there can be more.

> Plus you might want to describe which port correspond to which gpio
> state/bitfield values...
> 
> > +struct vidsw {
> 
> I knew it: it is secretely a switch! :-).

This driver started as a two-input gpio controlled bus switch.
I changed the name when adding support for bitfield controlled
multiplexers with more than two inputs.

> > +static void vidsw_set_active(struct vidsw *vidsw, int active)
> > +{
> > +   vidsw->active = active;
> > +   if (active < 0)
> > +   return;
> > +
> > +   dev_dbg(vidsw->subdev.dev, "setting %d active\n", active);
> > +
> > +   if (vidsw->field)
> > +   regmap_field_write(vidsw->field, active);
> > +   else if (vidsw->gpio)
> > +   gpiod_set_value(vidsw->gpio, active);
> 
>  else dev_err()...?

If neither field nor gpio are set, probe will have failed and this will
never be called.

> > +static int vidsw_async_init(struct vidsw *vidsw, struct device_node *node)
> > +{
> > +   struct device_node *ep;
> > +   u32 portno;
> > +   int numports;
> 
> numbports is int, so I guess portno should be, too?

We could change both to unsigned int, as both vidsw->num_pads and
endpoint.base.port are unsigned int, and they are only compared/assigned
to those and each other.

> > +   portno = endpoint.base.port;
> > +   if (portno >= numports - 1)
> > +   continue;
> 
 I. 
> > +   if (!pad) {
> > +   /* Mirror the input side on the output side */
> > +   cfg->type = vidsw->endpoint[vidsw->active].bus_type;
> > +   if (cfg->type == V4L2_MBUS_PARALLEL ||
> > +   cfg->type == V4L2_MBUS_BT656)
> > +   cfg->flags = 
> > vidsw->endpoint[vidsw->active].bus.parallel.flags;
> > +   }
> 
> Will this need support for other V4L2_MBUS_ values?

To support CSI-2 multiplexers, yes.

> > +MODULE_AUTHOR("Sascha Hauer, Pengutronix");
> > +MODULE_AUTHOR("Philipp Zabel, Pengutronix");
> 
> Normally, MODULE_AUTHOR contains comma separated names of authors,
> perhaps with . Not sure two MODULE_AUTHORs per file
> will work.
> 
> Thanks,
>   Pavel

regards
Philipp

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


Re: [PATCH] Staging: comedi: drivers: comedi_test: Avoid multiple line dereference

2017-02-21 Thread Cheah Kok Cheong
On Mon, Feb 20, 2017 at 05:36:52PM +, Ian Abbott wrote:
> On 20/02/17 16:02, Cheah Kok Cheong wrote:
> >On Mon, Feb 20, 2017 at 10:03:39AM +, Ian Abbott wrote:
> >>On 20/02/17 08:28, Cheah Kok Cheong wrote:
> >>>Fix checkpatch warning "Avoid multiple line dereference"
> >>>using a local variable to avoid line wrap.
> >>>
> >>>Signed-off-by: Cheah Kok Cheong 
> >>>---
> >>>drivers/staging/comedi/drivers/comedi_test.c | 6 ++
> >>>1 file changed, 2 insertions(+), 4 deletions(-)
> >>>
> >>>diff --git a/drivers/staging/comedi/drivers/comedi_test.c 
> >>>b/drivers/staging/comedi/drivers/comedi_test.c
> >>>index 2a063f0..fde83e0 100644
> >>>--- a/drivers/staging/comedi/drivers/comedi_test.c
> >>>+++ b/drivers/staging/comedi/drivers/comedi_test.c
> >>>@@ -480,11 +480,9 @@ static void waveform_ao_timer(unsigned long arg)
> >>>   /* output the last scan */
> >>>   for (i = 0; i < cmd->scan_end_arg; i++) {
> >>>   unsigned int chan = CR_CHAN(cmd->chanlist[i]);
> >>>+  unsigned short d = devpriv->ao_loopbacks[chan];
> >>>
> >>>-  if (comedi_buf_read_samples(s,
> >>>-  &devpriv->
> >>>-   ao_loopbacks[chan],
> >>>-  1) == 0) {
> >>>+  if (!comedi_buf_read_samples(s, &d, 1)) {
> >>>   /* unexpected underrun! (cancelled?) */
> >>>   async->events |= COMEDI_CB_OVERFLOW;
> >>>   goto underrun;
> >>>
> >>
> >>NAK.  This leaves devpriv->ao_loopbacks[chan] unchanged.
> >>
> >
> >Thanks for pointing this out. In that case will assigning the variable to
> >devpriv->ao_loopbacks[chan] be acceptable? Please review below snippet.
> >
> >Otherwise I'll just drop the variable and adjust the lines to avoid
> >checkpatch warning.
> >
> >Sorry for the inconvenience caused.
> >
> >[ Snip ]
> >
> > /* output the last scan */
> > for (i = 0; i < cmd->scan_end_arg; i++) {
> > unsigned int chan = CR_CHAN(cmd->chanlist[i]);
> > unsigned short data;
> >
> > if (!comedi_buf_read_samples(s, &data, 1)) {
> > /* unexpected underrun! (cancelled?) */
> > async->events |= COMEDI_CB_OVERFLOW;
> > goto underrun;
> > }
> >
> > devpriv->ao_loopbacks[chan] = data;
> > }
> > /* advance time of last scan */
> >
> >[ Snip ]
> 
> It will work, but you could just use a pointer variable set to
> &devpriv->ao_loopbacks[chan] and pass that to comedi_buf_read_samples().
> 

Thanks for the suggestion. I tried below snippet 1 with the shortest pointer
name but 80 characters is exceeded. The declaration and initialisation
will have to be splitted. Will this be acceptable or am I doing it wrong
again?

Sorry for the trouble.

Snippet 1:
[ Snip ]

/* output the last scan */
for (i = 0; i < cmd->scan_end_arg; i++) {
unsigned int chan = CR_CHAN(cmd->chanlist[i]);
unsigned short *p = 
&devpriv->ao_loopbacks[chan];

if (!comedi_buf_read_samples(s, p, 1)) {
/* unexpected underrun! (cancelled?) */
async->events |= COMEDI_CB_OVERFLOW;
goto underrun;
}
}
/* advance time of last scan */

[ Snip ]

Snippet 2:
[ Snip ]

/* output the last scan */
for (i = 0; i < cmd->scan_end_arg; i++) {
unsigned int chan = CR_CHAN(cmd->chanlist[i]);
unsigned short *pd;

pd = &devpriv->ao_loopbacks[chan];

if (!comedi_buf_read_samples(s, pd, 1)) {
/* unexpected underrun! (cancelled?) */
async->events |= COMEDI_CB_OVERFLOW;
goto underrun;
}
}

[ Snip ]

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


Re: [PATCH] Staging: comedi: drivers: comedi_test: Avoid multiple line dereference

2017-02-21 Thread Ian Abbott

On 21/02/2017 09:33, Cheah Kok Cheong wrote:

On Mon, Feb 20, 2017 at 05:36:52PM +, Ian Abbott wrote:

On 20/02/17 16:02, Cheah Kok Cheong wrote:

On Mon, Feb 20, 2017 at 10:03:39AM +, Ian Abbott wrote:

On 20/02/17 08:28, Cheah Kok Cheong wrote:

Fix checkpatch warning "Avoid multiple line dereference"
using a local variable to avoid line wrap.

Signed-off-by: Cheah Kok Cheong 
---
drivers/staging/comedi/drivers/comedi_test.c | 6 ++
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/comedi_test.c 
b/drivers/staging/comedi/drivers/comedi_test.c
index 2a063f0..fde83e0 100644
--- a/drivers/staging/comedi/drivers/comedi_test.c
+++ b/drivers/staging/comedi/drivers/comedi_test.c
@@ -480,11 +480,9 @@ static void waveform_ao_timer(unsigned long arg)
/* output the last scan */
for (i = 0; i < cmd->scan_end_arg; i++) {
unsigned int chan = CR_CHAN(cmd->chanlist[i]);
+   unsigned short d = devpriv->ao_loopbacks[chan];

-   if (comedi_buf_read_samples(s,
-   &devpriv->
-ao_loopbacks[chan],
-   1) == 0) {
+   if (!comedi_buf_read_samples(s, &d, 1)) {
/* unexpected underrun! (cancelled?) */
async->events |= COMEDI_CB_OVERFLOW;
goto underrun;



NAK.  This leaves devpriv->ao_loopbacks[chan] unchanged.



Thanks for pointing this out. In that case will assigning the variable to
devpriv->ao_loopbacks[chan] be acceptable? Please review below snippet.

Otherwise I'll just drop the variable and adjust the lines to avoid
checkpatch warning.

Sorry for the inconvenience caused.

[ Snip ]

/* output the last scan */
for (i = 0; i < cmd->scan_end_arg; i++) {
unsigned int chan = CR_CHAN(cmd->chanlist[i]);
unsigned short data;

if (!comedi_buf_read_samples(s, &data, 1)) {
/* unexpected underrun! (cancelled?) */
async->events |= COMEDI_CB_OVERFLOW;
goto underrun;
}

devpriv->ao_loopbacks[chan] = data;
}
/* advance time of last scan */

[ Snip ]


It will work, but you could just use a pointer variable set to
&devpriv->ao_loopbacks[chan] and pass that to comedi_buf_read_samples().



Thanks for the suggestion. I tried below snippet 1 with the shortest pointer
name but 80 characters is exceeded. The declaration and initialisation
will have to be splitted. Will this be acceptable or am I doing it wrong
again?

Sorry for the trouble.

Snippet 1:
[ Snip ]

/* output the last scan */
for (i = 0; i < cmd->scan_end_arg; i++) {
unsigned int chan = CR_CHAN(cmd->chanlist[i]);
unsigned short *p = 
&devpriv->ao_loopbacks[chan];

if (!comedi_buf_read_samples(s, p, 1)) {
/* unexpected underrun! (cancelled?) */
async->events |= COMEDI_CB_OVERFLOW;
goto underrun;
}
}
/* advance time of last scan */

[ Snip ]

Snippet 2:
[ Snip ]

/* output the last scan */
for (i = 0; i < cmd->scan_end_arg; i++) {
unsigned int chan = CR_CHAN(cmd->chanlist[i]);
unsigned short *pd;

pd = &devpriv->ao_loopbacks[chan];

if (!comedi_buf_read_samples(s, pd, 1)) {
/* unexpected underrun! (cancelled?) */
async->events |= COMEDI_CB_OVERFLOW;
goto underrun;
}
}

[ Snip ]


Snippet 2 looks fine.  Alternatives are to modify Snippet 1 to split the 
initialization of the pointer variable after the '=', or to shorten the 
the name of the 'chan' variable.


--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: comedi: drivers: comedi_test: Avoid multiple line dereference

2017-02-21 Thread Valentin Rothberg
On Feb 21 '17 10:12, Ian Abbott wrote:
> On 21/02/2017 09:33, Cheah Kok Cheong wrote:
> > On Mon, Feb 20, 2017 at 05:36:52PM +, Ian Abbott wrote:
> > > On 20/02/17 16:02, Cheah Kok Cheong wrote:
> > > > On Mon, Feb 20, 2017 at 10:03:39AM +, Ian Abbott wrote:
> > > > > On 20/02/17 08:28, Cheah Kok Cheong wrote:
> > > > > > Fix checkpatch warning "Avoid multiple line dereference"
> > > > > > using a local variable to avoid line wrap.
> > > > > > 
> > > > > > Signed-off-by: Cheah Kok Cheong 
> > > > > > ---
> > > > > > drivers/staging/comedi/drivers/comedi_test.c | 6 ++
> > > > > > 1 file changed, 2 insertions(+), 4 deletions(-)
> > > > > > 
> > > > > > diff --git a/drivers/staging/comedi/drivers/comedi_test.c 
> > > > > > b/drivers/staging/comedi/drivers/comedi_test.c
> > > > > > index 2a063f0..fde83e0 100644
> > > > > > --- a/drivers/staging/comedi/drivers/comedi_test.c
> > > > > > +++ b/drivers/staging/comedi/drivers/comedi_test.c
> > > > > > @@ -480,11 +480,9 @@ static void waveform_ao_timer(unsigned long 
> > > > > > arg)
> > > > > > /* output the last scan */
> > > > > > for (i = 0; i < cmd->scan_end_arg; i++) {
> > > > > > unsigned int chan = 
> > > > > > CR_CHAN(cmd->chanlist[i]);
> > > > > > +   unsigned short d = 
> > > > > > devpriv->ao_loopbacks[chan];
> > > > > > 
> > > > > > -   if (comedi_buf_read_samples(s,
> > > > > > -   &devpriv->
> > > > > > -
> > > > > > ao_loopbacks[chan],
> > > > > > -   1) == 0) {
> > > > > > +   if (!comedi_buf_read_samples(s, &d, 1)) 
> > > > > > {
> > > > > > /* unexpected underrun! 
> > > > > > (cancelled?) */
> > > > > > async->events |= 
> > > > > > COMEDI_CB_OVERFLOW;
> > > > > > goto underrun;
> > > > > > 
> > > > > 
> > > > > NAK.  This leaves devpriv->ao_loopbacks[chan] unchanged.
> > > > > 
> > > > 
> > > > Thanks for pointing this out. In that case will assigning the variable 
> > > > to
> > > > devpriv->ao_loopbacks[chan] be acceptable? Please review below snippet.
> > > > 
> > > > Otherwise I'll just drop the variable and adjust the lines to avoid
> > > > checkpatch warning.
> > > > 
> > > > Sorry for the inconvenience caused.
> > > > 
> > > > [ Snip ]
> > > > 
> > > > /* output the last scan */
> > > > for (i = 0; i < cmd->scan_end_arg; i++) {
> > > > unsigned int chan = 
> > > > CR_CHAN(cmd->chanlist[i]);
> > > > unsigned short data;
> > > > 
> > > > if (!comedi_buf_read_samples(s, &data, 
> > > > 1)) {
> > > > /* unexpected underrun! 
> > > > (cancelled?) */
> > > > async->events |= 
> > > > COMEDI_CB_OVERFLOW;
> > > > goto underrun;
> > > > }
> > > > 
> > > > devpriv->ao_loopbacks[chan] = data;
> > > > }
> > > > /* advance time of last scan */
> > > > 
> > > > [ Snip ]
> > > 
> > > It will work, but you could just use a pointer variable set to
> > > &devpriv->ao_loopbacks[chan] and pass that to comedi_buf_read_samples().
> > > 
> > 
> > Thanks for the suggestion. I tried below snippet 1 with the shortest pointer
> > name but 80 characters is exceeded. The declaration and initialisation
> > will have to be splitted. Will this be acceptable or am I doing it wrong
> > again?
> > 
> > Sorry for the trouble.
> > 
> > Snippet 1:
> > [ Snip ]
> > 
> > /* output the last scan */
> > for (i = 0; i < cmd->scan_end_arg; i++) {
> > unsigned int chan = CR_CHAN(cmd->chanlist[i]);
> > unsigned short *p = 
> > &devpriv->ao_loopbacks[chan];
> > 
> > if (!comedi_buf_read_samples(s, p, 1)) {
> > /* unexpected underrun! (cancelled?) */
> > async->events |= COMEDI_CB_OVERFLOW;
> > goto underrun;
> > }
> > }
> > /* advance time of last scan */
> > 
> > [ Snip ]
> > 
> > Snippet 2:
> > [ Snip ]
> > 
> > /* output the last scan */
> > for (i = 0; i < cmd->scan_end_arg; i++) {
> > unsigned int chan = CR_CHAN(cmd->chanlist[i]);
> > unsigned short *pd;
> > 
> > pd = &devpriv->ao_lo

[PATCH 0/3] Fix checkpatch warnings

2017-02-21 Thread Tobin C. Harding
Checkpatch emits various warnings. We can fix CONST_STRUCT trivially.
MULTILINE_DEREFERENCE warnings can be fixed but in most cases the fix
introduces line over 80 warnings.

Quote Documentation/process/coding-style.rst: "Statements longer than
80 columns will be broken into sensible chunks, unless exceeding 80
columns significantly increases readability and does not hide 
information"

Exceeding the 80 columns limit helps readabilty when it means we
don't have to break apart dereferences.

Remove line breaks from the middle of struct variable member
dereferences. Introduce new line over 80 checkpatch warnings.

Tobin C. Harding (3):
  staging: comedi: Fix checkpatch CONST_STRUCT
  staging: comedi: Remove level of indentation
  staging: comedi: Fix checkpatch MULTILINE_DEREFERENCE

 drivers/staging/comedi/drivers/addi_apci_3501.c  |  2 +-
 drivers/staging/comedi/drivers/adl_pci9118.c |  3 +--
 drivers/staging/comedi/drivers/cb_pcidas64.c | 29 +---
 drivers/staging/comedi/drivers/dt3000.c  |  3 +--
 drivers/staging/comedi/drivers/jr3_pci.c |  3 +--
 drivers/staging/comedi/drivers/ni_atmio.c|  4 ++--
 drivers/staging/comedi/drivers/ni_labpc_common.c |  3 +--
 drivers/staging/comedi/drivers/ni_mio_common.c   |  3 +--
 drivers/staging/comedi/drivers/rtd520.c  |  3 +--
 drivers/staging/comedi/drivers/s626.c| 11 -
 10 files changed, 24 insertions(+), 40 deletions(-)

-- 
2.7.4

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


[PATCH 1/3] staging: comedi: Fix checkpatch CONST_STRUCT

2017-02-21 Thread Tobin C. Harding
Checkpatch emits WARNING: struct comedi_lrange should normally be
const.

Add const keyword to definition of struct.

Signed-off-by: Tobin C. Harding 
---
 drivers/staging/comedi/drivers/addi_apci_3501.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_3501.c 
b/drivers/staging/comedi/drivers/addi_apci_3501.c
index 57f0f46..1fdc0f8 100644
--- a/drivers/staging/comedi/drivers/addi_apci_3501.c
+++ b/drivers/staging/comedi/drivers/addi_apci_3501.c
@@ -94,7 +94,7 @@ struct apci3501_private {
unsigned char timer_mode;
 };
 
-static struct comedi_lrange apci3501_ao_range = {
+static const struct comedi_lrange apci3501_ao_range = {
2, {
BIP_RANGE(10),
UNI_RANGE(10)
-- 
2.7.4

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


[PATCH 3/3] staging: comedi: Fix checkpatch MULTILINE_DEREFERENCE

2017-02-21 Thread Tobin C. Harding
Checkpatch emits multiple WARNING: Avoid multiple line dereference.
Removing these warnings will result in line over 80 warnings being
introduced. However,

Documentation/process/coding-style.rst: "Statements longer than 80
columns will be broken into sensible chunks, unless exceeding 80
columns significantly increases readability and does not hide
information"

Exceeding the 80 columns limit helps readabilty when it means we
don't have to break apart dereferences.

Remove line breaks from the middle of struct variable member
dereferences. Introduce new line over 80 checkpatch warnings.

Signed-off-by: Tobin C. Harding 
---
 drivers/staging/comedi/drivers/adl_pci9118.c |  3 +--
 drivers/staging/comedi/drivers/cb_pcidas64.c | 19 ++-
 drivers/staging/comedi/drivers/dt3000.c  |  3 +--
 drivers/staging/comedi/drivers/jr3_pci.c |  3 +--
 drivers/staging/comedi/drivers/ni_atmio.c|  4 ++--
 drivers/staging/comedi/drivers/ni_labpc_common.c |  3 +--
 drivers/staging/comedi/drivers/ni_mio_common.c   |  3 +--
 drivers/staging/comedi/drivers/rtd520.c  |  3 +--
 drivers/staging/comedi/drivers/s626.c| 11 ---
 9 files changed, 18 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index 86450c0..29ccb0b 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -1279,8 +1279,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev,
} else {
arg = cmd->convert_arg * cmd->chanlist_len;
}
-   err |= comedi_check_trigger_arg_min(&cmd->
-   scan_begin_arg,
+   err |= 
comedi_check_trigger_arg_min(&cmd->scan_begin_arg,
arg);
}
}
diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
b/drivers/staging/comedi/drivers/cb_pcidas64.c
index 352f754..62438cbf 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -1500,11 +1500,9 @@ static int alloc_and_init_dma_members(struct 
comedi_device *dev)
if (!ao_cmd_is_supported(board))
continue;
devpriv->ao_buffer[i] =
-   dma_alloc_coherent(&pcidev->dev,
-   DMA_BUFFER_SIZE,
-   &devpriv->
-   ao_buffer_bus_addr[i],
-   GFP_KERNEL);
+   dma_alloc_coherent(&pcidev->dev, DMA_BUFFER_SIZE,
+  &devpriv->ao_buffer_bus_addr[i],
+  GFP_KERNEL);
if (!devpriv->ao_buffer[i])
return -ENOMEM;
}
@@ -2476,18 +2474,13 @@ static int setup_channel_queue(struct comedi_device 
*dev,
for (i = 0; i < cmd->chanlist_len; i++) {
bits = 0;
/* set channel */
-   bits |= adc_chan_bits(CR_CHAN(cmd->
- chanlist[i]));
+   bits |= 
adc_chan_bits(CR_CHAN(cmd->chanlist[i]));
/* set gain */
bits |= ai_range_bits_6xxx(dev,
-  CR_RANGE(cmd->
-   chanlist
-   [i]));
+  
CR_RANGE(cmd->chanlist[i]));
/* set single-ended / differential */
bits |= se_diff_bit_6xxx(dev,
-CR_AREF(cmd->
-chanlist[i]) ==
-AREF_DIFF);
+
CR_AREF(cmd->chanlist[i]) == AREF_DIFF);
if (CR_AREF(cmd->chanlist[i]) == AREF_COMMON)
bits |= ADC_COMMON_BIT;
/* mark end of queue */
diff --git a/drivers/staging/comedi/drivers/dt3000.c 
b/drivers/staging/comedi/drivers/dt3000.c
index 19e0b7b..38b94d4 100644
--- a/drivers/staging/comedi/drivers/dt3000.c
+++ b/drivers/staging/comedi/drivers/dt3000.c
@@ -448,8 +448,7 @@ static int dt3k_ai_cmdtest(struct comedi_device *dev,
 
if (cmd->scan_begin_src == TRIG_TIMER) {
arg = cmd->convert_arg * cmd->scan

[PATCH 2/3] staging: comedi: Remove level of indentation

2017-02-21 Thread Tobin C. Harding
For loop contains only an if conditional (and body of if conditional).
Conditional can be inverted and the loop continued if the new
conditional is true without modifying the program logic. This allows
one level of indentation to be removed.

Invert conditional and continue loop if new conditional evaluates to
true. Remove one level of indentation from subsequent loop body.

Signed-off-by: Tobin C. Harding 
---
 drivers/staging/comedi/drivers/cb_pcidas64.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
b/drivers/staging/comedi/drivers/cb_pcidas64.c
index cb9c269..352f754 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -1497,16 +1497,16 @@ static int alloc_and_init_dma_members(struct 
comedi_device *dev)
return -ENOMEM;
}
for (i = 0; i < AO_DMA_RING_COUNT; i++) {
-   if (ao_cmd_is_supported(board)) {
-   devpriv->ao_buffer[i] =
-   dma_alloc_coherent(&pcidev->dev,
-  DMA_BUFFER_SIZE,
-  &devpriv->
-  ao_buffer_bus_addr[i],
-  GFP_KERNEL);
-   if (!devpriv->ao_buffer[i])
-   return -ENOMEM;
-   }
+   if (!ao_cmd_is_supported(board))
+   continue;
+   devpriv->ao_buffer[i] =
+   dma_alloc_coherent(&pcidev->dev,
+   DMA_BUFFER_SIZE,
+   &devpriv->
+   ao_buffer_bus_addr[i],
+   GFP_KERNEL);
+   if (!devpriv->ao_buffer[i])
+   return -ENOMEM;
}
/* allocate dma descriptors */
devpriv->ai_dma_desc =
-- 
2.7.4

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


[PATCH] return same error value from spk_set_key_info

2017-02-21 Thread Pranay Kr. Srivastava
This patch makes spk_set_key_info return -EINVAL
in case of failure instead of returning 4 different
values for the type of error that occurred.

Retain the previous error values as debug messages
instead.

Signed-off-by: Pranay Kr. Srivastava 
---
 drivers/staging/speakup/main.c | 24 
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index c2f70ef..396a57a 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1216,13 +1216,17 @@ int spk_set_key_info(const u_char *key_info, u_char 
*k_buffer)
u_char ch, version, num_keys;
 
version = *cp++;
-   if (version != KEY_MAP_VER)
-   return -1;
+   if (version != KEY_MAP_VER) {
+   pr_debug("Version mismatch %d\n", -1);
+   return -EINVAL;
+   }
num_keys = *cp;
states = (int)cp[1];
key_data_len = (states + 1) * (num_keys + 1);
-   if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(spk_key_buf))
-   return -2;
+   if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(spk_key_buf)) {
+   pr_debug("Data len and Shift table too big %d\n", -2);
+   return -EINVAL;
+   }
memset(k_buffer, 0, SHIFT_TBL_SIZE);
memset(spk_our_keys, 0, sizeof(spk_our_keys));
spk_shift_table = k_buffer;
@@ -1233,14 +1237,18 @@ int spk_set_key_info(const u_char *key_info, u_char 
*k_buffer)
cp1 += 2;   /* now pointing at shift states */
for (i = 1; i <= states; i++) {
ch = *cp1++;
-   if (ch >= SHIFT_TBL_SIZE)
-   return -3;
+   if (ch >= SHIFT_TBL_SIZE) {
+   pr_debug("Key table size overflow %d\n", -3);
+   return -EINVAL;
+   }
spk_shift_table[ch] = i;
}
keymap_flags = *cp1++;
while ((ch = *cp1)) {
-   if (ch >= MAX_KEY)
-   return -4;
+   if (ch >= MAX_KEY) {
+   pr_debug("Max Key overflow %d\n", -4);
+   return -EINVAL;
+   }
spk_our_keys[ch] = cp1;
cp1 += states + 1;
}
-- 
2.10.2

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


Re: [PATCH v4 29/36] media: imx: mipi-csi2: enable setting and getting of frame rates

2017-02-21 Thread Sakari Ailus
Hi Steve,

On Mon, Feb 20, 2017 at 02:56:15PM -0800, Steve Longerbeam wrote:
> 
> 
> On 02/20/2017 02:04 PM, Sakari Ailus wrote:
> >Hi Steve,
> >
> >On Wed, Feb 15, 2017 at 06:19:31PM -0800, Steve Longerbeam wrote:
> >>From: Russell King 
> >>
> >>Setting and getting frame rates is part of the negotiation mechanism
> >>between subdevs.  The lack of support means that a frame rate at the
> >>sensor can't be negotiated through the subdev path.
> >
> >Just wondering --- what do you need this for?
> 
> 
> Hi Sakari,
> 
> i.MX does need the ability to negotiate the frame rates in the
> pipelines. The CSI has the ability to skip frames at the output,
> which is something Philipp added to the CSI subdev. That affects
> frame interval at the CSI output.
> 
> But as Russell pointed out, the lack of [gs]_frame_interval op
> causes media-ctl to fail:
> 
> media-ctl -v -d /dev/media1 --set-v4l2
> '"imx6-mipi-csi2":1[fmt:SGBRG8/512x512@1/30]'
> 
> Opening media device /dev/media1
> Enumerating entities
> Found 29 entities
> Enumerating pads and links
> Setting up format SGBRG8 512x512 on pad imx6-mipi-csi2/1
> Format set: SGBRG8 512x512
> Setting up frame interval 1/30 on entity imx6-mipi-csi2
> Unable to set frame interval: Inappropriate ioctl for device (-25)Unable to
> setup formats: Inappropriate ioctl for device (25)
> 
> 
> So i.MX needs to implement this op in every subdev in the
> pipeline, otherwise it's not possible to configure the
> pipeline with media-ctl.

The frame rate is only set on the sub-device which you explicitly set it.
I.e. setting the frame rate fails if it's not supported on a pad.

Philipp recently posted patches that add frame rate propagation to
media-ctl.

Frame rate is typically settable (and gettable) only on sensor sub-device's
source pad, which means it normally would not be propagated by the kernel
but with Philipp's patches, on the sink pad of the bus receiver. Receivers
don't have a way to control it nor they implement the IOCTLs, so that would
indeed result in an error.

-- 
Kind regards,

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


[PATCH 3/6] staging: greybus: Remove unnecessary braces

2017-02-21 Thread simran singhal
This patch removes braces for single statement blocks. The warning
was detected using checkpatch.pl.
Coccinelle was used to make the change.

@@
expression e,e1;
@@
- if (e) {
+ if (e)
  e1;
- }

Signed-off-by: simran singhal 
---
 drivers/staging/greybus/audio_manager_sysfs.c | 3 +--
 drivers/staging/greybus/audio_topology.c  | 9 +++--
 drivers/staging/greybus/bootrom.c | 6 ++
 drivers/staging/greybus/control.c | 3 +--
 drivers/staging/greybus/es2.c | 3 +--
 drivers/staging/greybus/gpio.c| 6 ++
 drivers/staging/greybus/manifest.c| 3 +--
 drivers/staging/greybus/module.c  | 3 +--
 drivers/staging/greybus/svc.c | 9 +++--
 9 files changed, 15 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/greybus/audio_manager_sysfs.c 
b/drivers/staging/greybus/audio_manager_sysfs.c
index 34ebd14..dc1d7a1 100644
--- a/drivers/staging/greybus/audio_manager_sysfs.c
+++ b/drivers/staging/greybus/audio_manager_sysfs.c
@@ -88,10 +88,9 @@ static void manager_sysfs_init_attribute(
int err;
 
err = sysfs_create_file(kobj, &kattr->attr);
-   if (err) {
+   if (err)
pr_warn("creating the sysfs entry for %s failed: %d\n",
kattr->attr.name, err);
-   }
 }
 
 void gb_audio_manager_sysfs_init(struct kobject *kobj)
diff --git a/drivers/staging/greybus/audio_topology.c 
b/drivers/staging/greybus/audio_topology.c
index 3001a49..0e02f00 100644
--- a/drivers/staging/greybus/audio_topology.c
+++ b/drivers/staging/greybus/audio_topology.c
@@ -327,10 +327,9 @@ static int gbcodec_mixer_ctl_put(struct snd_kcontrol 
*kcontrol,
 
gb_pm_runtime_put_autosuspend(bundle);
 
-   if (ret) {
+   if (ret)
dev_err_ratelimited(codec->dev, "%d:Error in %s for %s\n", ret,
__func__, kcontrol->id.name);
-   }
 
return ret;
 }
@@ -637,10 +636,9 @@ static int gbcodec_enum_ctl_put(struct snd_kcontrol 
*kcontrol,
 
gb_pm_runtime_put_autosuspend(bundle);
 
-   if (ret) {
+   if (ret)
dev_err_ratelimited(codec->dev, "%d:Error in %s for %s\n", ret,
__func__, kcontrol->id.name);
-   }
 
return ret;
 }
@@ -837,11 +835,10 @@ static int gbcodec_enum_dapm_ctl_put(struct snd_kcontrol 
*kcontrol,
 
gb_pm_runtime_put_autosuspend(bundle);
 
-   if (ret) {
+   if (ret)
dev_err_ratelimited(codec->dev,
"%d:Error in %s for %s\n", ret,
__func__, kcontrol->id.name);
-   }
for (wi = 0; wi < wlist->num_widgets; wi++) {
widget = wlist->widgets[wi];
 
diff --git a/drivers/staging/greybus/bootrom.c 
b/drivers/staging/greybus/bootrom.c
index 5f90721..0e01e2b 100644
--- a/drivers/staging/greybus/bootrom.c
+++ b/drivers/staging/greybus/bootrom.c
@@ -176,10 +176,9 @@ static int find_firmware(struct gb_bootrom *bootrom, u8 
stage)
 
rc = request_firmware(&bootrom->fw, firmware_name,
&connection->bundle->dev);
-   if (rc) {
+   if (rc)
dev_err(&connection->bundle->dev,
"failed to find %s firmware (%d)\n", firmware_name, rc);
-   }
 
return rc;
 }
@@ -226,11 +225,10 @@ static int gb_bootrom_firmware_size_request(struct 
gb_operation *op)
mutex_unlock(&bootrom->mutex);
 
 queue_work:
-   if (!ret) {
+   if (!ret)
/* Refresh timeout */
gb_bootrom_set_timeout(bootrom, NEXT_REQ_GET_FIRMWARE,
   NEXT_REQ_TIMEOUT_MS);
-   }
 
return ret;
 }
diff --git a/drivers/staging/greybus/control.c 
b/drivers/staging/greybus/control.c
index 5b30be3..d8452c8 100644
--- a/drivers/staging/greybus/control.c
+++ b/drivers/staging/greybus/control.c
@@ -167,10 +167,9 @@ int gb_control_disconnecting_operation(struct gb_control 
*control,
request->cport_id = cpu_to_le16(cport_id);
 
ret = gb_operation_request_send_sync(operation);
-   if (ret) {
+   if (ret)
dev_err(&control->dev, "failed to send disconnecting: %d\n",
ret);
-   }
 
gb_operation_put(operation);
 
diff --git a/drivers/staging/greybus/es2.c b/drivers/staging/greybus/es2.c
index 93afd93..478eb53 100644
--- a/drivers/staging/greybus/es2.c
+++ b/drivers/staging/greybus/es2.c
@@ -1019,10 +1019,9 @@ static int arpc_sync(struct es2_ap_dev *es2, u8 type, 
void *payload,
spin_unlock_irqrestore(&es2->arpc_lock, flags);
arpc_free(rpc);
 
-   if (retval < 0 && retval != -EREMOTEIO) {
+   if (retval < 0 && retval != -EREMOTEIO)
dev_err(&es2->usb_dev->dev,
"failed to execute ARPC: %d\n", retval);
-  

Re: [PATCH] return same error value from spk_set_key_info

2017-02-21 Thread Samuel Thibault
Pranay Kr. Srivastava, on mar. 21 févr. 2017 17:24:42 +0530, wrote:
> Retain the previous error values as debug messages
> instead.

Well, they are not really useful because they are actually undocumented.

> + if (version != KEY_MAP_VER) {
> + pr_debug("Version mismatch %d\n", -1);

Rather print version and KEY_MAP_VER

> + if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(spk_key_buf)) {
> + pr_debug("Data len and Shift table too big %d\n", -2);

Rather print key_data_len + SHIFT_TBL_SIZE + 4 and sizeof(spk_key_buf)

> + if (ch >= SHIFT_TBL_SIZE) {
> + pr_debug("Key table size overflow %d\n", -3);

Rather print ch and SHIFT_TBL_SIZE.

> + if (ch >= MAX_KEY) {
> + pr_debug("Max Key overflow %d\n", -4);

Rather print ch and MAX_KEY.

Apart from that, returning -EINVAL instead of different values is fine
for me.

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


Re: [PATCH v4 29/36] media: imx: mipi-csi2: enable setting and getting of frame rates

2017-02-21 Thread Sakari Ailus
Hi Russell,

On Tue, Feb 21, 2017 at 12:13:32AM +, Russell King - ARM Linux wrote:
> On Tue, Feb 21, 2017 at 12:04:10AM +0200, Sakari Ailus wrote:
> > On Wed, Feb 15, 2017 at 06:19:31PM -0800, Steve Longerbeam wrote:
> > > From: Russell King 
> > > 
> > > Setting and getting frame rates is part of the negotiation mechanism
> > > between subdevs.  The lack of support means that a frame rate at the
> > > sensor can't be negotiated through the subdev path.
> > 
> > Just wondering --- what do you need this for?
> 
> The v4l2 documentation contradicts the media-ctl implementation.
> 
> While v4l2 documentation says:
> 
>   These ioctls are used to get and set the frame interval at specific
>   subdev pads in the image pipeline. The frame interval only makes sense
>   for sub-devices that can control the frame period on their own. This
>   includes, for instance, image sensors and TV tuners. Sub-devices that
>   don't support frame intervals must not implement these ioctls.
> 
> However, when trying to configure the pipeline using media-ctl, eg:
> 
> media-ctl -d /dev/media1 --set-v4l2 '"imx219 pixel 
> 0-0010":0[crop:(0,0)/3264x2464]'
> media-ctl -d /dev/media1 --set-v4l2 '"imx219 
> 0-0010":1[fmt:SRGGB10/3264x2464@1/30]'
> media-ctl -d /dev/media1 --set-v4l2 '"imx219 
> 0-0010":0[fmt:SRGGB8/816x616@1/30]'
> media-ctl -d /dev/media1 --set-v4l2 
> '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616@1/30]'
> Unable to setup formats: Inappropriate ioctl for device (25)
> media-ctl -d /dev/media1 --set-v4l2 
> '"ipu1_csi0_mux":2[fmt:SRGGB8/816x616@1/30]'
> media-ctl -d /dev/media1 --set-v4l2 '"ipu1_csi0":2[fmt:SRGGB8/816x616@1/30]'
> 
> The problem there is that the format setting for the csi2 does not get
> propagated forward:

The CSI-2 receivers typically do not implement frame interval IOCTLs as they
do not control the frame interval. Some sensors or TV tuners typically do,
so they implement these IOCTLs.

There are alternative ways to specify the frame rate.

> 
> $ strace media-ctl -d /dev/media1 --set-v4l2 
> '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616@1/30]'
> ...
> open("/dev/v4l-subdev16", O_RDWR)   = 3
> ioctl(3, VIDIOC_SUBDEV_S_FMT, 0xbec16244) = 0
> ioctl(3, VIDIOC_SUBDEV_S_FRAME_INTERVAL, 0xbec162a4) = -1 ENOTTY 
> (Inappropriate
> ioctl for device)
> fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 2), ...}) = 0
> write(1, "Unable to setup formats: Inappro"..., 61) = 61
> Unable to setup formats: Inappropriate ioctl for device (25)
> close(3)= 0
> exit_group(1)   = ?
> +++ exited with 1 +++
> 
> because media-ctl exits as soon as it encouters the error while trying
> to set the frame rate.
> 
> This makes implementing setup of the media pipeline in shell scripts
> unnecessarily difficult - as you need to then know whether an entity
> is likely not to support the VIDIOC_SUBDEV_S_FRAME_INTERVAL call,
> and either avoid specifying a frame rate:

You should remove the frame interval setting from sub-devices that do not
support it.

> 
> $ strace media-ctl -d /dev/media1 --set-v4l2 
> '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616]'
> ...
> open("/dev/v4l-subdev16", O_RDWR)   = 3
> ioctl(3, VIDIOC_SUBDEV_S_FMT, 0xbeb1a254) = 0
> open("/dev/v4l-subdev0", O_RDWR)= 4
> ioctl(4, VIDIOC_SUBDEV_S_FMT, 0xbeb1a254) = 0
> close(4)= 0
> close(3)= 0
> exit_group(0)   = ?
> +++ exited with 0 +++
> 
> or manually setting the format on the sink.
> 
> Allowing the S_FRAME_INTERVAL call seems to me to be more in keeping
> with the negotiation mechanism that is implemented in subdevs, and
> IMHO should be implemented inside the kernel as a pad operation along
> with the format negotiation, especially so as frame skipping is
> defined as scaling, in just the same way as the frame size is also
> scaling:

The origins of the S_FRAME_INTERVAL IOCTL for sub-devices are the S_PARM
IOCTL for video nodes. It is used to control the frame rate for more simple
devices that do not expose the Media controller interface. The similar
S_FRAME_INTERVAL was added for sub-devices as well, and it has been so far
used to control the frame interval for sensors (and G_FRAME_INTERVAL to
obtain the frame interval for TV tuners, for instance).

The pad argument was added there but media-ctl only supported setting the
frame interval on pad 0, which, coincidentally, worked well for sensor
devices.

The link validation is primarily done in order to ensure the validity of the
hardware configuration: streaming may not be started if the hardware
configuration is not valid.

Also, frame interval is not a static property during streaming: it may be
changed without the knowledge of the other sub-device drivers downstream. It
neither is a property of hardware receiving or processing images: if there
are limitations in processing pixels, then they in practice are related to
pixel rates or image sizes (i.e. not frame 

[PATCH v2 3/6] staging: greybus: Remove unnecessary braces

2017-02-21 Thread simran singhal
This patch removes braces for single statement blocks. The warning
was detected using checkpatch.pl.
Coccinelle was used to make the change.

@@
expression e,e1;
@@
- if (e) {
+ if (e)
  e1;
- }

Signed-off-by: simran singhal 
---
 
 v2:
   -I forgot to cc outreachy mailing list

 drivers/staging/greybus/audio_manager_sysfs.c | 3 +--
 drivers/staging/greybus/audio_topology.c  | 9 +++--
 drivers/staging/greybus/bootrom.c | 6 ++
 drivers/staging/greybus/control.c | 3 +--
 drivers/staging/greybus/es2.c | 3 +--
 drivers/staging/greybus/gpio.c| 6 ++
 drivers/staging/greybus/manifest.c| 3 +--
 drivers/staging/greybus/module.c  | 3 +--
 drivers/staging/greybus/svc.c | 9 +++--
 9 files changed, 15 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/greybus/audio_manager_sysfs.c 
b/drivers/staging/greybus/audio_manager_sysfs.c
index 34ebd14..dc1d7a1 100644
--- a/drivers/staging/greybus/audio_manager_sysfs.c
+++ b/drivers/staging/greybus/audio_manager_sysfs.c
@@ -88,10 +88,9 @@ static void manager_sysfs_init_attribute(
int err;
 
err = sysfs_create_file(kobj, &kattr->attr);
-   if (err) {
+   if (err)
pr_warn("creating the sysfs entry for %s failed: %d\n",
kattr->attr.name, err);
-   }
 }
 
 void gb_audio_manager_sysfs_init(struct kobject *kobj)
diff --git a/drivers/staging/greybus/audio_topology.c 
b/drivers/staging/greybus/audio_topology.c
index 3001a49..0e02f00 100644
--- a/drivers/staging/greybus/audio_topology.c
+++ b/drivers/staging/greybus/audio_topology.c
@@ -327,10 +327,9 @@ static int gbcodec_mixer_ctl_put(struct snd_kcontrol 
*kcontrol,
 
gb_pm_runtime_put_autosuspend(bundle);
 
-   if (ret) {
+   if (ret)
dev_err_ratelimited(codec->dev, "%d:Error in %s for %s\n", ret,
__func__, kcontrol->id.name);
-   }
 
return ret;
 }
@@ -637,10 +636,9 @@ static int gbcodec_enum_ctl_put(struct snd_kcontrol 
*kcontrol,
 
gb_pm_runtime_put_autosuspend(bundle);
 
-   if (ret) {
+   if (ret)
dev_err_ratelimited(codec->dev, "%d:Error in %s for %s\n", ret,
__func__, kcontrol->id.name);
-   }
 
return ret;
 }
@@ -837,11 +835,10 @@ static int gbcodec_enum_dapm_ctl_put(struct snd_kcontrol 
*kcontrol,
 
gb_pm_runtime_put_autosuspend(bundle);
 
-   if (ret) {
+   if (ret)
dev_err_ratelimited(codec->dev,
"%d:Error in %s for %s\n", ret,
__func__, kcontrol->id.name);
-   }
for (wi = 0; wi < wlist->num_widgets; wi++) {
widget = wlist->widgets[wi];
 
diff --git a/drivers/staging/greybus/bootrom.c 
b/drivers/staging/greybus/bootrom.c
index 5f90721..0e01e2b 100644
--- a/drivers/staging/greybus/bootrom.c
+++ b/drivers/staging/greybus/bootrom.c
@@ -176,10 +176,9 @@ static int find_firmware(struct gb_bootrom *bootrom, u8 
stage)
 
rc = request_firmware(&bootrom->fw, firmware_name,
&connection->bundle->dev);
-   if (rc) {
+   if (rc)
dev_err(&connection->bundle->dev,
"failed to find %s firmware (%d)\n", firmware_name, rc);
-   }
 
return rc;
 }
@@ -226,11 +225,10 @@ static int gb_bootrom_firmware_size_request(struct 
gb_operation *op)
mutex_unlock(&bootrom->mutex);
 
 queue_work:
-   if (!ret) {
+   if (!ret)
/* Refresh timeout */
gb_bootrom_set_timeout(bootrom, NEXT_REQ_GET_FIRMWARE,
   NEXT_REQ_TIMEOUT_MS);
-   }
 
return ret;
 }
diff --git a/drivers/staging/greybus/control.c 
b/drivers/staging/greybus/control.c
index 5b30be3..d8452c8 100644
--- a/drivers/staging/greybus/control.c
+++ b/drivers/staging/greybus/control.c
@@ -167,10 +167,9 @@ int gb_control_disconnecting_operation(struct gb_control 
*control,
request->cport_id = cpu_to_le16(cport_id);
 
ret = gb_operation_request_send_sync(operation);
-   if (ret) {
+   if (ret)
dev_err(&control->dev, "failed to send disconnecting: %d\n",
ret);
-   }
 
gb_operation_put(operation);
 
diff --git a/drivers/staging/greybus/es2.c b/drivers/staging/greybus/es2.c
index 93afd93..478eb53 100644
--- a/drivers/staging/greybus/es2.c
+++ b/drivers/staging/greybus/es2.c
@@ -1019,10 +1019,9 @@ static int arpc_sync(struct es2_ap_dev *es2, u8 type, 
void *payload,
spin_unlock_irqrestore(&es2->arpc_lock, flags);
arpc_free(rpc);
 
-   if (retval < 0 && retval != -EREMOTEIO) {
+   if (retval < 0 && retval != -EREMOTEIO)
dev_err(&es2->usb_dev->dev,
  

Re: [Outreachy kernel] [PATCH v2 3/6] staging: greybus: Remove unnecessary braces

2017-02-21 Thread Julia Lawall


On Tue, 21 Feb 2017, simran singhal wrote:

> This patch removes braces for single statement blocks. The warning
> was detected using checkpatch.pl.
> Coccinelle was used to make the change.
>
> @@
> expression e,e1;
> @@
> - if (e) {
> + if (e)
>   e1;
> - }
>
> Signed-off-by: simran singhal 

Acked-by: Julia Lawall 

> ---
>
>  v2:
>-I forgot to cc outreachy mailing list
>
>  drivers/staging/greybus/audio_manager_sysfs.c | 3 +--
>  drivers/staging/greybus/audio_topology.c  | 9 +++--
>  drivers/staging/greybus/bootrom.c | 6 ++
>  drivers/staging/greybus/control.c | 3 +--
>  drivers/staging/greybus/es2.c | 3 +--
>  drivers/staging/greybus/gpio.c| 6 ++
>  drivers/staging/greybus/manifest.c| 3 +--
>  drivers/staging/greybus/module.c  | 3 +--
>  drivers/staging/greybus/svc.c | 9 +++--
>  9 files changed, 15 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/staging/greybus/audio_manager_sysfs.c 
> b/drivers/staging/greybus/audio_manager_sysfs.c
> index 34ebd14..dc1d7a1 100644
> --- a/drivers/staging/greybus/audio_manager_sysfs.c
> +++ b/drivers/staging/greybus/audio_manager_sysfs.c
> @@ -88,10 +88,9 @@ static void manager_sysfs_init_attribute(
>   int err;
>
>   err = sysfs_create_file(kobj, &kattr->attr);
> - if (err) {
> + if (err)
>   pr_warn("creating the sysfs entry for %s failed: %d\n",
>   kattr->attr.name, err);
> - }
>  }
>
>  void gb_audio_manager_sysfs_init(struct kobject *kobj)
> diff --git a/drivers/staging/greybus/audio_topology.c 
> b/drivers/staging/greybus/audio_topology.c
> index 3001a49..0e02f00 100644
> --- a/drivers/staging/greybus/audio_topology.c
> +++ b/drivers/staging/greybus/audio_topology.c
> @@ -327,10 +327,9 @@ static int gbcodec_mixer_ctl_put(struct snd_kcontrol 
> *kcontrol,
>
>   gb_pm_runtime_put_autosuspend(bundle);
>
> - if (ret) {
> + if (ret)
>   dev_err_ratelimited(codec->dev, "%d:Error in %s for %s\n", ret,
>   __func__, kcontrol->id.name);
> - }
>
>   return ret;
>  }
> @@ -637,10 +636,9 @@ static int gbcodec_enum_ctl_put(struct snd_kcontrol 
> *kcontrol,
>
>   gb_pm_runtime_put_autosuspend(bundle);
>
> - if (ret) {
> + if (ret)
>   dev_err_ratelimited(codec->dev, "%d:Error in %s for %s\n", ret,
>   __func__, kcontrol->id.name);
> - }
>
>   return ret;
>  }
> @@ -837,11 +835,10 @@ static int gbcodec_enum_dapm_ctl_put(struct 
> snd_kcontrol *kcontrol,
>
>   gb_pm_runtime_put_autosuspend(bundle);
>
> - if (ret) {
> + if (ret)
>   dev_err_ratelimited(codec->dev,
>   "%d:Error in %s for %s\n", ret,
>   __func__, kcontrol->id.name);
> - }
>   for (wi = 0; wi < wlist->num_widgets; wi++) {
>   widget = wlist->widgets[wi];
>
> diff --git a/drivers/staging/greybus/bootrom.c 
> b/drivers/staging/greybus/bootrom.c
> index 5f90721..0e01e2b 100644
> --- a/drivers/staging/greybus/bootrom.c
> +++ b/drivers/staging/greybus/bootrom.c
> @@ -176,10 +176,9 @@ static int find_firmware(struct gb_bootrom *bootrom, u8 
> stage)
>
>   rc = request_firmware(&bootrom->fw, firmware_name,
>   &connection->bundle->dev);
> - if (rc) {
> + if (rc)
>   dev_err(&connection->bundle->dev,
>   "failed to find %s firmware (%d)\n", firmware_name, rc);
> - }
>
>   return rc;
>  }
> @@ -226,11 +225,10 @@ static int gb_bootrom_firmware_size_request(struct 
> gb_operation *op)
>   mutex_unlock(&bootrom->mutex);
>
>  queue_work:
> - if (!ret) {
> + if (!ret)
>   /* Refresh timeout */
>   gb_bootrom_set_timeout(bootrom, NEXT_REQ_GET_FIRMWARE,
>  NEXT_REQ_TIMEOUT_MS);
> - }
>
>   return ret;
>  }
> diff --git a/drivers/staging/greybus/control.c 
> b/drivers/staging/greybus/control.c
> index 5b30be3..d8452c8 100644
> --- a/drivers/staging/greybus/control.c
> +++ b/drivers/staging/greybus/control.c
> @@ -167,10 +167,9 @@ int gb_control_disconnecting_operation(struct gb_control 
> *control,
>   request->cport_id = cpu_to_le16(cport_id);
>
>   ret = gb_operation_request_send_sync(operation);
> - if (ret) {
> + if (ret)
>   dev_err(&control->dev, "failed to send disconnecting: %d\n",
>   ret);
> - }
>
>   gb_operation_put(operation);
>
> diff --git a/drivers/staging/greybus/es2.c b/drivers/staging/greybus/es2.c
> index 93afd93..478eb53 100644
> --- a/drivers/staging/greybus/es2.c
> +++ b/drivers/staging/greybus/es2.c
> @@ -1019,10 +1019,9 @@ static int arpc_sync(struct es2_ap_dev *es2, u8 type, 
> void *payload,
>   spin_unlock_irqres

Re: [Outreachy kernel] [PATCH v2 3/6] staging: greybus: Remove unnecessary braces

2017-02-21 Thread Julia Lawall


On Tue, 21 Feb 2017, simran singhal wrote:

> This patch removes braces for single statement blocks. The warning
> was detected using checkpatch.pl.
> Coccinelle was used to make the change.
>
> @@
> expression e,e1;
> @@
> - if (e) {
> + if (e)
>   e1;
> - }
>
> Signed-off-by: simran singhal 
> ---
>
>  v2:
>-I forgot to cc outreachy mailing list
>
>  drivers/staging/greybus/audio_manager_sysfs.c | 3 +--
>  drivers/staging/greybus/audio_topology.c  | 9 +++--
>  drivers/staging/greybus/bootrom.c | 6 ++
>  drivers/staging/greybus/control.c | 3 +--
>  drivers/staging/greybus/es2.c | 3 +--
>  drivers/staging/greybus/gpio.c| 6 ++
>  drivers/staging/greybus/manifest.c| 3 +--
>  drivers/staging/greybus/module.c  | 3 +--
>  drivers/staging/greybus/svc.c | 9 +++--
>  9 files changed, 15 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/staging/greybus/audio_manager_sysfs.c 
> b/drivers/staging/greybus/audio_manager_sysfs.c
> index 34ebd14..dc1d7a1 100644
> --- a/drivers/staging/greybus/audio_manager_sysfs.c
> +++ b/drivers/staging/greybus/audio_manager_sysfs.c
> @@ -88,10 +88,9 @@ static void manager_sysfs_init_attribute(
>   int err;
>
>   err = sysfs_create_file(kobj, &kattr->attr);
> - if (err) {
> + if (err)
>   pr_warn("creating the sysfs entry for %s failed: %d\n",
>   kattr->attr.name, err);

Maybe there is an opportunity for using a dev_... function here.

julia

> - }
>  }
>
>  void gb_audio_manager_sysfs_init(struct kobject *kobj)
> diff --git a/drivers/staging/greybus/audio_topology.c 
> b/drivers/staging/greybus/audio_topology.c
> index 3001a49..0e02f00 100644
> --- a/drivers/staging/greybus/audio_topology.c
> +++ b/drivers/staging/greybus/audio_topology.c
> @@ -327,10 +327,9 @@ static int gbcodec_mixer_ctl_put(struct snd_kcontrol 
> *kcontrol,
>
>   gb_pm_runtime_put_autosuspend(bundle);
>
> - if (ret) {
> + if (ret)
>   dev_err_ratelimited(codec->dev, "%d:Error in %s for %s\n", ret,
>   __func__, kcontrol->id.name);
> - }
>
>   return ret;
>  }
> @@ -637,10 +636,9 @@ static int gbcodec_enum_ctl_put(struct snd_kcontrol 
> *kcontrol,
>
>   gb_pm_runtime_put_autosuspend(bundle);
>
> - if (ret) {
> + if (ret)
>   dev_err_ratelimited(codec->dev, "%d:Error in %s for %s\n", ret,
>   __func__, kcontrol->id.name);
> - }
>
>   return ret;
>  }
> @@ -837,11 +835,10 @@ static int gbcodec_enum_dapm_ctl_put(struct 
> snd_kcontrol *kcontrol,
>
>   gb_pm_runtime_put_autosuspend(bundle);
>
> - if (ret) {
> + if (ret)
>   dev_err_ratelimited(codec->dev,
>   "%d:Error in %s for %s\n", ret,
>   __func__, kcontrol->id.name);
> - }
>   for (wi = 0; wi < wlist->num_widgets; wi++) {
>   widget = wlist->widgets[wi];
>
> diff --git a/drivers/staging/greybus/bootrom.c 
> b/drivers/staging/greybus/bootrom.c
> index 5f90721..0e01e2b 100644
> --- a/drivers/staging/greybus/bootrom.c
> +++ b/drivers/staging/greybus/bootrom.c
> @@ -176,10 +176,9 @@ static int find_firmware(struct gb_bootrom *bootrom, u8 
> stage)
>
>   rc = request_firmware(&bootrom->fw, firmware_name,
>   &connection->bundle->dev);
> - if (rc) {
> + if (rc)
>   dev_err(&connection->bundle->dev,
>   "failed to find %s firmware (%d)\n", firmware_name, rc);
> - }
>
>   return rc;
>  }
> @@ -226,11 +225,10 @@ static int gb_bootrom_firmware_size_request(struct 
> gb_operation *op)
>   mutex_unlock(&bootrom->mutex);
>
>  queue_work:
> - if (!ret) {
> + if (!ret)
>   /* Refresh timeout */
>   gb_bootrom_set_timeout(bootrom, NEXT_REQ_GET_FIRMWARE,
>  NEXT_REQ_TIMEOUT_MS);
> - }
>
>   return ret;
>  }
> diff --git a/drivers/staging/greybus/control.c 
> b/drivers/staging/greybus/control.c
> index 5b30be3..d8452c8 100644
> --- a/drivers/staging/greybus/control.c
> +++ b/drivers/staging/greybus/control.c
> @@ -167,10 +167,9 @@ int gb_control_disconnecting_operation(struct gb_control 
> *control,
>   request->cport_id = cpu_to_le16(cport_id);
>
>   ret = gb_operation_request_send_sync(operation);
> - if (ret) {
> + if (ret)
>   dev_err(&control->dev, "failed to send disconnecting: %d\n",
>   ret);
> - }
>
>   gb_operation_put(operation);
>
> diff --git a/drivers/staging/greybus/es2.c b/drivers/staging/greybus/es2.c
> index 93afd93..478eb53 100644
> --- a/drivers/staging/greybus/es2.c
> +++ b/drivers/staging/greybus/es2.c
> @@ -1019,10 +1019,9 @@ static int arpc_sync(struct es2_ap_dev *es2, u8 ty

Re: [PATCH v4 29/36] media: imx: mipi-csi2: enable setting and getting of frame rates

2017-02-21 Thread Russell King - ARM Linux
On Tue, Feb 21, 2017 at 02:37:57PM +0200, Sakari Ailus wrote:
> Hi Russell,
> 
> On Tue, Feb 21, 2017 at 12:13:32AM +, Russell King - ARM Linux wrote:
> > On Tue, Feb 21, 2017 at 12:04:10AM +0200, Sakari Ailus wrote:
> > > On Wed, Feb 15, 2017 at 06:19:31PM -0800, Steve Longerbeam wrote:
> > > > From: Russell King 
> > > > 
> > > > Setting and getting frame rates is part of the negotiation mechanism
> > > > between subdevs.  The lack of support means that a frame rate at the
> > > > sensor can't be negotiated through the subdev path.
> > > 
> > > Just wondering --- what do you need this for?
> > 
> > The v4l2 documentation contradicts the media-ctl implementation.
> > 
> > While v4l2 documentation says:
> > 
> >   These ioctls are used to get and set the frame interval at specific
> >   subdev pads in the image pipeline. The frame interval only makes sense
> >   for sub-devices that can control the frame period on their own. This
> >   includes, for instance, image sensors and TV tuners. Sub-devices that
> >   don't support frame intervals must not implement these ioctls.
> > 
> > However, when trying to configure the pipeline using media-ctl, eg:
> > 
> > media-ctl -d /dev/media1 --set-v4l2 '"imx219 pixel 
> > 0-0010":0[crop:(0,0)/3264x2464]'
> > media-ctl -d /dev/media1 --set-v4l2 '"imx219 
> > 0-0010":1[fmt:SRGGB10/3264x2464@1/30]'
> > media-ctl -d /dev/media1 --set-v4l2 '"imx219 
> > 0-0010":0[fmt:SRGGB8/816x616@1/30]'
> > media-ctl -d /dev/media1 --set-v4l2 
> > '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616@1/30]'
> > Unable to setup formats: Inappropriate ioctl for device (25)
> > media-ctl -d /dev/media1 --set-v4l2 
> > '"ipu1_csi0_mux":2[fmt:SRGGB8/816x616@1/30]'
> > media-ctl -d /dev/media1 --set-v4l2 '"ipu1_csi0":2[fmt:SRGGB8/816x616@1/30]'
> > 
> > The problem there is that the format setting for the csi2 does not get
> > propagated forward:
> 
> The CSI-2 receivers typically do not implement frame interval IOCTLs as they
> do not control the frame interval. Some sensors or TV tuners typically do,
> so they implement these IOCTLs.

No, TV tuners do not.  The frame rate for a TV tuner is set by the
broadcaster, not by the tuner.  The tuner can't change that frame rate.
The tuner may opt to "skip" fields or frames.  That's no different from
what the CSI block in my example below is capable of doing.

Treating a tuner differently from the CSI block is inconsistent and
completely wrong.

> There are alternative ways to specify the frame rate.

Empty statements (or hand-waving type statements) I'm afraid don't
contribute to the discussion, because they mean nothing to me.  Please
give an example, or flesh out what you mean.

> > $ strace media-ctl -d /dev/media1 --set-v4l2 
> > '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616@1/30]'
> > ...
> > open("/dev/v4l-subdev16", O_RDWR)   = 3
> > ioctl(3, VIDIOC_SUBDEV_S_FMT, 0xbec16244) = 0
> > ioctl(3, VIDIOC_SUBDEV_S_FRAME_INTERVAL, 0xbec162a4) = -1 ENOTTY 
> > (Inappropriate
> > ioctl for device)
> > fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 2), ...}) = 0
> > write(1, "Unable to setup formats: Inappro"..., 61) = 61
> > Unable to setup formats: Inappropriate ioctl for device (25)
> > close(3)= 0
> > exit_group(1)   = ?
> > +++ exited with 1 +++
> > 
> > because media-ctl exits as soon as it encouters the error while trying
> > to set the frame rate.
> > 
> > This makes implementing setup of the media pipeline in shell scripts
> > unnecessarily difficult - as you need to then know whether an entity
> > is likely not to support the VIDIOC_SUBDEV_S_FRAME_INTERVAL call,
> > and either avoid specifying a frame rate:
> 
> You should remove the frame interval setting from sub-devices that do not
> support it.

That means we end up with horribly complex scripts.  This "solution" does
not scale.  Therefore, it is not a "solution".

It's fine if you want to write a script to setup the media pipeline using
media-ctl, listing _each_ media-ctl command individually, with arguments
specific to each step, but as I've already said, that does not scale.

I don't want to end up writing separate scripts to configure the pipeline
for different parameters or setups.  I don't want to teach users how to
do that either.

How are users supposed to cope with this craziness?  Are they expected to
write their own scripts and understand this stuff?

As far as I can see, there are no applications out there at the moment that
come close to understanding how to configure a media pipeline, so users
have to understand how to use media-ctl to configure the pipeline manually.
Are we really expecting users to write scripts to do this, and understand
all these nuances?

IMHO, this is completely crazy, and hasn't been fully thought out.

> > $ strace media-ctl -d /dev/media1 --set-v4l2 
> > '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616]'
> > ...
> > open("/dev/v4l-subdev16", O_RDWR)   = 3
> > ioctl(3, VIDIOC_SUBDEV_S_FMT, 0xbeb1a254) = 0
>

[PATCH v2] staging:fbtft: Fix some warnings regarding types.

2017-02-21 Thread Anthony Brandon
Running make C=1 M=drivers/staging/fbtft reports warnings about conversion
from __be16 to unsigned short. Change the type of the variables being
assigned into __be16 to remove those warnings.

Signed-off-by: Anthony Brandon 
---
 drivers/staging/fbtft/fb_ra8875.c| 2 +-
 drivers/staging/fbtft/fb_watterott.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/fbtft/fb_ra8875.c 
b/drivers/staging/fbtft/fb_ra8875.c
index 89d36d6..a899614 100644
--- a/drivers/staging/fbtft/fb_ra8875.c
+++ b/drivers/staging/fbtft/fb_ra8875.c
@@ -253,7 +253,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, 
...)
 static int write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len)
 {
u16 *vmem16;
-   u16 *txbuf16 = par->txbuf.buf;
+   __be16 *txbuf16 = par->txbuf.buf;
size_t remain;
size_t to_copy;
size_t tx_array_size;
diff --git a/drivers/staging/fbtft/fb_watterott.c 
b/drivers/staging/fbtft/fb_watterott.c
index 4293045..180e5be 100644
--- a/drivers/staging/fbtft/fb_watterott.c
+++ b/drivers/staging/fbtft/fb_watterott.c
@@ -69,8 +69,8 @@ static int write_vmem(struct fbtft_par *par, size_t offset, 
size_t len)
 {
unsigned int start_line, end_line;
u16 *vmem16 = (u16 *)(par->info->screen_buffer + offset);
-   u16 *pos = par->txbuf.buf + 1;
-   u16 *buf16 = par->txbuf.buf + 10;
+   __be16 *pos = par->txbuf.buf + 1;
+   __be16 *buf16 = par->txbuf.buf + 10;
int i, j;
int ret = 0;
 
@@ -106,7 +106,7 @@ static int write_vmem_8bit(struct fbtft_par *par, size_t 
offset, size_t len)
 {
unsigned int start_line, end_line;
u16 *vmem16 = (u16 *)(par->info->screen_buffer + offset);
-   u16 *pos = par->txbuf.buf + 1;
+   __be16 *pos = par->txbuf.buf + 1;
u8 *buf8 = par->txbuf.buf + 10;
int i, j;
int ret = 0;
-- 
2.7.4

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


Re: [Outreachy kernel] [PATCH v2 3/6] staging: greybus: Remove unnecessary braces

2017-02-21 Thread Johan Hovold
On Tue, Feb 21, 2017 at 02:20:50PM +0100, Julia Lawall wrote:
> 
> 
> On Tue, 21 Feb 2017, simran singhal wrote:
> 
> > This patch removes braces for single statement blocks. The warning
> > was detected using checkpatch.pl.
> > Coccinelle was used to make the change.
> >
> > @@
> > expression e,e1;
> > @@
> > - if (e) {
> > + if (e)
> >   e1;
> > - }
> >
> > Signed-off-by: simran singhal 
> 
> Acked-by: Julia Lawall 

I do not think this patch should be merged.

Note that all of the braces you are removing are for single statements
that span multiple lines, and that is precisely why the braces were
added in the first place. Having braces for such statements often
increase readability even if they are not mandated by the coding
standard.

So I suggest this patch is dropped.

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


[PATCH Speakup v2] return same error value from spk_set_key_info

2017-02-21 Thread Pranay Kr. Srivastava
This patch makes spk_set_key_info return -EINVAL
in case of failure instead of returning 4 different
values for the type of error that occurred.

Print the offending values instead as debug message.

Signed-off-by: Pranay Kr. Srivastava 
---
 drivers/staging/speakup/main.c | 28 
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index c2f70ef..ad95905 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1216,13 +1216,20 @@ int spk_set_key_info(const u_char *key_info, u_char 
*k_buffer)
u_char ch, version, num_keys;
 
version = *cp++;
-   if (version != KEY_MAP_VER)
-   return -1;
+   if (version != KEY_MAP_VER) {
+   pr_debug("version found %d should be %d\n",
+version, KEY_MAP_VER);
+   return -EINVAL;
+   }
num_keys = *cp;
states = (int)cp[1];
key_data_len = (states + 1) * (num_keys + 1);
-   if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(spk_key_buf))
-   return -2;
+   if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(spk_key_buf)) {
+   pr_debug("key_data_len = %d, SHIFT_TBL_SIZE + 4 = %d,\t"
+"sizeof(spk_key_buf) = %lu\n", key_data_len,
+SHIFT_TBL_SIZE + 4, sizeof(spk_key_buf));
+   return -EINVAL;
+   }
memset(k_buffer, 0, SHIFT_TBL_SIZE);
memset(spk_our_keys, 0, sizeof(spk_our_keys));
spk_shift_table = k_buffer;
@@ -1233,14 +1240,19 @@ int spk_set_key_info(const u_char *key_info, u_char 
*k_buffer)
cp1 += 2;   /* now pointing at shift states */
for (i = 1; i <= states; i++) {
ch = *cp1++;
-   if (ch >= SHIFT_TBL_SIZE)
-   return -3;
+   if (ch >= SHIFT_TBL_SIZE) {
+   pr_debug("ch = %d, SHIFT_TBL_SIZE = %d\n", ch,
+SHIFT_TBL_SIZE);
+   return -EINVAL;
+   }
spk_shift_table[ch] = i;
}
keymap_flags = *cp1++;
while ((ch = *cp1)) {
-   if (ch >= MAX_KEY)
-   return -4;
+   if (ch >= MAX_KEY) {
+   pr_debug("ch = %d, MAX_KEY = %d\n", ch, MAX_KEY);
+   return -EINVAL;
+   }
spk_our_keys[ch] = cp1;
cp1 += states + 1;
}
-- 
2.10.2

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


Re: [greybus-dev] [Outreachy kernel] [PATCH v2 3/6] staging: greybus: Remove unnecessary braces

2017-02-21 Thread Alex Elder
On 02/21/2017 07:44 AM, Johan Hovold wrote:
> On Tue, Feb 21, 2017 at 02:20:50PM +0100, Julia Lawall wrote:
>>
>>
>> On Tue, 21 Feb 2017, simran singhal wrote:
>>
>>> This patch removes braces for single statement blocks. The warning
>>> was detected using checkpatch.pl.
>>> Coccinelle was used to make the change.
>>>
>>> @@
>>> expression e,e1;
>>> @@
>>> - if (e) {
>>> + if (e)
>>>   e1;
>>> - }
>>>
>>> Signed-off-by: simran singhal 
>>
>> Acked-by: Julia Lawall 
> 
> I do not think this patch should be merged.
> 
> Note that all of the braces you are removing are for single statements
> that span multiple lines, and that is precisely why the braces were
> added in the first place. Having braces for such statements often
> increase readability even if they are not mandated by the coding
> standard.
> 
> So I suggest this patch is dropped.

I concur.  I think the change was well-intended but I find the
practice Johan describes to improve readability of the code.

-Alex

> 
> Thanks,
> Johan
> ___
> greybus-dev mailing list
> greybus-...@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/greybus-dev
> 

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


Re: [PATCH Speakup v2] return same error value from spk_set_key_info

2017-02-21 Thread Samuel Thibault
Pranay Kr. Srivastava, on mar. 21 févr. 2017 19:14:38 +0530, wrote:
> + if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(spk_key_buf)) {
> + pr_debug("key_data_len = %d, SHIFT_TBL_SIZE + 4 = %d,\t"
> +  "sizeof(spk_key_buf) = %lu\n", key_data_len,
> +  SHIFT_TBL_SIZE + 4, sizeof(spk_key_buf));

Well, that's very technical, and not useful to an actual user :)
Rather print
"too many key infos (%d bytes over %d)",
key_data_len + SHIFT_TBL_SIZE + 4,
sizeof(spk_key_buf)

> + if (ch >= SHIFT_TBL_SIZE) {
> + pr_debug("ch = %d, SHIFT_TBL_SIZE = %d\n", ch,
> +  SHIFT_TBL_SIZE);

similarly, rather
"ch %d is not a valid shift state (maximum %d)", ch, 
SHIFT_TBL_SIZE

> + if (ch >= MAX_KEY) {
> + pr_debug("ch = %d, MAX_KEY = %d\n", ch, MAX_KEY);

and
"ch %d is not a valid keycode (maximum %d)", ch, MAX_KEY

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


[PATCH v2 1/2] staging: ks7010: Unnecessary parentheses are removed and also improved coding style.

2017-02-21 Thread Arushi Singhal
Unnecessary parentheses are removed as reported by checkpatch.pl
to make coder nicer and to improve readability.
Also coding style is improved.For example:-
It's often nicer to read if &(foo[0]) is converted to foo like:
 memcpy(&(ap->bssid[0]), &(ap_info->bssid[0]), ETH_ALEN);
 memcpy(ap->bssid, ap_info->bssid, ETH_ALEN);

Signed-off-by: Arushi Singhal 
---
Changes in v2:
  - Make the commit message more clearer.
  - And correct the error on line number 116
in file drivers/staging/ks7010/ks_hostif.c
 changes:-
 ap = priv->current_ap;
 is changed to
 ap = &priv->current_ap;
---
 drivers/staging/ks7010/ks_hostif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index ba283ab741a7..b643a37fb943 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -113,7 +113,7 @@ int get_current_ap(struct ks_wlan_private *priv, struct 
link_ap_info_t *ap_info)
int rc = 0;
 
DPRINTK(3, "\n");
-   ap = priv->current_ap;
+   ap = &priv->current_ap;
 
if ((priv->connect_status & CONNECT_STATUS_MASK) == DISCONNECT_STATUS) {
memset(ap, 0, sizeof(struct local_ap_t));
-- 
2.11.0

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


[PATCH] remove unnecessary initial allocation of vc

2017-02-21 Thread Pranay Kr. Srivastava
This patch removes the unnecessary allocation of
current foreground vc during initialization.

Also change the prototype of speakup_allocate to take
extra argument of gfp_* flags. Thus not requiring
GFP_ATOMIC during initialization.

Signed-off-by: Pranay Kr. Srivastava 
---
 drivers/staging/speakup/main.c | 19 ---
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index ad95905..4437b39 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1328,14 +1328,14 @@ static int edit_bits(struct vc_data *vc, u_char type, 
u_char ch, u_short key)
 }
 
 /* Allocation concurrency is protected by the console semaphore */
-static int speakup_allocate(struct vc_data *vc)
+static int speakup_allocate(struct vc_data *vc, gfp_t gfp_flags)
 {
int vc_num;
 
vc_num = vc->vc_num;
if (speakup_console[vc_num] == NULL) {
speakup_console[vc_num] = kzalloc(sizeof(*speakup_console[0]),
- GFP_ATOMIC);
+ gfp_flags);
if (speakup_console[vc_num] == NULL)
return -ENOMEM;
speakup_date(vc);
@@ -2258,7 +2258,7 @@ static int vt_notifier_call(struct notifier_block *nb,
switch (code) {
case VT_ALLOCATE:
if (vc->vc_mode == KD_TEXT)
-   speakup_allocate(vc);
+   speakup_allocate(vc, GFP_ATOMIC);
break;
case VT_DEALLOCATE:
speakup_deallocate(vc);
@@ -2318,7 +2318,6 @@ static int __init speakup_init(void)
 {
int i;
long err = 0;
-   struct st_spk_t *first_console;
struct vc_data *vc = vc_cons[fg_console].d;
struct var_t *var;
 
@@ -2343,18 +2342,9 @@ static int __init speakup_init(void)
if (err)
goto error_virtkeyboard;
 
-   first_console = kzalloc(sizeof(*first_console), GFP_KERNEL);
-   if (!first_console) {
-   err = -ENOMEM;
-   goto error_alloc;
-   }
-
-   speakup_console[vc->vc_num] = first_console;
-   speakup_date(vc);
-
for (i = 0; i < MAX_NR_CONSOLES; i++)
if (vc_cons[i].d) {
-   err = speakup_allocate(vc_cons[i].d);
+   err = speakup_allocate(vc_cons[i].d, GFP_KERNEL);
if (err)
goto error_kobjects;
}
@@ -2413,7 +2403,6 @@ static int __init speakup_init(void)
for (i = 0; i < MAX_NR_CONSOLES; i++)
kfree(speakup_console[i]);
 
-error_alloc:
speakup_remove_virtual_keyboard();
 
 error_virtkeyboard:
-- 
2.10.2

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


Re: [Outreachy kernel] [PATCH v2 1/2] staging: ks7010: Unnecessary parentheses are removed and also improved coding style.

2017-02-21 Thread Julia Lawall


On Tue, 21 Feb 2017, Arushi Singhal wrote:

> Unnecessary parentheses are removed as reported by checkpatch.pl
> to make coder nicer and to improve readability.
> Also coding style is improved.For example:-
> It's often nicer to read if &(foo[0]) is converted to foo like:
>  memcpy(&(ap->bssid[0]), &(ap_info->bssid[0]), ETH_ALEN);
>  memcpy(ap->bssid, ap_info->bssid, ETH_ALEN);
>
> Signed-off-by: Arushi Singhal 
> ---
> Changes in v2:
>   - Make the commit message more clearer.
>   - And correct the error on line number 116
> in file drivers/staging/ks7010/ks_hostif.c
>  changes:-
>  ap = priv->current_ap;
>  is changed to
>  ap = &priv->current_ap;

Is this a fix on top of the kernel that Greg has?  Or is it a fix on top
of a patch that you have sent previously?  It should be the former, not
the latter.  If you need to correct something, you send a patch that does
the whole thing, not just the correction.

Among other things, the commit message in this patch has nothing to do
with the change that is actually performed.

Also, the v2 informations says that you are making the commit message
clearer, but it looks the same as the original one (to my recollection).

Finally, the subject line says that this is patch 1/2.  So if you need to
send any correction on it, you need to resend the whole series, not just
the patch that changes.  Greg will only apply a complete series at once.

julia

> ---
>  drivers/staging/ks7010/ks_hostif.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/ks7010/ks_hostif.c 
> b/drivers/staging/ks7010/ks_hostif.c
> index ba283ab741a7..b643a37fb943 100644
> --- a/drivers/staging/ks7010/ks_hostif.c
> +++ b/drivers/staging/ks7010/ks_hostif.c
> @@ -113,7 +113,7 @@ int get_current_ap(struct ks_wlan_private *priv, struct 
> link_ap_info_t *ap_info)
>   int rc = 0;
>
>   DPRINTK(3, "\n");
> - ap = priv->current_ap;
> + ap = &priv->current_ap;
>
>   if ((priv->connect_status & CONNECT_STATUS_MASK) == DISCONNECT_STATUS) {
>   memset(ap, 0, sizeof(struct local_ap_t));
> --
> 2.11.0
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/20170221140046.GA15208%40arushi-HP-Pavilion-Notebook.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] remove unnecessary initial allocation of vc

2017-02-21 Thread Samuel Thibault
Pranay Kr. Srivastava, on mar. 21 févr. 2017 19:33:32 +0530, wrote:
> This patch removes the unnecessary allocation of
> current foreground vc during initialization.
> 
> Also change the prototype of speakup_allocate to take
> extra argument of gfp_* flags. Thus not requiring
> GFP_ATOMIC during initialization.
> 
> Signed-off-by: Pranay Kr. Srivastava 

Reviewed-by: Samuel Thibault 

Just add in the log that it's unnecessary because the for loop below
does the initialization already.

> ---
>  drivers/staging/speakup/main.c | 19 ---
>  1 file changed, 4 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
> index ad95905..4437b39 100644
> --- a/drivers/staging/speakup/main.c
> +++ b/drivers/staging/speakup/main.c
> @@ -1328,14 +1328,14 @@ static int edit_bits(struct vc_data *vc, u_char type, 
> u_char ch, u_short key)
>  }
>  
>  /* Allocation concurrency is protected by the console semaphore */
> -static int speakup_allocate(struct vc_data *vc)
> +static int speakup_allocate(struct vc_data *vc, gfp_t gfp_flags)
>  {
>   int vc_num;
>  
>   vc_num = vc->vc_num;
>   if (speakup_console[vc_num] == NULL) {
>   speakup_console[vc_num] = kzalloc(sizeof(*speakup_console[0]),
> -   GFP_ATOMIC);
> +   gfp_flags);
>   if (speakup_console[vc_num] == NULL)
>   return -ENOMEM;
>   speakup_date(vc);
> @@ -2258,7 +2258,7 @@ static int vt_notifier_call(struct notifier_block *nb,
>   switch (code) {
>   case VT_ALLOCATE:
>   if (vc->vc_mode == KD_TEXT)
> - speakup_allocate(vc);
> + speakup_allocate(vc, GFP_ATOMIC);
>   break;
>   case VT_DEALLOCATE:
>   speakup_deallocate(vc);
> @@ -2318,7 +2318,6 @@ static int __init speakup_init(void)
>  {
>   int i;
>   long err = 0;
> - struct st_spk_t *first_console;
>   struct vc_data *vc = vc_cons[fg_console].d;
>   struct var_t *var;
>  
> @@ -2343,18 +2342,9 @@ static int __init speakup_init(void)
>   if (err)
>   goto error_virtkeyboard;
>  
> - first_console = kzalloc(sizeof(*first_console), GFP_KERNEL);
> - if (!first_console) {
> - err = -ENOMEM;
> - goto error_alloc;
> - }
> -
> - speakup_console[vc->vc_num] = first_console;
> - speakup_date(vc);
> -
>   for (i = 0; i < MAX_NR_CONSOLES; i++)
>   if (vc_cons[i].d) {
> - err = speakup_allocate(vc_cons[i].d);
> + err = speakup_allocate(vc_cons[i].d, GFP_KERNEL);
>   if (err)
>   goto error_kobjects;
>   }
> @@ -2413,7 +2403,6 @@ static int __init speakup_init(void)
>   for (i = 0; i < MAX_NR_CONSOLES; i++)
>   kfree(speakup_console[i]);
>  
> -error_alloc:
>   speakup_remove_virtual_keyboard();
>  
>  error_virtkeyboard:
> -- 
> 2.10.2
> 

-- 
Samuel
 Battery 1: charging, 90%, charging at zero rate - will never fully charge.
 -+- acpi - et pourtant, ca monte -+-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging/ks7010: formatting updates.

2017-02-21 Thread Matthew Giassa

* Geert Uytterhoeven  [2017-02-21 08:59:18 +0100]:

Hi Geert,


On Tue, Feb 21, 2017 at 5:20 AM, Matthew Giassa  wrote:

Please pardon the earlier e-mail which was missing the changelog text.


This line should be between the "---" and the diffstat below.



Thank you.


Some additional style changes to appease checkpatch.


Which additional style changes?



* Aligning function parameters in the function prototypes.
* Removing "double newlines". where checkpatch warns about them.
* Spaces between macro names, '+', and integer literals.
* Swapped out some line comments with C-style equivalent.
* Removing trailing spaces.



---
 drivers/staging/ks7010/ks_wlan_ioctl.h | 80 +-
 1 file changed, 41 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/ks7010/ks_wlan_ioctl.h 
b/drivers/staging/ks7010/ks_wlan_ioctl.h
index 84554b6..00eec18 100644
--- a/drivers/staging/ks7010/ks_wlan_ioctl.h
+++ b/drivers/staging/ks7010/ks_wlan_ioctl.h



 #include "ks_wlan.h"
 #include 

-int ks_wlan_read_config_file(struct ks_wlan_private *priv);
-int ks_wlan_setup_parameter(struct ks_wlan_private *priv,
-unsigned int commit_flag);
+int ks_wlan_read_config_file(
+   struct ks_wlan_private *priv);
+int ks_wlan_setup_parameter(
+   struct ks_wlan_private *priv,
+   unsigned int commit_flag);


Really?
If checkpatch complained about the above, you should file a bug report
against checkpatch.

Gr{oetje,eeting}s,


It seems to be a very deliberate message from checkpatch, complaining
about the alignment of the beginning of individual function parameters
in the prototype. The only two configurations which appeased it was the
changes I put in above, or a combination of hard-tabs (8-wide, noexpand)
and spaces, which I thought was ugly.

--

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


Re: [PATCH] staging/ks7010: formatting updates.

2017-02-21 Thread Geert Uytterhoeven
Hi Matthew,

On Tue, Feb 21, 2017 at 3:12 PM, Matthew Giassa  wrote:
>>>  drivers/staging/ks7010/ks_wlan_ioctl.h | 80
>>> +-
>>>  1 file changed, 41 insertions(+), 39 deletions(-)
>>>
>>> diff --git a/drivers/staging/ks7010/ks_wlan_ioctl.h
>>> b/drivers/staging/ks7010/ks_wlan_ioctl.h
>>> index 84554b6..00eec18 100644
>>> --- a/drivers/staging/ks7010/ks_wlan_ioctl.h
>>> +++ b/drivers/staging/ks7010/ks_wlan_ioctl.h
>>
>>
>>>  #include "ks_wlan.h"
>>>  #include 
>>>
>>> -int ks_wlan_read_config_file(struct ks_wlan_private *priv);
>>> -int ks_wlan_setup_parameter(struct ks_wlan_private *priv,
>>> -unsigned int commit_flag);
>>> +int ks_wlan_read_config_file(
>>> +   struct ks_wlan_private *priv);
>>> +int ks_wlan_setup_parameter(
>>> +   struct ks_wlan_private *priv,
>>> +   unsigned int commit_flag);
>>
>>
>> Really?
>> If checkpatch complained about the above, you should file a bug report
>> against checkpatch.
>
> It seems to be a very deliberate message from checkpatch, complaining
> about the alignment of the beginning of individual function parameters
> in the prototype. The only two configurations which appeased it was the
> changes I put in above, or a combination of hard-tabs (8-wide, noexpand)
> and spaces, which I thought was ugly.

The first declaration fit nicely on a single line.
The second one indeed has a few spaces instead of TABs in the
continuation line. But that can be fixed easily, without moving the
first parameter to a continuation line.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtl8188eu: Fixed "Missing a blank line after declarations".

2017-02-21 Thread Yamanappagouda Patil
Fixed checkpatch.pl "missing a blank line after declarations" waring
messages from rtl8188eu module.

Signed-off-by: Yamanappagouda Patil 
---
 drivers/staging/rtl8188eu/hal/odm.c   |  3 +++
 drivers/staging/rtl8188eu/hal/odm_RTL8188E.c  |  1 +
 drivers/staging/rtl8188eu/hal/phy.c   |  1 +
 drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c  |  1 +
 drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c |  1 +
 drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c|  1 +
 drivers/staging/rtl8188eu/hal/usb_halinit.c   | 14 ++
 7 files changed, 22 insertions(+)

diff --git a/drivers/staging/rtl8188eu/hal/odm.c 
b/drivers/staging/rtl8188eu/hal/odm.c
index 16476e7..ec8aae7 100644
--- a/drivers/staging/rtl8188eu/hal/odm.c
+++ b/drivers/staging/rtl8188eu/hal/odm.c
@@ -832,6 +832,7 @@ void odm_RefreshRateAdaptiveMaskCE(struct odm_dm_struct 
*pDM_Odm)
 
for (i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) {
struct sta_info *pstat = pDM_Odm->pODM_StaInfo[i];
+
if (IS_STA_VALID(pstat)) {
if (ODM_RAStateCheck(pDM_Odm, 
pstat->rssi_stat.UndecoratedSmoothedPWDB, false, &pstat->rssi_level)) {
ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, 
ODM_DBG_LOUD,
@@ -896,6 +897,7 @@ void odm_DynamicTxPowerInit(struct odm_dm_struct *pDM_Odm)
 {
struct adapter *Adapter = pDM_Odm->Adapter;
struct dm_priv  *pdmpriv = &Adapter->HalData->dmpriv;
+
pdmpriv->bDynamicTxPowerEnable = false;
pdmpriv->LastDTPLvl = TxHighPwrLevel_Normal;
pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal;
@@ -1052,6 +1054,7 @@ void odm_HwAntDiv(struct odm_dm_struct *pDM_Odm)
 void ODM_EdcaTurboInit(struct odm_dm_struct *pDM_Odm)
 {
struct adapter *Adapter = pDM_Odm->Adapter;
+
pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = false;
pDM_Odm->DM_EDCA_Table.bIsCurRDLState = false;
Adapter->recvpriv.bIsAnyNonBEPkts = false;
diff --git a/drivers/staging/rtl8188eu/hal/odm_RTL8188E.c 
b/drivers/staging/rtl8188eu/hal/odm_RTL8188E.c
index dd9b902..55056ff 100644
--- a/drivers/staging/rtl8188eu/hal/odm_RTL8188E.c
+++ b/drivers/staging/rtl8188eu/hal/odm_RTL8188E.c
@@ -248,6 +248,7 @@ void rtl88eu_dm_ant_sel_statistics(struct odm_dm_struct 
*dm_odm,
   u8 antsel_tr_mux, u32 mac_id, u8 rx_pwdb_all)
 {
struct fast_ant_train *dm_fat_tbl = &dm_odm->DM_FatTable;
+
if (dm_odm->AntDivType == CG_TRX_HW_ANTDIV) {
if (antsel_tr_mux == MAIN_ANT_CG_TRX) {
dm_fat_tbl->MainAnt_Sum[mac_id] += rx_pwdb_all;
diff --git a/drivers/staging/rtl8188eu/hal/phy.c 
b/drivers/staging/rtl8188eu/hal/phy.c
index 35c91e0..054f599 100644
--- a/drivers/staging/rtl8188eu/hal/phy.c
+++ b/drivers/staging/rtl8188eu/hal/phy.c
@@ -1005,6 +1005,7 @@ static void phy_iq_calibrate(struct adapter *adapt, s32 
result[][8],
  rFPGA0_XB_RFInterfaceOE, 
rFPGA0_RFMOD};
 
u32 retry_count = 9;
+
if (*(dm_odm->mp_mode) == 1)
retry_count = 9;
else
diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c 
b/drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c
index d0f59b7..9b7ba9b 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c
@@ -210,6 +210,7 @@ void rtl8188e_set_FwMediaStatus_cmd(struct adapter *adapt, 
__le16 mstatus_rpt)
 {
u8 opmode, macid;
u16 mst_rpt = le16_to_cpu(mstatus_rpt);
+
opmode = (u8)mst_rpt;
macid = (u8)(mst_rpt >> 8);
 
diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c 
b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
index 0ce7db7..2cf67f1 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
@@ -70,6 +70,7 @@ s32 iol_execute(struct adapter *padapter, u8 control)
 static s32 iol_InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy)
 {
s32 rst = _SUCCESS;
+
iol_mode_enable(padapter, 1);
usb_write8(padapter, REG_TDECTRL+1, txpktbuf_bndy);
rst = iol_execute(padapter, CMD_INIT_LLT);
diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c 
b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
index 53e312a..c7e1955 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
@@ -347,6 +347,7 @@ static s32 rtw_dump_xframe(struct adapter *adapt, struct 
xmit_frame *pxmitframe)
struct pkt_attrib *pattrib = &pxmitframe->attrib;
struct xmit_priv *pxmitpriv = &adapt->xmitpriv;
struct security_priv *psecuritypriv = &adapt->securitypriv;
+
if ((pxmitframe->frame_tag == DATA_FRAMETAG) &&
(pxmitframe->attrib.ether_type != 0x0806) &&
(pxmitframe->attrib.ether_type != 0x888e) &&
diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c 
b/drivers/staging/rtl8188eu/hal

Re: [PATCH Speakup v2] return same error value from spk_set_key_info

2017-02-21 Thread kbuild test robot
Hi Pranay,

[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.10 next-20170220]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Pranay-Kr-Srivastava/return-same-error-value-from-spk_set_key_info/20170221-224753
config: i386-randconfig-x018-201708 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:13:0,
from drivers/staging/speakup/main.c:21:
   drivers/staging/speakup/main.c: In function 'spk_set_key_info':
>> include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of 
>> type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
#define KERN_SOH "\001"  /* ASCII Start Of Header */
 ^
   include/linux/printk.h:136:11: note: in definition of macro 'no_printk'
   printk(fmt, ##__VA_ARGS__); \
  ^~~
   include/linux/kern_levels.h:14:20: note: in expansion of macro 'KERN_SOH'
#define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
   ^~~~
   include/linux/printk.h:330:12: note: in expansion of macro 'KERN_DEBUG'
 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
   ^~
>> drivers/staging/speakup/main.c:1228:3: note: in expansion of macro 'pr_debug'
  pr_debug("key_data_len = %d, SHIFT_TBL_SIZE + 4 = %d,\t"
  ^~~~

vim +/pr_debug +1228 drivers/staging/speakup/main.c

  1212  {
  1213  int i = 0, states, key_data_len;
  1214  const u_char *cp = key_info;
  1215  u_char *cp1 = k_buffer;
  1216  u_char ch, version, num_keys;
  1217  
  1218  version = *cp++;
  1219  if (version != KEY_MAP_VER) {
  1220  pr_debug("version found %d should be %d\n",
  1221   version, KEY_MAP_VER);
  1222  return -EINVAL;
  1223  }
  1224  num_keys = *cp;
  1225  states = (int)cp[1];
  1226  key_data_len = (states + 1) * (num_keys + 1);
  1227  if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(spk_key_buf)) {
> 1228  pr_debug("key_data_len = %d, SHIFT_TBL_SIZE + 4 = %d,\t"
  1229   "sizeof(spk_key_buf) = %lu\n", key_data_len,
  1230   SHIFT_TBL_SIZE + 4, sizeof(spk_key_buf));
  1231  return -EINVAL;
  1232  }
  1233  memset(k_buffer, 0, SHIFT_TBL_SIZE);
  1234  memset(spk_our_keys, 0, sizeof(spk_our_keys));
  1235  spk_shift_table = k_buffer;
  1236  spk_our_keys[0] = spk_shift_table;

---
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] Staging: board: Fix macro code style error

2017-02-21 Thread Valentin Hübner
On Mon, Feb 20, 2017 at 06:55:06PM +0100, Greg Kroah-Hartman wrote:
> checkpatch is wrong here, you are now adding more lines than you remove:

I see, thank you!

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


Re: [PATCH Speakup v2] return same error value from spk_set_key_info

2017-02-21 Thread kbuild test robot
Hi Pranay,

[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.10 next-20170220]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Pranay-Kr-Srivastava/return-same-error-value-from-spk_set_key_info/20170221-224753
config: i386-randconfig-i1-201708 (attached as .config)
compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/staging/speakup/main.c: In function 'spk_set_key_info':
>> drivers/staging/speakup/main.c:1228:3: warning: format '%lu' expects 
>> argument of type 'long unsigned int', but argument 4 has type 'unsigned int' 
>> [-Wformat=]
  pr_debug("key_data_len = %d, SHIFT_TBL_SIZE + 4 = %d,\t"
  ^

vim +1228 drivers/staging/speakup/main.c

  1212  {
  1213  int i = 0, states, key_data_len;
  1214  const u_char *cp = key_info;
  1215  u_char *cp1 = k_buffer;
  1216  u_char ch, version, num_keys;
  1217  
  1218  version = *cp++;
  1219  if (version != KEY_MAP_VER) {
  1220  pr_debug("version found %d should be %d\n",
  1221   version, KEY_MAP_VER);
  1222  return -EINVAL;
  1223  }
  1224  num_keys = *cp;
  1225  states = (int)cp[1];
  1226  key_data_len = (states + 1) * (num_keys + 1);
  1227  if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(spk_key_buf)) {
> 1228  pr_debug("key_data_len = %d, SHIFT_TBL_SIZE + 4 = %d,\t"
  1229   "sizeof(spk_key_buf) = %lu\n", key_data_len,
  1230   SHIFT_TBL_SIZE + 4, sizeof(spk_key_buf));
  1231  return -EINVAL;
  1232  }
  1233  memset(k_buffer, 0, SHIFT_TBL_SIZE);
  1234  memset(spk_our_keys, 0, sizeof(spk_our_keys));
  1235  spk_shift_table = k_buffer;
  1236  spk_our_keys[0] = spk_shift_table;

---
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 29/36] media: imx: mipi-csi2: enable setting and getting of frame rates

2017-02-21 Thread Sakari Ailus
Hi Russell,

On Tue, Feb 21, 2017 at 01:21:32PM +, Russell King - ARM Linux wrote:
> On Tue, Feb 21, 2017 at 02:37:57PM +0200, Sakari Ailus wrote:
> > Hi Russell,
> > 
> > On Tue, Feb 21, 2017 at 12:13:32AM +, Russell King - ARM Linux wrote:
> > > On Tue, Feb 21, 2017 at 12:04:10AM +0200, Sakari Ailus wrote:
> > > > On Wed, Feb 15, 2017 at 06:19:31PM -0800, Steve Longerbeam wrote:
> > > > > From: Russell King 
> > > > > 
> > > > > Setting and getting frame rates is part of the negotiation mechanism
> > > > > between subdevs.  The lack of support means that a frame rate at the
> > > > > sensor can't be negotiated through the subdev path.
> > > > 
> > > > Just wondering --- what do you need this for?
> > > 
> > > The v4l2 documentation contradicts the media-ctl implementation.
> > > 
> > > While v4l2 documentation says:
> > > 
> > >   These ioctls are used to get and set the frame interval at specific
> > >   subdev pads in the image pipeline. The frame interval only makes sense
> > >   for sub-devices that can control the frame period on their own. This
> > >   includes, for instance, image sensors and TV tuners. Sub-devices that
> > >   don't support frame intervals must not implement these ioctls.
> > > 
> > > However, when trying to configure the pipeline using media-ctl, eg:
> > > 
> > > media-ctl -d /dev/media1 --set-v4l2 '"imx219 pixel 
> > > 0-0010":0[crop:(0,0)/3264x2464]'
> > > media-ctl -d /dev/media1 --set-v4l2 '"imx219 
> > > 0-0010":1[fmt:SRGGB10/3264x2464@1/30]'
> > > media-ctl -d /dev/media1 --set-v4l2 '"imx219 
> > > 0-0010":0[fmt:SRGGB8/816x616@1/30]'
> > > media-ctl -d /dev/media1 --set-v4l2 
> > > '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616@1/30]'
> > > Unable to setup formats: Inappropriate ioctl for device (25)
> > > media-ctl -d /dev/media1 --set-v4l2 
> > > '"ipu1_csi0_mux":2[fmt:SRGGB8/816x616@1/30]'
> > > media-ctl -d /dev/media1 --set-v4l2 
> > > '"ipu1_csi0":2[fmt:SRGGB8/816x616@1/30]'
> > > 
> > > The problem there is that the format setting for the csi2 does not get
> > > propagated forward:
> > 
> > The CSI-2 receivers typically do not implement frame interval IOCTLs as they
> > do not control the frame interval. Some sensors or TV tuners typically do,
> > so they implement these IOCTLs.
> 
> No, TV tuners do not.  The frame rate for a TV tuner is set by the
> broadcaster, not by the tuner.  The tuner can't change that frame rate.
> The tuner may opt to "skip" fields or frames.  That's no different from
> what the CSI block in my example below is capable of doing.
> 
> Treating a tuner differently from the CSI block is inconsistent and
> completely wrong.

I agree tuners in that sense are somewhat similar, and they are not treated
differently because they are tuners (and not CSI-2 receivers). Neither can
control the frame rate of the incoming video stream.

Conceivably a tuner could implement G_FRAME_INTERVAL IOCTL, but based on a
quick glance none appears to. Neither do CSI-2 receivers. Only sensor
drivers do currently.

> 
> > There are alternative ways to specify the frame rate.
> 
> Empty statements (or hand-waving type statements) I'm afraid don't
> contribute to the discussion, because they mean nothing to me.  Please
> give an example, or flesh out what you mean.

Images are transmitted as series of lines, with each line ending in a
horizontal blanking period, and each frame ending with a similar period of
vertical blanking. The blanking configuration in the units of pixels and
lines at their pixel clock is a native unit which sensors typically use, and
some drivers expose the blanking controls directly to the user.

http://hverkuil.home.xs4all.nl/spec/uapi/v4l/extended-controls.html#image-source-control-ids>

> 
> > > $ strace media-ctl -d /dev/media1 --set-v4l2 
> > > '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616@1/30]'
> > > ...
> > > open("/dev/v4l-subdev16", O_RDWR)   = 3
> > > ioctl(3, VIDIOC_SUBDEV_S_FMT, 0xbec16244) = 0
> > > ioctl(3, VIDIOC_SUBDEV_S_FRAME_INTERVAL, 0xbec162a4) = -1 ENOTTY 
> > > (Inappropriate
> > > ioctl for device)
> > > fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 2), ...}) = 0
> > > write(1, "Unable to setup formats: Inappro"..., 61) = 61
> > > Unable to setup formats: Inappropriate ioctl for device (25)
> > > close(3)= 0
> > > exit_group(1)   = ?
> > > +++ exited with 1 +++
> > > 
> > > because media-ctl exits as soon as it encouters the error while trying
> > > to set the frame rate.
> > > 
> > > This makes implementing setup of the media pipeline in shell scripts
> > > unnecessarily difficult - as you need to then know whether an entity
> > > is likely not to support the VIDIOC_SUBDEV_S_FRAME_INTERVAL call,
> > > and either avoid specifying a frame rate:
> > 
> > You should remove the frame interval setting from sub-devices that do not
> > support it.
> 
> That means we end up with horribly complex scripts.  This "solution" does
> not scale.  Therefore, it is not a "solutio

[PATCH] staging: vc04_services: Fixed 'missing a blank line' warnings.

2017-02-21 Thread Yamanappagouda Patil
Fixed checkpatch.pl "missing a blank line after declarations" warning
messages in vc04_services module.

Signed-off-by: Yamanappagouda Patil 
---
 .../interface/vchiq_arm/vchiq_2835_arm.c   |  3 ++
 .../vc04_services/interface/vchiq_arm/vchiq_arm.c  | 39 +++---
 .../vc04_services/interface/vchiq_arm/vchiq_core.c | 34 ++-
 .../interface/vchiq_arm/vchiq_debugfs.c|  3 ++
 .../interface/vchiq_arm/vchiq_kern_lib.c   |  4 +++
 .../vc04_services/interface/vchiq_arm/vchiq_shim.c | 10 ++
 6 files changed, 88 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index e6241fb..70dcb60 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -202,6 +202,7 @@ VCHIQ_STATUS_T
 vchiq_platform_init_state(VCHIQ_STATE_T *state)
 {
VCHIQ_STATUS_T status = VCHIQ_SUCCESS;
+
state->platform_state = kzalloc(sizeof(VCHIQ_2835_ARM_STATE_T), 
GFP_KERNEL);
((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->inited = 1;
status = vchiq_arm_init_state(state, &((VCHIQ_2835_ARM_STATE_T 
*)state->platform_state)->arm_state);
@@ -287,6 +288,7 @@ vchiq_dump_platform_state(void *dump_context)
 {
char buf[80];
int len;
+
len = snprintf(buf, sizeof(buf),
"  Platform: 2835 (VC master)");
vchiq_dump(dump_context, buf, len + 1);
@@ -585,6 +587,7 @@ free_pagelist(struct vchiq_pagelist_info *pagelistinfo,
(pagelist->type - PAGELIST_READ_WITH_FRAGMENTS) *
g_fragments_size;
int head_bytes, tail_bytes;
+
head_bytes = (g_cache_line_size - pagelist->offset) &
(g_cache_line_size - 1);
tail_bytes = (pagelist->offset + actual) &
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 1dc8627..618cabf 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -209,6 +209,7 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T 
reason,
 {
VCHIQ_COMPLETION_DATA_T *completion;
int insert;
+
DEBUG_INITIALISE(g_state.local)
 
insert = instance->completion_insert;
@@ -280,6 +281,7 @@ service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T 
*header,
VCHIQ_SERVICE_T *service;
VCHIQ_INSTANCE_T instance;
bool skip_completion = false;
+
DEBUG_INITIALISE(g_state.local)
 
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
@@ -315,6 +317,7 @@ service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T 
*header,
if ((user_service->message_available_pos -
instance->completion_remove) < 0) {
VCHIQ_STATUS_T status;
+
vchiq_log_info(vchiq_arm_log_level,
"Inserting extra MESSAGE_AVAILABLE");
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
@@ -519,6 +522,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
VCHIQ_SERVICE_T *service = NULL;
long ret = 0;
int i, rc;
+
DEBUG_INITIALISE(g_state.local)
 
vchiq_log_trace(vchiq_arm_log_level,
@@ -741,6 +745,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
 
case VCHIQ_IOC_QUEUE_MESSAGE: {
VCHIQ_QUEUE_MESSAGE_T args;
+
if (copy_from_user
 (&args, (const void __user *)arg,
  sizeof(args)) != 0) {
@@ -753,6 +758,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
if ((service != NULL) && (args.count <= MAX_ELEMENTS)) {
/* Copy elements into kernel space */
VCHIQ_ELEMENT_T elements[MAX_ELEMENTS];
+
if (copy_from_user(elements, args.elements,
args.count * sizeof(VCHIQ_ELEMENT_T)) == 0)
status = vchiq_ioc_queue_message
@@ -769,6 +775,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
case VCHIQ_IOC_QUEUE_BULK_RECEIVE: {
VCHIQ_QUEUE_BULK_TRANSFER_T args;
struct bulk_waiter_node *waiter = NULL;
+
VCHIQ_BULK_DIR_T dir =
(cmd == VCHIQ_IOC_QUEUE_BULK_TRANSMIT) ?
VCHIQ_BULK_TRANSMIT : VCHIQ_BULK_RECEIVE;
@@ -796,6 +803,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
args.userdata = &waiter->bulk_waiter;
} else if (args.mode == VCHI

Re: [PATCH v4 29/36] media: imx: mipi-csi2: enable setting and getting of frame rates

2017-02-21 Thread Russell King - ARM Linux
On Tue, Feb 21, 2017 at 05:38:34PM +0200, Sakari Ailus wrote:
> Hi Russell,
> 
> On Tue, Feb 21, 2017 at 01:21:32PM +, Russell King - ARM Linux wrote:
> > On Tue, Feb 21, 2017 at 02:37:57PM +0200, Sakari Ailus wrote:
> > > Hi Russell,
> > > 
> > > On Tue, Feb 21, 2017 at 12:13:32AM +, Russell King - ARM Linux wrote:
> > > > On Tue, Feb 21, 2017 at 12:04:10AM +0200, Sakari Ailus wrote:
> > > > > On Wed, Feb 15, 2017 at 06:19:31PM -0800, Steve Longerbeam wrote:
> > > > > > From: Russell King 
> > > > > > 
> > > > > > Setting and getting frame rates is part of the negotiation mechanism
> > > > > > between subdevs.  The lack of support means that a frame rate at the
> > > > > > sensor can't be negotiated through the subdev path.
> > > > > 
> > > > > Just wondering --- what do you need this for?
> > > > 
> > > > The v4l2 documentation contradicts the media-ctl implementation.
> > > > 
> > > > While v4l2 documentation says:
> > > > 
> > > >   These ioctls are used to get and set the frame interval at specific
> > > >   subdev pads in the image pipeline. The frame interval only makes sense
> > > >   for sub-devices that can control the frame period on their own. This
> > > >   includes, for instance, image sensors and TV tuners. Sub-devices that
> > > >   don't support frame intervals must not implement these ioctls.
> > > > 
> > > > However, when trying to configure the pipeline using media-ctl, eg:
> > > > 
> > > > media-ctl -d /dev/media1 --set-v4l2 '"imx219 pixel 
> > > > 0-0010":0[crop:(0,0)/3264x2464]'
> > > > media-ctl -d /dev/media1 --set-v4l2 '"imx219 
> > > > 0-0010":1[fmt:SRGGB10/3264x2464@1/30]'
> > > > media-ctl -d /dev/media1 --set-v4l2 '"imx219 
> > > > 0-0010":0[fmt:SRGGB8/816x616@1/30]'
> > > > media-ctl -d /dev/media1 --set-v4l2 
> > > > '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616@1/30]'
> > > > Unable to setup formats: Inappropriate ioctl for device (25)
> > > > media-ctl -d /dev/media1 --set-v4l2 
> > > > '"ipu1_csi0_mux":2[fmt:SRGGB8/816x616@1/30]'
> > > > media-ctl -d /dev/media1 --set-v4l2 
> > > > '"ipu1_csi0":2[fmt:SRGGB8/816x616@1/30]'
> > > > 
> > > > The problem there is that the format setting for the csi2 does not get
> > > > propagated forward:
> > > 
> > > The CSI-2 receivers typically do not implement frame interval IOCTLs as 
> > > they
> > > do not control the frame interval. Some sensors or TV tuners typically do,
> > > so they implement these IOCTLs.
> > 
> > No, TV tuners do not.  The frame rate for a TV tuner is set by the
> > broadcaster, not by the tuner.  The tuner can't change that frame rate.
> > The tuner may opt to "skip" fields or frames.  That's no different from
> > what the CSI block in my example below is capable of doing.
> > 
> > Treating a tuner differently from the CSI block is inconsistent and
> > completely wrong.
> 
> I agree tuners in that sense are somewhat similar, and they are not treated
> differently because they are tuners (and not CSI-2 receivers). Neither can
> control the frame rate of the incoming video stream.
> 
> Conceivably a tuner could implement G_FRAME_INTERVAL IOCTL, but based on a
> quick glance none appears to. Neither do CSI-2 receivers. Only sensor
> drivers do currently.

Please look again.  I am being very careful with "CSI" vs "CSI-2" in my
emails, you are conflating the two.

In all my emails so far, "CSI" refers to a block of hardware that is
responsible for receiving an image stream from some kind of source.  It
contains hardware that supports frame skipping.

"CSI-2" refers to a different block of hardware that is responsible for
receiving a serially encoded stream from a MIPI-CSI-2 compliant source
and providing it to the "CSI" block.

I would have thought my diagram that I drew would have made it clear that
they were different blocks of hardware, but I guess in this case, the old
saying "a picture is worth 1000 words" is simply not true.

> Images are transmitted as series of lines, with each line ending in a
> horizontal blanking period, and each frame ending with a similar period of

I'm sorry, are you seriously teaching me to suck rocks?  I am insulted.

I've been involved in TV and video for many years, I don't need you to
tell me how video is transmitted.

Sorry, you've just lost my interest in further discussion.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 3/3] staging: comedi: Fix checkpatch MULTILINE_DEREFERENCE

2017-02-21 Thread Ian Abbott

On 21/02/17 11:18, Tobin C. Harding wrote:

Checkpatch emits multiple WARNING: Avoid multiple line dereference.
Removing these warnings will result in line over 80 warnings being
introduced. However,

Documentation/process/coding-style.rst: "Statements longer than 80
columns will be broken into sensible chunks, unless exceeding 80
columns significantly increases readability and does not hide
information"

Exceeding the 80 columns limit helps readabilty when it means we
don't have to break apart dereferences.

Remove line breaks from the middle of struct variable member
dereferences. Introduce new line over 80 checkpatch warnings.

Signed-off-by: Tobin C. Harding 
---
 drivers/staging/comedi/drivers/adl_pci9118.c |  3 +--
 drivers/staging/comedi/drivers/cb_pcidas64.c | 19 ++-
 drivers/staging/comedi/drivers/dt3000.c  |  3 +--
 drivers/staging/comedi/drivers/jr3_pci.c |  3 +--
 drivers/staging/comedi/drivers/ni_atmio.c|  4 ++--
 drivers/staging/comedi/drivers/ni_labpc_common.c |  3 +--
 drivers/staging/comedi/drivers/ni_mio_common.c   |  3 +--
 drivers/staging/comedi/drivers/rtd520.c  |  3 +--
 drivers/staging/comedi/drivers/s626.c| 11 ---
 9 files changed, 18 insertions(+), 34 deletions(-)


This patch ought to be split up by driver.  Also, we're bound to get 
follow-up patches from people due to lines exceeding 80 columns.


--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH V2] staging: vchiq_2835_arm: Make cache-line-size a required DT property

2017-02-21 Thread Stefan Wahren

Am 18.02.2017 um 12:22 schrieb Michael Zoran:

The original github source allowed for the cache-line-size property
to be missing.  Since recent firmwares also require this property,
it makes sense to always require it in the driver as well.

If the cache-line-size property is missing, then the driver probe
should fail as no dev since the kernel and dt may be out of sync.
The fix is to add a check for the return value of of_property_read_u32.

Changes V2:
1. Add error message if cache-line-size is missing.
2. Simple check for non-zero return value from
   of_property_read_u32.

Signed-off-by: Michael Zoran 


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


Re: [PATCH v4 29/36] media: imx: mipi-csi2: enable setting and getting of frame rates

2017-02-21 Thread Sakari Ailus
On Tue, Feb 21, 2017 at 04:03:32PM +, Russell King - ARM Linux wrote:
> On Tue, Feb 21, 2017 at 05:38:34PM +0200, Sakari Ailus wrote:
> > Hi Russell,
> > 
> > On Tue, Feb 21, 2017 at 01:21:32PM +, Russell King - ARM Linux wrote:
> > > On Tue, Feb 21, 2017 at 02:37:57PM +0200, Sakari Ailus wrote:
> > > > Hi Russell,
> > > > 
> > > > On Tue, Feb 21, 2017 at 12:13:32AM +, Russell King - ARM Linux 
> > > > wrote:
> > > > > On Tue, Feb 21, 2017 at 12:04:10AM +0200, Sakari Ailus wrote:
> > > > > > On Wed, Feb 15, 2017 at 06:19:31PM -0800, Steve Longerbeam wrote:
> > > > > > > From: Russell King 
> > > > > > > 
> > > > > > > Setting and getting frame rates is part of the negotiation 
> > > > > > > mechanism
> > > > > > > between subdevs.  The lack of support means that a frame rate at 
> > > > > > > the
> > > > > > > sensor can't be negotiated through the subdev path.
> > > > > > 
> > > > > > Just wondering --- what do you need this for?
> > > > > 
> > > > > The v4l2 documentation contradicts the media-ctl implementation.
> > > > > 
> > > > > While v4l2 documentation says:
> > > > > 
> > > > >   These ioctls are used to get and set the frame interval at specific
> > > > >   subdev pads in the image pipeline. The frame interval only makes 
> > > > > sense
> > > > >   for sub-devices that can control the frame period on their own. This
> > > > >   includes, for instance, image sensors and TV tuners. Sub-devices 
> > > > > that
> > > > >   don't support frame intervals must not implement these ioctls.
> > > > > 
> > > > > However, when trying to configure the pipeline using media-ctl, eg:
> > > > > 
> > > > > media-ctl -d /dev/media1 --set-v4l2 '"imx219 pixel 
> > > > > 0-0010":0[crop:(0,0)/3264x2464]'
> > > > > media-ctl -d /dev/media1 --set-v4l2 '"imx219 
> > > > > 0-0010":1[fmt:SRGGB10/3264x2464@1/30]'
> > > > > media-ctl -d /dev/media1 --set-v4l2 '"imx219 
> > > > > 0-0010":0[fmt:SRGGB8/816x616@1/30]'
> > > > > media-ctl -d /dev/media1 --set-v4l2 
> > > > > '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616@1/30]'
> > > > > Unable to setup formats: Inappropriate ioctl for device (25)
> > > > > media-ctl -d /dev/media1 --set-v4l2 
> > > > > '"ipu1_csi0_mux":2[fmt:SRGGB8/816x616@1/30]'
> > > > > media-ctl -d /dev/media1 --set-v4l2 
> > > > > '"ipu1_csi0":2[fmt:SRGGB8/816x616@1/30]'
> > > > > 
> > > > > The problem there is that the format setting for the csi2 does not get
> > > > > propagated forward:
> > > > 
> > > > The CSI-2 receivers typically do not implement frame interval IOCTLs as 
> > > > they
> > > > do not control the frame interval. Some sensors or TV tuners typically 
> > > > do,
> > > > so they implement these IOCTLs.
> > > 
> > > No, TV tuners do not.  The frame rate for a TV tuner is set by the
> > > broadcaster, not by the tuner.  The tuner can't change that frame rate.
> > > The tuner may opt to "skip" fields or frames.  That's no different from
> > > what the CSI block in my example below is capable of doing.
> > > 
> > > Treating a tuner differently from the CSI block is inconsistent and
> > > completely wrong.
> > 
> > I agree tuners in that sense are somewhat similar, and they are not treated
> > differently because they are tuners (and not CSI-2 receivers). Neither can
> > control the frame rate of the incoming video stream.
> > 
> > Conceivably a tuner could implement G_FRAME_INTERVAL IOCTL, but based on a
> > quick glance none appears to. Neither do CSI-2 receivers. Only sensor
> > drivers do currently.
> 
> Please look again.  I am being very careful with "CSI" vs "CSI-2" in my
> emails, you are conflating the two.
> 
> In all my emails so far, "CSI" refers to a block of hardware that is
> responsible for receiving an image stream from some kind of source.  It
> contains hardware that supports frame skipping.

Ah, I missed the difference. Thanks for pointing it out.

Still, that does not change how the skipping would work nor how I proposed
it would be configured from the user space.

> 
> "CSI-2" refers to a different block of hardware that is responsible for
> receiving a serially encoded stream from a MIPI-CSI-2 compliant source
> and providing it to the "CSI" block.
> 
> I would have thought my diagram that I drew would have made it clear that
> they were different blocks of hardware, but I guess in this case, the old
> saying "a picture is worth 1000 words" is simply not true.
> 
> > Images are transmitted as series of lines, with each line ending in a
> > horizontal blanking period, and each frame ending with a similar period of
> 
> I'm sorry, are you seriously teaching me to suck rocks?  I am insulted.
> 
> I've been involved in TV and video for many years, I don't need you to
> tell me how video is transmitted.
> 
> Sorry, you've just lost my interest in further discussion.

There's no need to feel insulted; that certainly was not the intention.

I've proposed you a solution, please comment on that.

-- 
Regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.

[PATCH 1/1] staging: ks7010: Unnecessary parentheses are removed and also improved coding style.

2017-02-21 Thread Arushi Singhal
Unnecessary parentheses are removed as reported by checkpatch.pl
to make coder nicer and to improve readability.
Also coding style is improved.For example:-
It's often nicer to read if &(foo[0]) is converted to foo like:
 memcpy(&(ap->bssid[0]), &(ap_info->bssid[0]), ETH_ALEN);
 memcpy(ap->bssid, ap_info->bssid, ETH_ALEN);

Signed-off-by: Arushi Singhal 
---
 drivers/staging/ks7010/ks_hostif.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index 1fbd495e5e63..b643a37fb943 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -113,7 +113,7 @@ int get_current_ap(struct ks_wlan_private *priv, struct 
link_ap_info_t *ap_info)
int rc = 0;
 
DPRINTK(3, "\n");
-   ap = &(priv->current_ap);
+   ap = &priv->current_ap;
 
if ((priv->connect_status & CONNECT_STATUS_MASK) == DISCONNECT_STATUS) {
memset(ap, 0, sizeof(struct local_ap_t));
@@ -121,19 +121,19 @@ int get_current_ap(struct ks_wlan_private *priv, struct 
link_ap_info_t *ap_info)
}
 
/* bssid */
-   memcpy(&(ap->bssid[0]), &(ap_info->bssid[0]), ETH_ALEN);
+   memcpy(ap->bssid, ap_info->bssid, ETH_ALEN);
/* essid */
-   memcpy(&(ap->ssid.body[0]), &(priv->reg.ssid.body[0]),
+   memcpy(ap->ssid.body, priv->reg.ssid.body,
   priv->reg.ssid.size);
ap->ssid.size = priv->reg.ssid.size;
/* rate_set */
-   memcpy(&(ap->rate_set.body[0]), &(ap_info->rate_set.body[0]),
+   memcpy(ap->rate_set.body, ap_info->rate_set.body,
   ap_info->rate_set.size);
ap->rate_set.size = ap_info->rate_set.size;
if (ap_info->ext_rate_set.size) {
/* rate_set */
-   memcpy(&(ap->rate_set.body[ap->rate_set.size]),
-  &(ap_info->ext_rate_set.body[0]),
+   memcpy(&ap->rate_set.body[ap->rate_set.size],
+  ap_info->ext_rate_set.body,
   ap_info->ext_rate_set.size);
ap->rate_set.size += ap_info->ext_rate_set.size;
}
@@ -153,11 +153,11 @@ int get_current_ap(struct ks_wlan_private *priv, struct 
link_ap_info_t *ap_info)
ap->rsn_ie.id = 0x30;
if (ap_info->rsn.size <= RSN_IE_BODY_MAX) {
ap->rsn_ie.size = ap_info->rsn.size;
-   memcpy(&(ap->rsn_ie.body[0]), &(ap_info->rsn.body[0]),
+   memcpy(ap->rsn_ie.body, ap_info->rsn.body,
   ap_info->rsn.size);
} else {
ap->rsn_ie.size = RSN_IE_BODY_MAX;
-   memcpy(&(ap->rsn_ie.body[0]), &(ap_info->rsn.body[0]),
+   memcpy(ap->rsn_ie.body, ap_info->rsn.body,
   RSN_IE_BODY_MAX);
}
} else if ((ap_info->rsn_mode & RSN_MODE_WPA)
@@ -165,11 +165,11 @@ int get_current_ap(struct ks_wlan_private *priv, struct 
link_ap_info_t *ap_info)
ap->wpa_ie.id = 0xdd;
if (ap_info->rsn.size <= RSN_IE_BODY_MAX) {
ap->wpa_ie.size = ap_info->rsn.size;
-   memcpy(&(ap->wpa_ie.body[0]), &(ap_info->rsn.body[0]),
+   memcpy(ap->wpa_ie.body, ap_info->rsn.body,
   ap_info->rsn.size);
} else {
ap->wpa_ie.size = RSN_IE_BODY_MAX;
-   memcpy(&(ap->wpa_ie.body[0]), &(ap_info->rsn.body[0]),
+   memcpy(ap->wpa_ie.body, ap_info->rsn.body,
   RSN_IE_BODY_MAX);
}
} else {
@@ -212,7 +212,7 @@ int get_ap_information(struct ks_wlan_private *priv, struct 
ap_info_t *ap_info,
memset(ap, 0, sizeof(struct local_ap_t));
 
/* bssid */
-   memcpy(&(ap->bssid[0]), &(ap_info->bssid[0]), ETH_ALEN);
+   memcpy(ap->bssid, ap_info->bssid, ETH_ALEN);
/* rssi */
ap->rssi = ap_info->rssi;
/* sq */
@@ -224,7 +224,7 @@ int get_ap_information(struct ks_wlan_private *priv, struct 
ap_info_t *ap_info,
/* channel */
ap->channel = ap_info->ch_info;
 
-   bp = &(ap_info->body[0]);
+   bp = ap_info->body;
bsize = ap_info->body_size;
offset = 0;
 
-- 
2.11.0

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


Re: [PATCH 2/3] staging: comedi: Remove level of indentation

2017-02-21 Thread Ian Abbott

On 21/02/17 11:18, Tobin C. Harding wrote:

For comedi patches affecting a single driver, we prefer the driver name 
to be mentioned in the patch subject, like...


staging: comedi: cb_pcidas64: blah blah


For loop contains only an if conditional (and body of if conditional).
Conditional can be inverted and the loop continued if the new
conditional is true without modifying the program logic. This allows
one level of indentation to be removed.

Invert conditional and continue loop if new conditional evaluates to
true. Remove one level of indentation from subsequent loop body.

Signed-off-by: Tobin C. Harding 
---
 drivers/staging/comedi/drivers/cb_pcidas64.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
b/drivers/staging/comedi/drivers/cb_pcidas64.c
index cb9c269..352f754 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -1497,16 +1497,16 @@ static int alloc_and_init_dma_members(struct 
comedi_device *dev)
return -ENOMEM;
}
for (i = 0; i < AO_DMA_RING_COUNT; i++) {
-   if (ao_cmd_is_supported(board)) {
-   devpriv->ao_buffer[i] =
-   dma_alloc_coherent(&pcidev->dev,
-  DMA_BUFFER_SIZE,
-  &devpriv->
-  ao_buffer_bus_addr[i],
-  GFP_KERNEL);
-   if (!devpriv->ao_buffer[i])
-   return -ENOMEM;
-   }
+   if (!ao_cmd_is_supported(board))
+   continue;
+   devpriv->ao_buffer[i] =
+   dma_alloc_coherent(&pcidev->dev,
+   DMA_BUFFER_SIZE,
+   &devpriv->
+   ao_buffer_bus_addr[i],
+   GFP_KERNEL);


Since you are unindenting the code, you can reformat those function 
parameters at the same time to fix the multiline dereference.



+   if (!devpriv->ao_buffer[i])
+   return -ENOMEM;
}
/* allocate dma descriptors */
devpriv->ai_dma_desc =




--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: comedi: drivers: comedi_test: Avoid multiple line dereference

2017-02-21 Thread Cheah Kok Cheong
On Tue, Feb 21, 2017 at 11:20:08AM +0100, Valentin Rothberg wrote:
> On Feb 21 '17 10:12, Ian Abbott wrote:
> > On 21/02/2017 09:33, Cheah Kok Cheong wrote:
> > > On Mon, Feb 20, 2017 at 05:36:52PM +, Ian Abbott wrote:
> > > > On 20/02/17 16:02, Cheah Kok Cheong wrote:
> > > > > On Mon, Feb 20, 2017 at 10:03:39AM +, Ian Abbott wrote:
> > > > > > On 20/02/17 08:28, Cheah Kok Cheong wrote:
> > > > > > > Fix checkpatch warning "Avoid multiple line dereference"
> > > > > > > using a local variable to avoid line wrap.
> > > > > > > 
> > > > > > > Signed-off-by: Cheah Kok Cheong 
> > > > > > > ---
> > > > > > > drivers/staging/comedi/drivers/comedi_test.c | 6 ++
> > > > > > > 1 file changed, 2 insertions(+), 4 deletions(-)
> > > > > > > 
> > > > > > > diff --git a/drivers/staging/comedi/drivers/comedi_test.c 
> > > > > > > b/drivers/staging/comedi/drivers/comedi_test.c
> > > > > > > index 2a063f0..fde83e0 100644
> > > > > > > --- a/drivers/staging/comedi/drivers/comedi_test.c
> > > > > > > +++ b/drivers/staging/comedi/drivers/comedi_test.c
> > > > > > > @@ -480,11 +480,9 @@ static void waveform_ao_timer(unsigned long 
> > > > > > > arg)
> > > > > > >   /* output the last scan */
> > > > > > >   for (i = 0; i < cmd->scan_end_arg; i++) {
> > > > > > >   unsigned int chan = 
> > > > > > > CR_CHAN(cmd->chanlist[i]);
> > > > > > > + unsigned short d = 
> > > > > > > devpriv->ao_loopbacks[chan];
> > > > > > > 
> > > > > > > - if (comedi_buf_read_samples(s,
> > > > > > > - &devpriv->
> > > > > > > -  
> > > > > > > ao_loopbacks[chan],
> > > > > > > - 1) == 0) {
> > > > > > > + if (!comedi_buf_read_samples(s, &d, 1)) 
> > > > > > > {
> > > > > > >   /* unexpected underrun! 
> > > > > > > (cancelled?) */
> > > > > > >   async->events |= 
> > > > > > > COMEDI_CB_OVERFLOW;
> > > > > > >   goto underrun;
> > > > > > > 
> > > > > > 
> > > > > > NAK.  This leaves devpriv->ao_loopbacks[chan] unchanged.
> > > > > > 
> > > > > 
> > > > > Thanks for pointing this out. In that case will assigning the 
> > > > > variable to
> > > > > devpriv->ao_loopbacks[chan] be acceptable? Please review below 
> > > > > snippet.
> > > > > 
> > > > > Otherwise I'll just drop the variable and adjust the lines to avoid
> > > > > checkpatch warning.
> > > > > 
> > > > > Sorry for the inconvenience caused.
> > > > > 
> > > > > [ Snip ]
> > > > > 
> > > > >   /* output the last scan */
> > > > >   for (i = 0; i < cmd->scan_end_arg; i++) {
> > > > >   unsigned int chan = 
> > > > > CR_CHAN(cmd->chanlist[i]);
> > > > >   unsigned short data;
> > > > > 
> > > > >   if (!comedi_buf_read_samples(s, &data, 
> > > > > 1)) {
> > > > >   /* unexpected underrun! 
> > > > > (cancelled?) */
> > > > >   async->events |= 
> > > > > COMEDI_CB_OVERFLOW;
> > > > >   goto underrun;
> > > > >   }
> > > > > 
> > > > >   devpriv->ao_loopbacks[chan] = data;
> > > > >   }
> > > > >   /* advance time of last scan */
> > > > > 
> > > > > [ Snip ]
> > > > 
> > > > It will work, but you could just use a pointer variable set to
> > > > &devpriv->ao_loopbacks[chan] and pass that to comedi_buf_read_samples().
> > > > 
> > > 
> > > Thanks for the suggestion. I tried below snippet 1 with the shortest 
> > > pointer
> > > name but 80 characters is exceeded. The declaration and initialisation
> > > will have to be splitted. Will this be acceptable or am I doing it wrong
> > > again?
> > > 
> > > Sorry for the trouble.
> > > 
> > > Snippet 1:
> > > [ Snip ]
> > > 
> > >   /* output the last scan */
> > >   for (i = 0; i < cmd->scan_end_arg; i++) {
> > >   unsigned int chan = CR_CHAN(cmd->chanlist[i]);
> > >   unsigned short *p = 
> > > &devpriv->ao_loopbacks[chan];
> > > 
> > >   if (!comedi_buf_read_samples(s, p, 1)) {
> > >   /* unexpected underrun! (cancelled?) */
> > >   async->events |= COMEDI_CB_OVERFLOW;
> > >   goto underrun;
> > >   }
> > >   }
> > >   /* advance time of last scan */
> > > 
> > > [ Snip ]
> > > 
> > > Snippet 2:
> > > [ Snip ]
> > > 
> > >   /* output the last scan */
> > >  

[PATCH 2/2] staging: ks7010: Unnecessary parentheses are removed and also improved coding style.

2017-02-21 Thread Arushi Singhal
Unnecessary parentheses are removed as reported by checkpatch.pl
to make coder nicer and to improve readability.
Also coding style is improved.For example:-
It's often nicer to read if &(foo[0]) is converted to foo like:
 memcpy(&(ap->bssid[0]), &(ap_info->bssid[0]), ETH_ALEN);
 memcpy(ap->bssid, ap_info->bssid, ETH_ALEN);

Signed-off-by: Arushi Singhal 
---
 drivers/staging/ks7010/ks_hostif.c   | 20 ++--
 drivers/staging/ks7010/ks_wlan_net.c | 20 ++--
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index b643a37fb943..6e36aa2aea99 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -239,19 +239,19 @@ int get_ap_information(struct ks_wlan_private *priv, 
struct ap_info_t *ap_info,
*(bp + 1));
ap->ssid.size = SSID_MAX_SIZE;
}
-   memcpy(&(ap->ssid.body[0]), bp + 2, ap->ssid.size);
+   memcpy(ap->ssid.body, bp + 2, ap->ssid.size);
break;
case 1: /* rate */
case 50:/* ext rate */
if ((*(bp + 1) + ap->rate_set.size) <=
RATE_SET_MAX_SIZE) {
-   memcpy(&(ap->rate_set.body[ap->rate_set.size]),
+   memcpy(&ap->rate_set.body[ap->rate_set.size],
   bp + 2, *(bp + 1));
ap->rate_set.size += *(bp + 1);
} else {
DPRINTK(1, "size over :: rate size=%d\n",
(*(bp + 1) + ap->rate_set.size));
-   memcpy(&(ap->rate_set.body[ap->rate_set.size]),
+   memcpy(&ap->rate_set.body[ap->rate_set.size],
   bp + 2,
   RATE_SET_MAX_SIZE - ap->rate_set.size);
ap->rate_set.size +=
@@ -269,7 +269,7 @@ int get_ap_information(struct ks_wlan_private *priv, struct 
ap_info_t *ap_info,
*(bp + 1));
ap->rsn_ie.size = RSN_IE_BODY_MAX;
}
-   memcpy(&(ap->rsn_ie.body[0]), bp + 2, ap->rsn_ie.size);
+   memcpy(ap->rsn_ie.body, bp + 2, ap->rsn_ie.size);
break;
case 221:   /* WPA */
if (!memcmp(bp + 2, "\x00\x50\xf2\x01", 4)) {   /* WPA 
OUI check */
@@ -282,7 +282,7 @@ int get_ap_information(struct ks_wlan_private *priv, struct 
ap_info_t *ap_info,
*(bp + 1));
ap->wpa_ie.size = RSN_IE_BODY_MAX;
}
-   memcpy(&(ap->wpa_ie.body[0]), bp + 2,
+   memcpy(ap->wpa_ie.body, bp + 2,
   ap->wpa_ie.size);
}
break;
@@ -832,8 +832,8 @@ void hostif_scan_indication(struct ks_wlan_private *priv)
if (priv->scan_ind_count != 0) {
for (i = 0; i < priv->aplist.size; i++) {   /* bssid check 
*/
if (!memcmp
-   (&(ap_info->bssid[0]),
-&(priv->aplist.ap[i].bssid[0]), ETH_ALEN)) {
+   (ap_info->bssid,
+&priv->aplist.ap[i].bssid[0], ETH_ALEN)) {
if (ap_info->frame_type ==
FRAME_TYPE_PROBE_RESP)
get_ap_information(priv, ap_info,
@@ -2652,7 +2652,7 @@ int hostif_init(struct ks_wlan_private *priv)
 
priv->aplist.size = 0;
for (i = 0; i < LOCAL_APLIST_MAX; i++)
-   memset(&(priv->aplist.ap[i]), 0, sizeof(struct local_ap_t));
+   memset(&priv->aplist.ap[i], 0, sizeof(struct local_ap_t));
priv->infra_status = 0;
priv->current_rate = 4;
priv->connect_status = DISCONNECT_STATUS;
@@ -2675,12 +2675,12 @@ int hostif_init(struct ks_wlan_private *priv)
INIT_WORK(&priv->ks_wlan_wakeup_task, ks_wlan_hw_wakeup_task);
 
/* WPA */
-   memset(&(priv->wpa), 0, sizeof(priv->wpa));
+   memset(&priv->wpa, 0, sizeof(priv->wpa));
priv->wpa.rsn_enabled = 0;
priv->wpa.mic_failure.failure = 0;
priv->wpa.mic_failure.last_failure_time = 0;
priv->wpa.mic_failure.stop = 0;
-   memset(&(priv->pmklist), 0, sizeof(priv->pmklist));
+   memset(&priv->pmklist, 0, sizeof(priv->pmklist));
INIT_LIST_HEAD(&priv->pmklist.head);
for (i = 0; i < PMK_LIST_MAX; i++)
I

Re: [Outreachy kernel] [PATCH 2/2] staging: ks7010: Unnecessary parentheses are removed and also improved coding style.

2017-02-21 Thread Julia Lawall


On Tue, 21 Feb 2017, Arushi Singhal wrote:

> Unnecessary parentheses are removed as reported by checkpatch.pl
> to make coder nicer and to improve readability.
> Also coding style is improved.For example:-
> It's often nicer to read if &(foo[0]) is converted to foo like:
>  memcpy(&(ap->bssid[0]), &(ap_info->bssid[0]), ETH_ALEN);
>  memcpy(ap->bssid, ap_info->bssid, ETH_ALEN);


Should this be a v2, or some larger number?

julia

>
> Signed-off-by: Arushi Singhal 
> ---
>  drivers/staging/ks7010/ks_hostif.c   | 20 ++--
>  drivers/staging/ks7010/ks_wlan_net.c | 20 ++--
>  2 files changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/staging/ks7010/ks_hostif.c 
> b/drivers/staging/ks7010/ks_hostif.c
> index b643a37fb943..6e36aa2aea99 100644
> --- a/drivers/staging/ks7010/ks_hostif.c
> +++ b/drivers/staging/ks7010/ks_hostif.c
> @@ -239,19 +239,19 @@ int get_ap_information(struct ks_wlan_private *priv, 
> struct ap_info_t *ap_info,
>   *(bp + 1));
>   ap->ssid.size = SSID_MAX_SIZE;
>   }
> - memcpy(&(ap->ssid.body[0]), bp + 2, ap->ssid.size);
> + memcpy(ap->ssid.body, bp + 2, ap->ssid.size);
>   break;
>   case 1: /* rate */
>   case 50:/* ext rate */
>   if ((*(bp + 1) + ap->rate_set.size) <=
>   RATE_SET_MAX_SIZE) {
> - memcpy(&(ap->rate_set.body[ap->rate_set.size]),
> + memcpy(&ap->rate_set.body[ap->rate_set.size],
>  bp + 2, *(bp + 1));
>   ap->rate_set.size += *(bp + 1);
>   } else {
>   DPRINTK(1, "size over :: rate size=%d\n",
>   (*(bp + 1) + ap->rate_set.size));
> - memcpy(&(ap->rate_set.body[ap->rate_set.size]),
> + memcpy(&ap->rate_set.body[ap->rate_set.size],
>  bp + 2,
>  RATE_SET_MAX_SIZE - ap->rate_set.size);
>   ap->rate_set.size +=
> @@ -269,7 +269,7 @@ int get_ap_information(struct ks_wlan_private *priv, 
> struct ap_info_t *ap_info,
>   *(bp + 1));
>   ap->rsn_ie.size = RSN_IE_BODY_MAX;
>   }
> - memcpy(&(ap->rsn_ie.body[0]), bp + 2, ap->rsn_ie.size);
> + memcpy(ap->rsn_ie.body, bp + 2, ap->rsn_ie.size);
>   break;
>   case 221:   /* WPA */
>   if (!memcmp(bp + 2, "\x00\x50\xf2\x01", 4)) {   /* WPA 
> OUI check */
> @@ -282,7 +282,7 @@ int get_ap_information(struct ks_wlan_private *priv, 
> struct ap_info_t *ap_info,
>   *(bp + 1));
>   ap->wpa_ie.size = RSN_IE_BODY_MAX;
>   }
> - memcpy(&(ap->wpa_ie.body[0]), bp + 2,
> + memcpy(ap->wpa_ie.body, bp + 2,
>  ap->wpa_ie.size);
>   }
>   break;
> @@ -832,8 +832,8 @@ void hostif_scan_indication(struct ks_wlan_private *priv)
>   if (priv->scan_ind_count != 0) {
>   for (i = 0; i < priv->aplist.size; i++) {   /* bssid check 
> */
>   if (!memcmp
> - (&(ap_info->bssid[0]),
> -  &(priv->aplist.ap[i].bssid[0]), ETH_ALEN)) {
> + (ap_info->bssid,
> +  &priv->aplist.ap[i].bssid[0], ETH_ALEN)) {
>   if (ap_info->frame_type ==
>   FRAME_TYPE_PROBE_RESP)
>   get_ap_information(priv, ap_info,
> @@ -2652,7 +2652,7 @@ int hostif_init(struct ks_wlan_private *priv)
>
>   priv->aplist.size = 0;
>   for (i = 0; i < LOCAL_APLIST_MAX; i++)
> - memset(&(priv->aplist.ap[i]), 0, sizeof(struct local_ap_t));
> + memset(&priv->aplist.ap[i], 0, sizeof(struct local_ap_t));
>   priv->infra_status = 0;
>   priv->current_rate = 4;
>   priv->connect_status = DISCONNECT_STATUS;
> @@ -2675,12 +2675,12 @@ int hostif_init(struct ks_wlan_private *priv)
>   INIT_WORK(&priv->ks_wlan_wakeup_task, ks_wlan_hw_wakeup_task);
>
>   /* WPA */
> - memset(&(priv->wpa), 0, sizeof(priv->wpa));
> + memset(&priv->wpa, 0, sizeof(priv->wpa));
>   priv->wpa.rsn_enabled = 0;
>   priv->wpa.mic_failure.failure = 0;
>   priv->wpa.mic_failure.last_failure_time = 0;
>   priv->wpa.mic_failure.stop = 0;
> - memset(&(priv->pmklist), 0, sizeof(priv->pmklist));
> +

[PATCH 4/6] staging: Drop useless initialisation

2017-02-21 Thread simran singhal
Removed initialisation of a varible if it is immediately reassigned.

Changes were made using Coccinelle.

@@
type T;
constant C;
expression e;
identifier i;
@@

T i
- = C
;
i = e;

Signed-off-by: simran singhal 
---
 drivers/staging/android/ion/ion_heap.c  | 2 +-
 drivers/staging/gdm724x/gdm_lte.c   | 2 +-
 drivers/staging/gdm724x/gdm_mux.c   | 4 ++--
 drivers/staging/iio/addac/adt7316-i2c.c | 2 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_request.c   | 2 +-
 drivers/staging/lustre/lustre/obdclass/cl_page.c| 2 +-
 drivers/staging/media/s5p-cec/exynos_hdmi_cecctrl.c | 2 +-
 drivers/staging/media/s5p-cec/s5p_cec.c | 2 +-
 drivers/staging/rtl8188eu/core/rtw_ap.c | 4 ++--
 drivers/staging/rtl8188eu/core/rtw_efuse.c  | 2 +-
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c   | 2 +-
 drivers/staging/rtl8188eu/core/rtw_recv.c   | 4 ++--
 drivers/staging/rtl8188eu/core/rtw_sreset.c | 2 +-
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c  | 2 +-
 drivers/staging/rtl8188eu/core/rtw_xmit.c   | 2 +-
 drivers/staging/rtl8188eu/hal/hal_intf.c| 2 +-
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c  | 2 +-
 drivers/staging/rtl8188eu/os_dep/xmit_linux.c   | 2 +-
 drivers/staging/rtl8712/rtl8712_xmit.c  | 2 +-
 drivers/staging/rtl8712/rtl871x_mp.c| 6 +++---
 drivers/staging/rts5208/rtsx_chip.c | 2 +-
 drivers/staging/rts5208/sd.c| 4 ++--
 drivers/staging/sm750fb/ddk750_chip.c   | 2 +-
 drivers/staging/sm750fb/ddk750_power.c  | 2 +-
 drivers/staging/speakup/speakup_ltlk.c  | 2 +-
 drivers/staging/unisys/visorbus/visorchipset.c  | 4 ++--
 drivers/staging/wlan-ng/cfg80211.c  | 2 +-
 drivers/staging/xgifb/XGI_main_26.c | 2 +-
 28 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/android/ion/ion_heap.c 
b/drivers/staging/android/ion/ion_heap.c
index 4e5c0f1..4bd844b 100644
--- a/drivers/staging/android/ion/ion_heap.c
+++ b/drivers/staging/android/ion/ion_heap.c
@@ -270,7 +270,7 @@ static unsigned long ion_heap_shrink_count(struct shrinker 
*shrinker,
 {
struct ion_heap *heap = container_of(shrinker, struct ion_heap,
 shrinker);
-   int total = 0;
+   int total;
 
total = ion_heap_freelist_size(heap) / PAGE_SIZE;
if (heap->ops->shrink)
diff --git a/drivers/staging/gdm724x/gdm_lte.c 
b/drivers/staging/gdm724x/gdm_lte.c
index a182757..e0f0912 100644
--- a/drivers/staging/gdm724x/gdm_lte.c
+++ b/drivers/staging/gdm724x/gdm_lte.c
@@ -353,7 +353,7 @@ static s32 gdm_lte_tx_nic_type(struct net_device *dev, 
struct sk_buff *skb)
struct ipv6hdr *ipv6;
int mac_proto;
void *network_data;
-   u32 nic_type = 0;
+   u32 nic_type;
 
/* NIC TYPE is based on the nic_id of this net_device */
nic_type = 0x0010 | nic->nic_id;
diff --git a/drivers/staging/gdm724x/gdm_mux.c 
b/drivers/staging/gdm724x/gdm_mux.c
index 4009691..aba32e2 100644
--- a/drivers/staging/gdm724x/gdm_mux.c
+++ b/drivers/staging/gdm724x/gdm_mux.c
@@ -62,7 +62,7 @@ static int packet_type_to_index(u16 packetType)
 
 static struct mux_tx *alloc_mux_tx(int len)
 {
-   struct mux_tx *t = NULL;
+   struct mux_tx *t;
 
t = kzalloc(sizeof(*t), GFP_ATOMIC);
if (!t)
@@ -91,7 +91,7 @@ static void free_mux_tx(struct mux_tx *t)
 
 static struct mux_rx *alloc_mux_rx(void)
 {
-   struct mux_rx *r = NULL;
+   struct mux_rx *r;
 
r = kzalloc(sizeof(*r), GFP_KERNEL);
if (!r)
diff --git a/drivers/staging/iio/addac/adt7316-i2c.c 
b/drivers/staging/iio/addac/adt7316-i2c.c
index f66dd3e..af56dba 100644
--- a/drivers/staging/iio/addac/adt7316-i2c.c
+++ b/drivers/staging/iio/addac/adt7316-i2c.c
@@ -41,7 +41,7 @@ static int adt7316_i2c_read(void *client, u8 reg, u8 *data)
 static int adt7316_i2c_write(void *client, u8 reg, u8 data)
 {
struct i2c_client *cl = client;
-   int ret = 0;
+   int ret;
 
ret = i2c_smbus_write_byte_data(cl, reg, data);
if (ret < 0)
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
index c1f8693..9c1b1be 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
@@ -377,7 +377,7 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct 
ptlrpc_request *req,
}
 
if (lvb_len > 0) {
-   int size = 0;
+   int size;
 
size = req_capsule_get_size(&req->rq_pill, &RMF_DLM_LVB,
RCL_SERVER);
diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c 
b/drivers/staging/lustre/lustre/obdclass/cl_page.c
index cd9a40c..fdaebc3 100644
--- a/drivers/staging/lustr

[PATCH] staging: xgifb: correct the multiple line dereference to fix coding stye errors

2017-02-21 Thread Arushi Singhal
Error was reported by checkpatch.pl as
WARNING: Avoid multiple line dereference...
if there is boolean operator then it is fixed by Splitting line at
boolean operator.

Signed-off-by: Arushi Singhal 
---
 drivers/staging/xgifb/XGI_main_26.c | 15 +--
 drivers/staging/xgifb/vb_setmode.c  | 19 +++
 2 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c 
b/drivers/staging/xgifb/XGI_main_26.c
index 6930f7eb741b..4fd9bfafccc5 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -880,28 +880,23 @@ static void XGIfb_post_setmode(struct xgifb_video_info 
*xgifb_info)
if ((filter >= 0) && (filter <= 7)) {
pr_debug("FilterTable[%d]-%d: %*ph\n",
 filter_tb, filter,
-4, XGI_TV_filter[filter_tb].
-  filter[filter]);
+4, 
XGI_TV_filter[filter_tb].filter[filter]);
xgifb_reg_set(
XGIPART2,
0x35,
-   (XGI_TV_filter[filter_tb].
-   filter[filter][0]));
+   
(XGI_TV_filter[filter_tb].filter[filter][0]));
xgifb_reg_set(
XGIPART2,
0x36,
-   (XGI_TV_filter[filter_tb].
-   filter[filter][1]));
+   
(XGI_TV_filter[filter_tb].filter[filter][1]));
xgifb_reg_set(
XGIPART2,
0x37,
-   (XGI_TV_filter[filter_tb].
-   filter[filter][2]));
+   
(XGI_TV_filter[filter_tb].filter[filter][2]));
xgifb_reg_set(
XGIPART2,
0x38,
-   (XGI_TV_filter[filter_tb].
-   filter[filter][3]));
+   
(XGI_TV_filter[filter_tb].filter[filter][3]));
}
}
}
diff --git a/drivers/staging/xgifb/vb_setmode.c 
b/drivers/staging/xgifb/vb_setmode.c
index 7c7c8c8f1df3..00f1ae3adcda 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -221,8 +221,7 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short 
ModeIdIndex,
 
for (; XGI330_RefIndex[RefreshRateTableIndex + (*i)].ModeID ==
   tempbx; (*i)--) {
-   infoflag = XGI330_RefIndex[RefreshRateTableIndex + (*i)].
-   Ext_InfoFlag;
+   infoflag = XGI330_RefIndex[RefreshRateTableIndex + 
(*i)].Ext_InfoFlag;
if (infoflag & tempax)
return 1;
 
@@ -231,8 +230,7 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short 
ModeIdIndex,
}
 
for ((*i) = 0;; (*i)++) {
-   infoflag = XGI330_RefIndex[RefreshRateTableIndex + (*i)].
-   Ext_InfoFlag;
+   infoflag = XGI330_RefIndex[RefreshRateTableIndex + 
(*i)].Ext_InfoFlag;
if (XGI330_RefIndex[RefreshRateTableIndex + (*i)].ModeID
!= tempbx) {
return 0;
@@ -654,8 +652,8 @@ static void XGI_UpdateXG21CRTC(unsigned short ModeNo,
(XGI330_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC ==
  RES640x480x60))
index = 12;
-   else if (ModeNo == 0x2E && (XGI330_RefIndex[RefreshRateTableIndex].
-   Ext_CRT1CRTC == RES640x480x72))
+   else if (ModeNo == 0x2E && 
(XGI330_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC ==
+   RES640x480x72))
index = 13;
else if (ModeNo == 0x2F)
index = 14;
@@ -5092,8 +5090,7 @@ unsigned short XGI_GetRatePtrCRT2(struct 
xgi_hw_device_info *pXGIHWDE,
 
i = 0;
do {
-   if (XGI330_RefIndex[RefreshRateTableIndex + i].
-   ModeID != ModeNo)
+   if (XGI330_RefIndex[RefreshRateTableIndex + i].ModeID != ModeNo)
break;
temp = XGI330_RefIndex[RefreshRateTableIndex + i].Ext_InfoFlag;
temp &= ModeTypeMask;
@@ -5105,8 +5102,7 @@ unsigned short XGI_GetRatePtrCRT2(struct 
xgi_hw_device_info *pXGIHWDE,
} while (index != 0x);
  

[PATCH v2] Staging: comedi: drivers: comedi_test: Avoid multiple line dereference

2017-02-21 Thread Cheah Kok Cheong
Fix checkpatch warning "Avoid multiple line dereference"
using a pointer variable to avoid line wrap.

Signed-off-by: Cheah Kok Cheong 
---

V2:
-Use pointer instead of normal variable - Ian
-Variable is to be used as "write destination" and
 not as "read source" - Ian

 drivers/staging/comedi/drivers/comedi_test.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/comedi_test.c 
b/drivers/staging/comedi/drivers/comedi_test.c
index 2a063f0..ccfd642 100644
--- a/drivers/staging/comedi/drivers/comedi_test.c
+++ b/drivers/staging/comedi/drivers/comedi_test.c
@@ -480,11 +480,11 @@ static void waveform_ao_timer(unsigned long arg)
/* output the last scan */
for (i = 0; i < cmd->scan_end_arg; i++) {
unsigned int chan = CR_CHAN(cmd->chanlist[i]);
+   unsigned short *pd;
 
-   if (comedi_buf_read_samples(s,
-   &devpriv->
-ao_loopbacks[chan],
-   1) == 0) {
+   pd = &devpriv->ao_loopbacks[chan];
+
+   if (!comedi_buf_read_samples(s, pd, 1)) {
/* unexpected underrun! (cancelled?) */
async->events |= COMEDI_CB_OVERFLOW;
goto underrun;
-- 
2.7.4

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


Re: [PATCH] staging/ks7010: formatting updates.

2017-02-21 Thread Matthew Giassa

* Geert Uytterhoeven  [2017-02-21 15:22:10 +0100]:


The first declaration fit nicely on a single line.
The second one indeed has a few spaces instead of TABs in the
continuation line. But that can be fixed easily, without moving the
first parameter to a continuation line.


What would the proposed fix be? A combination of spaces and hard-tabs? I
don't see checkpatch complaining about it, so that could work too.

--
-Matthew Giassa
e:

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


Re: [Outreachy kernel] [PATCH 4/6] staging: Drop useless initialisation

2017-02-21 Thread Julia Lawall


On Tue, 21 Feb 2017, simran singhal wrote:

> Removed initialisation of a varible if it is immediately reassigned.

varible -> variable

>
> Changes were made using Coccinelle.
>
> @@
> type T;
> constant C;
> expression e;
> identifier i;
> @@
>
> T i
> - = C
> ;
> i = e;

This is a big patch, and it affects many different drivers.  It would be
better to cut it up, and send the pieces to the specific maintainers, for
android, gdm724x, iio, etc.

Also, note that the above semantic patch is not completely safe, because
the code could be, eg:

int a = 0;
a = a + 1;

In that case, the initialization of a would be needed.  You should check
each case for this issue.

julia

> Signed-off-by: simran singhal 
> ---
>  drivers/staging/android/ion/ion_heap.c  | 2 +-
>  drivers/staging/gdm724x/gdm_lte.c   | 2 +-
>  drivers/staging/gdm724x/gdm_mux.c   | 4 ++--
>  drivers/staging/iio/addac/adt7316-i2c.c | 2 +-
>  drivers/staging/lustre/lustre/ldlm/ldlm_request.c   | 2 +-
>  drivers/staging/lustre/lustre/obdclass/cl_page.c| 2 +-
>  drivers/staging/media/s5p-cec/exynos_hdmi_cecctrl.c | 2 +-
>  drivers/staging/media/s5p-cec/s5p_cec.c | 2 +-
>  drivers/staging/rtl8188eu/core/rtw_ap.c | 4 ++--
>  drivers/staging/rtl8188eu/core/rtw_efuse.c  | 2 +-
>  drivers/staging/rtl8188eu/core/rtw_mlme_ext.c   | 2 +-
>  drivers/staging/rtl8188eu/core/rtw_recv.c   | 4 ++--
>  drivers/staging/rtl8188eu/core/rtw_sreset.c | 2 +-
>  drivers/staging/rtl8188eu/core/rtw_wlan_util.c  | 2 +-
>  drivers/staging/rtl8188eu/core/rtw_xmit.c   | 2 +-
>  drivers/staging/rtl8188eu/hal/hal_intf.c| 2 +-
>  drivers/staging/rtl8188eu/os_dep/ioctl_linux.c  | 2 +-
>  drivers/staging/rtl8188eu/os_dep/xmit_linux.c   | 2 +-
>  drivers/staging/rtl8712/rtl8712_xmit.c  | 2 +-
>  drivers/staging/rtl8712/rtl871x_mp.c| 6 +++---
>  drivers/staging/rts5208/rtsx_chip.c | 2 +-
>  drivers/staging/rts5208/sd.c| 4 ++--
>  drivers/staging/sm750fb/ddk750_chip.c   | 2 +-
>  drivers/staging/sm750fb/ddk750_power.c  | 2 +-
>  drivers/staging/speakup/speakup_ltlk.c  | 2 +-
>  drivers/staging/unisys/visorbus/visorchipset.c  | 4 ++--
>  drivers/staging/wlan-ng/cfg80211.c  | 2 +-
>  drivers/staging/xgifb/XGI_main_26.c | 2 +-
>  28 files changed, 35 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/staging/android/ion/ion_heap.c 
> b/drivers/staging/android/ion/ion_heap.c
> index 4e5c0f1..4bd844b 100644
> --- a/drivers/staging/android/ion/ion_heap.c
> +++ b/drivers/staging/android/ion/ion_heap.c
> @@ -270,7 +270,7 @@ static unsigned long ion_heap_shrink_count(struct 
> shrinker *shrinker,
>  {
>   struct ion_heap *heap = container_of(shrinker, struct ion_heap,
>shrinker);
> - int total = 0;
> + int total;
>
>   total = ion_heap_freelist_size(heap) / PAGE_SIZE;
>   if (heap->ops->shrink)
> diff --git a/drivers/staging/gdm724x/gdm_lte.c 
> b/drivers/staging/gdm724x/gdm_lte.c
> index a182757..e0f0912 100644
> --- a/drivers/staging/gdm724x/gdm_lte.c
> +++ b/drivers/staging/gdm724x/gdm_lte.c
> @@ -353,7 +353,7 @@ static s32 gdm_lte_tx_nic_type(struct net_device *dev, 
> struct sk_buff *skb)
>   struct ipv6hdr *ipv6;
>   int mac_proto;
>   void *network_data;
> - u32 nic_type = 0;
> + u32 nic_type;
>
>   /* NIC TYPE is based on the nic_id of this net_device */
>   nic_type = 0x0010 | nic->nic_id;
> diff --git a/drivers/staging/gdm724x/gdm_mux.c 
> b/drivers/staging/gdm724x/gdm_mux.c
> index 4009691..aba32e2 100644
> --- a/drivers/staging/gdm724x/gdm_mux.c
> +++ b/drivers/staging/gdm724x/gdm_mux.c
> @@ -62,7 +62,7 @@ static int packet_type_to_index(u16 packetType)
>
>  static struct mux_tx *alloc_mux_tx(int len)
>  {
> - struct mux_tx *t = NULL;
> + struct mux_tx *t;
>
>   t = kzalloc(sizeof(*t), GFP_ATOMIC);
>   if (!t)
> @@ -91,7 +91,7 @@ static void free_mux_tx(struct mux_tx *t)
>
>  static struct mux_rx *alloc_mux_rx(void)
>  {
> - struct mux_rx *r = NULL;
> + struct mux_rx *r;
>
>   r = kzalloc(sizeof(*r), GFP_KERNEL);
>   if (!r)
> diff --git a/drivers/staging/iio/addac/adt7316-i2c.c 
> b/drivers/staging/iio/addac/adt7316-i2c.c
> index f66dd3e..af56dba 100644
> --- a/drivers/staging/iio/addac/adt7316-i2c.c
> +++ b/drivers/staging/iio/addac/adt7316-i2c.c
> @@ -41,7 +41,7 @@ static int adt7316_i2c_read(void *client, u8 reg, u8 *data)
>  static int adt7316_i2c_write(void *client, u8 reg, u8 data)
>  {
>   struct i2c_client *cl = client;
> - int ret = 0;
> + int ret;
>
>   ret = i2c_smbus_write_byte_data(cl, reg, data);
>   if (ret < 0)
> diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c 
> b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
> inde

Re: [Outreachy kernel] [PATCH] staging: xgifb: correct the multiple line dereference to fix coding stye errors

2017-02-21 Thread Julia Lawall


On Tue, 21 Feb 2017, Arushi Singhal wrote:

> Error was reported by checkpatch.pl as
> WARNING: Avoid multiple line dereference...
> if there is boolean operator then it is fixed by Splitting line at
> boolean operator.

This is massively execeeding the 80 character boundary, and not for
something trivial like a string.  Maybe the code can be reorganized in
some other way.

julia

>
> Signed-off-by: Arushi Singhal 
> ---
>  drivers/staging/xgifb/XGI_main_26.c | 15 +--
>  drivers/staging/xgifb/vb_setmode.c  | 19 +++
>  2 files changed, 12 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/staging/xgifb/XGI_main_26.c 
> b/drivers/staging/xgifb/XGI_main_26.c
> index 6930f7eb741b..4fd9bfafccc5 100644
> --- a/drivers/staging/xgifb/XGI_main_26.c
> +++ b/drivers/staging/xgifb/XGI_main_26.c
> @@ -880,28 +880,23 @@ static void XGIfb_post_setmode(struct xgifb_video_info 
> *xgifb_info)
>   if ((filter >= 0) && (filter <= 7)) {
>   pr_debug("FilterTable[%d]-%d: %*ph\n",
>filter_tb, filter,
> -  4, XGI_TV_filter[filter_tb].
> -filter[filter]);
> +  4, 
> XGI_TV_filter[filter_tb].filter[filter]);
>   xgifb_reg_set(
>   XGIPART2,
>   0x35,
> - (XGI_TV_filter[filter_tb].
> - filter[filter][0]));
> + 
> (XGI_TV_filter[filter_tb].filter[filter][0]));
>   xgifb_reg_set(
>   XGIPART2,
>   0x36,
> - (XGI_TV_filter[filter_tb].
> - filter[filter][1]));
> + 
> (XGI_TV_filter[filter_tb].filter[filter][1]));
>   xgifb_reg_set(
>   XGIPART2,
>   0x37,
> - (XGI_TV_filter[filter_tb].
> - filter[filter][2]));
> + 
> (XGI_TV_filter[filter_tb].filter[filter][2]));
>   xgifb_reg_set(
>   XGIPART2,
>   0x38,
> - (XGI_TV_filter[filter_tb].
> - filter[filter][3]));
> + 
> (XGI_TV_filter[filter_tb].filter[filter][3]));
>   }
>   }
>   }
> diff --git a/drivers/staging/xgifb/vb_setmode.c 
> b/drivers/staging/xgifb/vb_setmode.c
> index 7c7c8c8f1df3..00f1ae3adcda 100644
> --- a/drivers/staging/xgifb/vb_setmode.c
> +++ b/drivers/staging/xgifb/vb_setmode.c
> @@ -221,8 +221,7 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short 
> ModeIdIndex,
>
>   for (; XGI330_RefIndex[RefreshRateTableIndex + (*i)].ModeID ==
>  tempbx; (*i)--) {
> - infoflag = XGI330_RefIndex[RefreshRateTableIndex + (*i)].
> - Ext_InfoFlag;
> + infoflag = XGI330_RefIndex[RefreshRateTableIndex + 
> (*i)].Ext_InfoFlag;
>   if (infoflag & tempax)
>   return 1;
>
> @@ -231,8 +230,7 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short 
> ModeIdIndex,
>   }
>
>   for ((*i) = 0;; (*i)++) {
> - infoflag = XGI330_RefIndex[RefreshRateTableIndex + (*i)].
> - Ext_InfoFlag;
> + infoflag = XGI330_RefIndex[RefreshRateTableIndex + 
> (*i)].Ext_InfoFlag;
>   if (XGI330_RefIndex[RefreshRateTableIndex + (*i)].ModeID
>   != tempbx) {
>   return 0;
> @@ -654,8 +652,8 @@ static void XGI_UpdateXG21CRTC(unsigned short ModeNo,
>   (XGI330_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC ==
> RES640x480x60))
>   index = 12;
> - else if (ModeNo == 0x2E && (XGI330_RefIndex[RefreshRateTableIndex].
> - Ext_CRT1CRTC == RES640x480x72))
> + else if (ModeNo == 0x2E && 
> (XGI330_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC ==
> + RES640x480x72))
>   index = 13;
>   else if (ModeNo == 0x2F)
>   index = 14;
> @@ -5092,8 +5090,7 @@ unsigned short XGI_GetRatePtrCRT2(struct 
> xgi_hw_device_info *pXGIHWDE,
>
>   i = 0;
>   do {
> - if (XGI330_RefIndex[RefreshRateTableIndex + i].
> - ModeID != ModeNo)
> + if (XGI330_RefIndex[RefreshRateTableIndex + i].ModeID != Mode

[PATCH 5/6] staging: lustre: Using macro DIV_ROUND_UP

2017-02-21 Thread simran singhal
The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)).
It clarifies the divisor calculations. This occurence was detected using
the coccinelle script:

@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: simran singhal 
---
 drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c |  2 +-
 drivers/staging/lustre/lnet/selftest/conrpc.c   | 11 ---
 drivers/staging/lustre/lustre/ptlrpc/client.c   |  3 +--
 drivers/staging/lustre/lustre/ptlrpc/niobuf.c   |  2 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c |  2 +-
 5 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c 
b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
index 7f761b3..60264ed 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
@@ -2058,7 +2058,7 @@ static int kiblnd_create_tx_pool(struct kib_poolset *ps, 
int size,
tpo->tpo_tx_descs = NULL;
tpo->tpo_tx_pages = NULL;
 
-   npg = (size * IBLND_MSG_SIZE + PAGE_SIZE - 1) / PAGE_SIZE;
+   npg = DIV_ROUND_UP(size * IBLND_MSG_SIZE, PAGE_SIZE);
if (kiblnd_alloc_pages(&tpo->tpo_tx_pages, ps->ps_cpt, npg)) {
CERROR("Can't allocate tx pages: %d\n", npg);
LIBCFS_FREE(tpo, sizeof(*tpo));
diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c 
b/drivers/staging/lustre/lnet/selftest/conrpc.c
index 994422c..afc514b 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -785,8 +785,7 @@ lstcon_bulkrpc_v0_prep(lst_test_bulk_param_t *param,
struct test_bulk_req *brq = &req->tsr_u.bulk_v0;
 
brq->blk_opc = param->blk_opc;
-   brq->blk_npg = (param->blk_size + PAGE_SIZE - 1) /
-   PAGE_SIZE;
+   brq->blk_npg = DIV_ROUND_UP(param->blk_size, PAGE_SIZE);
brq->blk_flags = param->blk_flags;
 
return 0;
@@ -833,11 +832,9 @@ lstcon_testrpc_prep(struct lstcon_node *nd, int transop, 
unsigned int feats,
trq = &(*crpc)->crp_rpc->crpc_reqstmsg.msg_body.tes_reqst;
 
if (transop == LST_TRANS_TSBSRVADD) {
-   int ndist = (sgrp->grp_nnode + test->tes_dist - 1) /
-   test->tes_dist;
-   int nspan = (dgrp->grp_nnode + test->tes_span - 1) /
-   test->tes_span;
-   int nmax = (ndist + nspan - 1) / nspan;
+   int ndist = DIV_ROUND_UP(sgrp->grp_nnode, test->tes_dist);
+   int nspan = DIV_ROUND_UP(dgrp->grp_nnode, test->tes_span);
+   int nmax = DIV_ROUND_UP(ndist, nspan);
 
trq->tsr_ndest = 0;
trq->tsr_loop = nmax * test->tes_dist * test->tes_concur;
diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c 
b/drivers/staging/lustre/lustre/ptlrpc/client.c
index 8047413..0d75fe7 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -3136,8 +3136,7 @@ void ptlrpc_set_bulk_mbits(struct ptlrpc_request *req)
 * that server can infer the number of bulks that were prepared,
 * see LU-1431
 */
-   req->rq_mbits += ((bd->bd_iov_count + LNET_MAX_IOV - 1) /
- LNET_MAX_IOV) - 1;
+   req->rq_mbits += (DIV_ROUND_UP(bd->bd_iov_count, LNET_MAX_IOV)) - 1;
 }
 
 /**
diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c 
b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c
index da1209e..c2461c5 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c
@@ -142,7 +142,7 @@ static int ptlrpc_register_bulk(struct ptlrpc_request *req)
LASSERT(desc->bd_cbid.cbid_fn == client_bulk_callback);
LASSERT(desc->bd_cbid.cbid_arg == desc);
 
-   total_md = (desc->bd_iov_count + LNET_MAX_IOV - 1) / LNET_MAX_IOV;
+   total_md = DIV_ROUND_UP(desc->bd_iov_count, LNET_MAX_IOV);
/* rq_mbits is matchbits of the final bulk */
mbits = req->rq_mbits - total_md + 1;
 
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c 
b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
index 2fe9085..d43680c 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
@@ -272,7 +272,7 @@ static unsigned long enc_pools_shrink_scan(struct shrinker 
*s,
 static inline
 int npages_to_npools(unsigned long npages)
 {
-   return (int)((npages + PAGES_PER_POOL - 1) / PAGES_PER_POOL);
+   return (int)(DIV_ROUND_UP(npages, PAGES_PER_POOL));
 }
 
 /*
-- 
2.7.4

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


[PATCH 01/12] staging: unisys: visorbus: Move kernel-doc comment to proper location

2017-02-21 Thread David Kershner
From: David Binder 

Moves kernel-doc comment in front of the function it describes.

Signed-off-by: David Binder 
Signed-off-by: David Kershner 
Reviewed-by: Tim Sell 
---
 drivers/staging/unisys/visorbus/visorchannel.c | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchannel.c 
b/drivers/staging/unisys/visorbus/visorchannel.c
index e91febc..ea4cb09 100644
--- a/drivers/staging/unisys/visorbus/visorchannel.c
+++ b/drivers/staging/unisys/visorbus/visorchannel.c
@@ -286,16 +286,6 @@ visorchannel_signalremove(struct visorchannel *channel, 
u32 queue, void *msg)
 }
 EXPORT_SYMBOL_GPL(visorchannel_signalremove);
 
-/**
- * visorchannel_signalempty() - checks if the designated channel/queue
- *  contains any messages
- * @channel: the channel to query
- * @queue:   the queue in the channel to query
- *
- * Return: boolean indicating whether any messages in the designated
- * channel/queue are present
- */
-
 static bool
 queue_empty(struct visorchannel *channel, u32 queue)
 {
@@ -307,6 +297,15 @@ queue_empty(struct visorchannel *channel, u32 queue)
return (sig_hdr.head == sig_hdr.tail);
 }
 
+/**
+ * visorchannel_signalempty() - checks if the designated channel/queue
+ *  contains any messages
+ * @channel: the channel to query
+ * @queue:   the queue in the channel to query
+ *
+ * Return: boolean indicating whether any messages in the designated
+ * channel/queue are present
+ */
 bool
 visorchannel_signalempty(struct visorchannel *channel, u32 queue)
 {
-- 
git-series 0.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 00/12] staging: unisys: remove platform device and use acpi device.

2017-02-21 Thread David Kershner
The visorchipset device is not really a platform device but an acpi device.
This patch series removes the creation of the platform device and uses the
acpi device as needed.

This series also cleans up some misused kernel-doc comments.

David Binder (9):
  staging: unisys: visorbus: Move kernel-doc comment to proper location
  staging: unisys: visorbus: Fix spelling mistake
  staging: unisys: visorhba: Make miscellaneous comment corrections
  staging: unisys: visorbus: visorchannel.c: Remove kernel-doc comment
  staging: unisys: visorbus: visorbus_main.c: Remove kernel-doc comments
  staging: unisys: visorbus: visorchipset.c: Remove kernel-doc comments
  staging: unisys: visorbus: vbuschannel.h: Remove kernel-doc comment
  staging: unisys: visornic: visornic_main.c: Remove kernel-doc comments
  staging: unisys: visorhba: visorhba_main.c: Remove kernel-doc comments

Sameer Wadgaonkar (3):
  staging: unisys: visorbus: added struct visorchipset_device
  staging: unisys: visorbus: remove character device interface
  staging: unisys: visorbus: remove visorchipset_platform_device

 drivers/staging/unisys/visorbus/vbuschannel.h   |   2 +-
 drivers/staging/unisys/visorbus/visorbus_main.c |  42 +-
 drivers/staging/unisys/visorbus/visorchannel.c  |  21 +-
 drivers/staging/unisys/visorbus/visorchipset.c  | 393 +
 drivers/staging/unisys/visorhba/visorhba_main.c |  71 +--
 drivers/staging/unisys/visornic/visornic_main.c |  70 +--
 6 files changed, 229 insertions(+), 370 deletions(-)

base-commit: 0a441275018b69deffd35bc22a84fd51c54d7d85
-- 
git-series 0.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 08/12] staging: unisys: visornic: visornic_main.c: Remove kernel-doc comments

2017-02-21 Thread David Kershner
From: David Binder 

Removes kernel-doc formatting for comments that precede static functions.

Signed-off-by: David Binder 
Signed-off-by: David Kershner 
Reviewed-by: Tim Sell 
---
 drivers/staging/unisys/visornic/visornic_main.c | 70 +-
 1 file changed, 35 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c 
b/drivers/staging/unisys/visornic/visornic_main.c
index d8f5eca..7583582 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -141,7 +141,7 @@ struct visornic_devdata {
struct uiscmdrsp cmdrsp[SIZEOF_CMDRSP];
 };
 
-/**
+/*
  * visor_copy_fragsinfo_from_skb(
  * @skb_in: skbuff that we are pulling the frags from
  * @firstfraglen: length of first fragment in skb
@@ -250,7 +250,7 @@ static const struct file_operations 
debugfs_enable_ints_fops = {
.write = enable_ints_write,
 };
 
-/**
+/*
  * visornic_serverdown_complete - IOPART went down, pause device
  * @work: Work queue it was scheduled on
  *
@@ -285,7 +285,7 @@ visornic_serverdown_complete(struct visornic_devdata 
*devdata)
devdata->server_down_complete_func = NULL;
 }
 
-/**
+/*
  * visornic_serverdown - Command has notified us that IOPART is down
  * @devdata: device that is being managed by IOPART
  *
@@ -332,7 +332,7 @@ visornic_serverdown(struct visornic_devdata *devdata,
return err;
 }
 
-/**
+/*
  * alloc_rcv_buf   - alloc rcv buffer to be given to the IO Partition.
  * @netdev: network adapter the rcv bufs are attached too.
  *
@@ -363,7 +363,7 @@ alloc_rcv_buf(struct net_device *netdev)
return skb;
 }
 
-/**
+/*
  * post_skb- post a skb to the IO Partition.
  * @cmdrsp: cmdrsp packet to be send to the IO Partition
  * @devdata: visornic_devdata to post the skb too
@@ -397,7 +397,7 @@ post_skb(struct uiscmdrsp *cmdrsp,
}
 }
 
-/**
+/*
  * send_enbdis - send NET_RCV_ENBDIS to IO Partition
  * @netdev: netdevice we are enable/disable, used as context
  *  return value
@@ -421,7 +421,7 @@ send_enbdis(struct net_device *netdev, int state,
devdata->chstat.sent_enbdis++;
 }
 
-/**
+/*
  * visornic_disable_with_timeout - Disable network adapter
  * @netdev: netdevice to disable
  * @timeout: timeout to wait for disable
@@ -507,7 +507,7 @@ visornic_disable_with_timeout(struct net_device *netdev, 
const int timeout)
return 0;
 }
 
-/**
+/*
  * init_rcv_bufs  -- initialize receive bufs and send them to the IO Part
  * @netdev: struct netdevice
  * @devdata: visornic_devdata
@@ -554,7 +554,7 @@ init_rcv_bufs(struct net_device *netdev, struct 
visornic_devdata *devdata)
return 0;
 }
 
-/**
+/*
  * visornic_enable_with_timeout- send enable to IO Part
  * @netdev: struct net_device
  * @timeout: Time to wait for the ACK from the enable
@@ -626,7 +626,7 @@ visornic_enable_with_timeout(struct net_device *netdev, 
const int timeout)
return 0;
 }
 
-/**
+/*
  * visornic_timeout_reset  - handle xmit timeout resets
  * @work   work item that scheduled the work
  *
@@ -669,7 +669,7 @@ visornic_timeout_reset(struct work_struct *work)
rtnl_unlock();
 }
 
-/**
+/*
  * visornic_open - Enable the visornic device and mark the queue started
  * @netdev: netdevice to start
  *
@@ -684,7 +684,7 @@ visornic_open(struct net_device *netdev)
return 0;
 }
 
-/**
+/*
  * visornic_close - Disables the visornic device and stops the queues
  * @netdev: netdevice to start
  *
@@ -699,7 +699,7 @@ visornic_close(struct net_device *netdev)
return 0;
 }
 
-/**
+/*
  * devdata_xmits_outstanding - compute outstanding xmits
  * @devdata: visornic_devdata for device
  *
@@ -714,7 +714,7 @@ static unsigned long devdata_xmits_outstanding(struct 
visornic_devdata *devdata)
+ devdata->chstat.sent_xmit + 1);
 }
 
-/**
+/*
  * vnic_hit_high_watermark
  * @devdata: indicates visornic device we are checking
  * @high_watermark: max num of unacked xmits we will tolerate,
@@ -729,7 +729,7 @@ static inline bool vnic_hit_high_watermark(struct 
visornic_devdata *devdata,
return (devdata_xmits_outstanding(devdata) >= high_watermark);
 }
 
-/**
+/*
  * vnic_hit_low_watermark
  * @devdata: indicates visornic device we are checking
  * @low_watermark: we will wait until the num of unacked xmits
@@ -745,7 +745,7 @@ static inline bool vnic_hit_low_watermark(struct 
visornic_devdata *devdata,
return (devdata_xmits_outstanding(devdata) <= low_watermark);
 }
 
-/**
+/*
  * visornic_xmit - send a packet to the IO Partition
  * @skb: Packet to be sent
  * @netdev: net device the packet is being sent from
@@ -916,7 +916,7 @@ visornic_xmit(struct sk_buff *skb, struct net_device 
*netdev)
return NETDEV_TX_OK;
 }
 
-/**
+/*
  * visornic_get_stats - ret

[PATCH 03/12] staging: unisys: visorhba: Make miscellaneous comment corrections

2017-02-21 Thread David Kershner
From: David Binder 

Fixes miscellaneous comment issues in visorhba_main.c.

Signed-off-by: David Binder 
Signed-off-by: David Kershner 
Reviewed-by: Tim Sell 
---
 drivers/staging/unisys/visorhba/visorhba_main.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c 
b/drivers/staging/unisys/visorhba/visorhba_main.c
index 0ce92c8..d1d4007 100644
--- a/drivers/staging/unisys/visorhba/visorhba_main.c
+++ b/drivers/staging/unisys/visorhba/visorhba_main.c
@@ -106,6 +106,7 @@ struct visorhba_devices_open {
if ((iter->channel == match->channel) &&  \
(iter->id == match->id) &&\
(iter->lun == match->lun))
+
 /**
  * visor_thread_start - starts a thread for the device
  * @threadfn: Function the thread starts
@@ -184,7 +185,7 @@ static int add_scsipending_entry(struct visorhba_devdata 
*devdata,
 }
 
 /**
- * del_scsipending_enty - removes an entry from the pending array
+ * del_scsipending_ent - removes an entry from the pending array
  * @devdata: Device holding the pending array
  * @del: Entry to remove
  *
@@ -212,7 +213,7 @@ static void *del_scsipending_ent(struct visorhba_devdata 
*devdata,
 
 /**
  * get_scsipending_cmdrsp - return the cmdrsp stored in a pending entry
- * #ddata: Device holding the pending array
+ * @ddata: Device holding the pending array
  * @ent: Entry that stores the cmdrsp
  *
  * Each scsipending entry has a cmdrsp in it. The cmdrsp is only valid
@@ -1201,7 +1202,7 @@ static int visorhba_init(void)
 }
 
 /**
- * visorhba_cleanup- driver exit routine
+ * visorhba_exit   - driver exit routine
  *
  * Unregister driver from the bus and free up memory.
  */
-- 
git-series 0.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 04/12] staging: unisys: visorbus: visorchannel.c: Remove kernel-doc comment

2017-02-21 Thread David Kershner
From: David Binder 

Removes kernel-doc formatting for comment that precedes a static function.

Signed-off-by: David Binder 
Signed-off-by: David Kershner 
Reviewed-by: Tim Sell 
---
 drivers/staging/unisys/visorbus/visorchannel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/visorbus/visorchannel.c 
b/drivers/staging/unisys/visorbus/visorchannel.c
index ea4cb09..1e3dc58 100644
--- a/drivers/staging/unisys/visorbus/visorchannel.c
+++ b/drivers/staging/unisys/visorbus/visorchannel.c
@@ -367,7 +367,7 @@ signalinsert_inner(struct visorchannel *channel, u32 queue, 
void *msg)
return 0;
 }
 
-/**
+/*
  * visorchannel_create_guts() - creates the struct visorchannel abstraction
  *  for a data area in memory, but does NOT modify
  *  this data area
-- 
git-series 0.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 02/12] staging: unisys: visorbus: Fix spelling mistake

2017-02-21 Thread David Kershner
From: David Binder 

Fixes a minor spelling mistake in a function comment.

Signed-off-by: David Binder 
Signed-off-by: David Kershner 
Reviewed-by: Tim Sell 
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index 55f29ae..b36452f 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -143,9 +143,9 @@ struct bus_type visorbus_type = {
 };
 
 /**
- * visorbus_releae_busdevice() - called when device_unregister() is called for
- *   the bus device instance, after all other tasks
- *   involved with destroying the dev are complete
+ * visorbus_release_busdevice() - called when device_unregister() is called for
+ *the bus device instance, after all other 
tasks
+ *involved with destroying the dev are complete
  * @xdev: struct device for the bus being released
  */
 static void
-- 
git-series 0.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 06/12] staging: unisys: visorbus: visorchipset.c: Remove kernel-doc comments

2017-02-21 Thread David Kershner
From: David Binder 

Removes kernel-doc formatting for comments that precede static functions.

Reported-by: Greg Kroah-Hartman 
Signed-off-by: David Binder 
Signed-off-by: David Kershner 
Reviewed-by: Tim Sell 
---
 drivers/staging/unisys/visorbus/visorchipset.c | 24 +--
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index 97778d7..74c41fc 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -1004,7 +1004,7 @@ my_device_destroy(struct controlvm_message *inmsg)
 
 #define PARAHOTPLUG_TIMEOUT_MS 2000
 
-/**
+/*
  * parahotplug_next_id() - generate unique int to match an outstanding
  * CONTROLVM message with a udev script /sys
  * response
@@ -1019,7 +1019,7 @@ parahotplug_next_id(void)
return atomic_inc_return(&id);
 }
 
-/**
+/*
  * parahotplug_next_expiration() - returns the time (in jiffies) when a
  * CONTROLVM message on the list should expire
  * -- PARAHOTPLUG_TIMEOUT_MS in the future
@@ -1032,7 +1032,7 @@ parahotplug_next_expiration(void)
return jiffies + msecs_to_jiffies(PARAHOTPLUG_TIMEOUT_MS);
 }
 
-/**
+/*
  * parahotplug_request_create() - create a parahotplug_request, which is
  *basically a wrapper for a CONTROLVM_MESSAGE
  *that we can stick on a list
@@ -1056,7 +1056,7 @@ parahotplug_request_create(struct controlvm_message *msg)
return req;
 }
 
-/**
+/*
  * parahotplug_request_destroy() - free a parahotplug_request
  * @req: the request to deallocate
  */
@@ -1069,7 +1069,7 @@ parahotplug_request_destroy(struct parahotplug_request 
*req)
 static LIST_HEAD(parahotplug_request_list);
 static DEFINE_SPINLOCK(parahotplug_request_list_lock); /* lock for above */
 
-/**
+/*
  * parahotplug_request_complete() - mark request as complete
  * @id: the id of the request
  * @active: indicates whether the request is assigned to active partition
@@ -1113,7 +1113,7 @@ parahotplug_request_complete(int id, u16 active)
return -EINVAL;
 }
 
-/**
+/*
  * devicedisabled_store() - disables the hotplug device
  * @dev:   sysfs interface variable not utilized in this function
  * @attr:  sysfs interface variable not utilized in this function
@@ -1143,7 +1143,7 @@ static ssize_t devicedisabled_store(struct device *dev,
 }
 static DEVICE_ATTR_WO(devicedisabled);
 
-/**
+/*
  * deviceenabled_store() - enables the hotplug device
  * @dev:   sysfs interface variable not utilized in this function
  * @attr:  sysfs interface variable not utilized in this function
@@ -1213,7 +1213,7 @@ static struct platform_device 
visorchipset_platform_device = {
.dev.release = visorchipset_dev_release,
 };
 
-/**
+/*
  * parahotplug_request_kickoff() - initiate parahotplug request
  * @req: the request to initiate
  *
@@ -1245,7 +1245,7 @@ parahotplug_request_kickoff(struct parahotplug_request 
*req)
   envp);
 }
 
-/**
+/*
  * parahotplug_process_message() - enables or disables a PCI device by kicking
  * off a udev script
  * @inmsg: the message indicating whether to enable or disable
@@ -1719,7 +1719,7 @@ parser_init_byte_stream(u64 addr, u32 bytes, bool local, 
bool *retry)
return NULL;
 }
 
-/**
+/*
  * handle_command() - process a controlvm message
  * @inmsg:the message to process
  * @channel_addr: address of the controlvm channel
@@ -1833,7 +1833,7 @@ handle_command(struct controlvm_message inmsg, u64 
channel_addr)
return true;
 }
 
-/**
+/*
  * read_controlvm_event() - retreives the next message from the
  *  CONTROLVM_QUEUE_EVENT queue in the controlvm
  *  channel
@@ -1854,7 +1854,7 @@ read_controlvm_event(struct controlvm_message *msg)
return false;
 }
 
-/**
+/*
  * parahotplug_process_list() - remove any request from the list that's been on
  *  there too long and respond with an error
  */
-- 
git-series 0.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 09/12] staging: unisys: visorhba: visorhba_main.c: Remove kernel-doc comments

2017-02-21 Thread David Kershner
From: David Binder 

Removes kernel-doc formatting for comments that precede static functions.

Signed-off-by: David Binder 
Signed-off-by: David Kershner 
Reviewed-by: Tim Sell 
---
 drivers/staging/unisys/visorhba/visorhba_main.c | 64 +-
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c 
b/drivers/staging/unisys/visorhba/visorhba_main.c
index d1d4007..4018d5a 100644
--- a/drivers/staging/unisys/visorhba/visorhba_main.c
+++ b/drivers/staging/unisys/visorhba/visorhba_main.c
@@ -107,7 +107,7 @@ struct visorhba_devices_open {
(iter->id == match->id) &&\
(iter->lun == match->lun))
 
-/**
+/*
  * visor_thread_start - starts a thread for the device
  * @threadfn: Function the thread starts
  * @thrcontext: Context to pass to the thread, i.e. devdata
@@ -131,7 +131,7 @@ static struct task_struct *visor_thread_start
return task;
 }
 
-/**
+/*
  *  visor_thread_stop - stops the thread if it is running
  */
 static void visor_thread_stop(struct task_struct *task)
@@ -141,7 +141,7 @@ static void visor_thread_stop(struct task_struct *task)
kthread_stop(task);
 }
 
-/**
+/*
  * add_scsipending_entry - save off io command that is pending in
  * Service Partition
  * @devdata: Pointer to devdata
@@ -184,7 +184,7 @@ static int add_scsipending_entry(struct visorhba_devdata 
*devdata,
return insert_location;
 }
 
-/**
+/*
  * del_scsipending_ent - removes an entry from the pending array
  * @devdata: Device holding the pending array
  * @del: Entry to remove
@@ -211,7 +211,7 @@ static void *del_scsipending_ent(struct visorhba_devdata 
*devdata,
return sent;
 }
 
-/**
+/*
  * get_scsipending_cmdrsp - return the cmdrsp stored in a pending entry
  * @ddata: Device holding the pending array
  * @ent: Entry that stores the cmdrsp
@@ -229,7 +229,7 @@ static struct uiscmdrsp *get_scsipending_cmdrsp(struct 
visorhba_devdata *ddata,
return NULL;
 }
 
-/**
+/*
  *  simple_idr_get - associate a provided pointer with an int value
  *   1 <= value <= INT_MAX, and return this int value;
  *   the pointer value can be obtained later by passing
@@ -254,7 +254,7 @@ static unsigned int simple_idr_get(struct idr *idrtable, 
void *p,
return (unsigned int)(id);  /* idr_alloc() guarantees > 0 */
 }
 
-/**
+/*
  *  setup_scsitaskmgmt_handles - stash the necessary handles so that the
  *   completion processing logic for a taskmgmt
  *   cmd will be able to find who to wake up
@@ -272,7 +272,7 @@ static void setup_scsitaskmgmt_handles(struct idr 
*idrtable, spinlock_t *lock,
simple_idr_get(idrtable, result, lock);
 }
 
-/**
+/*
  *  cleanup_scsitaskmgmt_handles - forget handles created by
  * setup_scsitaskmgmt_handles()
  */
@@ -285,7 +285,7 @@ static void cleanup_scsitaskmgmt_handles(struct idr 
*idrtable,
idr_remove(idrtable, cmdrsp->scsitaskmgmt.notifyresult_handle);
 }
 
-/**
+/*
  * forward_taskmgmt_command - send taskmegmt command to the Service
  *Partition
  * @tasktype: Type of taskmgmt command
@@ -364,7 +364,7 @@ static int forward_taskmgmt_command(enum task_mgmt_types 
tasktype,
return FAILED;
 }
 
-/**
+/*
  * visorhba_abort_handler - Send TASK_MGMT_ABORT_TASK
  * @scsicmd: The scsicmd that needs aborted
  *
@@ -389,7 +389,7 @@ static int visorhba_abort_handler(struct scsi_cmnd *scsicmd)
return forward_taskmgmt_command(TASK_MGMT_ABORT_TASK, scsicmd);
 }
 
-/**
+/*
  * visorhba_device_reset_handler - Send TASK_MGMT_LUN_RESET
  * @scsicmd: The scsicmd that needs aborted
  *
@@ -413,7 +413,7 @@ static int visorhba_device_reset_handler(struct scsi_cmnd 
*scsicmd)
return forward_taskmgmt_command(TASK_MGMT_LUN_RESET, scsicmd);
 }
 
-/**
+/*
  * visorhba_bus_reset_handler - Send TASK_MGMT_TARGET_RESET for each
  *  target on the bus
  * @scsicmd: The scsicmd that needs aborted
@@ -437,7 +437,7 @@ static int visorhba_bus_reset_handler(struct scsi_cmnd 
*scsicmd)
return forward_taskmgmt_command(TASK_MGMT_BUS_RESET, scsicmd);
 }
 
-/**
+/*
  * visorhba_host_reset_handler - Not supported
  * @scsicmd: The scsicmd that needs aborted
  *
@@ -451,7 +451,7 @@ visorhba_host_reset_handler(struct scsi_cmnd *scsicmd)
return SUCCESS;
 }
 
-/**
+/*
  * visorhba_get_info
  * @shp: Scsi host that is requesting information
  *
@@ -463,7 +463,7 @@ static const char *visorhba_get_info(struct Scsi_Host *shp)
return "visorhba";
 }
 
-/**
+/*
  * visorhba_queue_command_lck -- queues command to the Service Partition
  * @scsicmd: Command to be queued
  * @

[PATCH 12/12] staging: unisys: visorbus: remove visorchipset_platform_device

2017-02-21 Thread David Kershner
From: Sameer Wadgaonkar 

Removed visorchipset_platform_device and all the unused structures
and functions and using chipset_dev.acpi_device instead.

Reported-by: Greg Kroah-Hartman 
Signed-off-by: Sameer Wadgaonkar 
Signed-off-by: David Kershner 
Reviewed-by: Tim Sell 
---
 drivers/staging/unisys/visorbus/visorchipset.c | 48 +++
 1 file changed, 19 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index c120c46..cce1974 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -1175,18 +1174,6 @@ static const struct attribute_group 
*visorchipset_dev_groups[] = {
NULL
 };
 
-static void visorchipset_dev_release(struct device *dev)
-{
-}
-
-/* /sys/devices/platform/visorchipset */
-static struct platform_device visorchipset_platform_device = {
-   .name = "visorchipset",
-   .id = -1,
-   .dev.groups = visorchipset_dev_groups,
-   .dev.release = visorchipset_dev_release,
-};
-
 /*
  * parahotplug_request_kickoff() - initiate parahotplug request
  * @req: the request to initiate
@@ -1215,7 +1202,7 @@ parahotplug_request_kickoff(struct parahotplug_request 
*req)
sprintf(env_func, "SPAR_PARAHOTPLUG_FUNCTION=%d",
cmd->device_change_state.dev_no & 0x7);
 
-   kobject_uevent_env(&visorchipset_platform_device.dev.kobj, KOBJ_CHANGE,
+   kobject_uevent_env(&chipset_dev->acpi_device->dev.kobj, KOBJ_CHANGE,
   envp);
 }
 
@@ -1277,7 +1264,7 @@ parahotplug_process_message(struct controlvm_message 
*inmsg)
 static int
 chipset_ready_uevent(struct controlvm_message_header *msg_hdr)
 {
-   kobject_uevent(&visorchipset_platform_device.dev.kobj, KOBJ_ONLINE);
+   kobject_uevent(&chipset_dev->acpi_device->dev.kobj, KOBJ_ONLINE);
 
if (msg_hdr->flags.response_expected)
return controlvm_respond(msg_hdr, CONTROLVM_RESP_SUCCESS);
@@ -1299,7 +1286,7 @@ chipset_selftest_uevent(struct controlvm_message_header 
*msg_hdr)
char *envp[] = { env_selftest, NULL };
 
sprintf(env_selftest, "SPARSP_SELFTEST=%d", 1);
-   kobject_uevent_env(&visorchipset_platform_device.dev.kobj, KOBJ_CHANGE,
+   kobject_uevent_env(&chipset_dev->acpi_device->dev.kobj, KOBJ_CHANGE,
   envp);
 
if (msg_hdr->flags.response_expected)
@@ -1318,7 +1305,7 @@ chipset_selftest_uevent(struct controlvm_message_header 
*msg_hdr)
 static int
 chipset_notready_uevent(struct controlvm_message_header *msg_hdr)
 {
-   kobject_uevent(&visorchipset_platform_device.dev.kobj, KOBJ_OFFLINE);
+   kobject_uevent(&chipset_dev->acpi_device->dev.kobj, KOBJ_OFFLINE);
 
if (msg_hdr->flags.response_expected)
return controlvm_respond(msg_hdr, CONTROLVM_RESP_SUCCESS);
@@ -1846,9 +1833,15 @@ visorchipset_init(struct acpi_device *acpi_device)
goto error_free_chipset_dev;
 
chipset_dev->controlvm_channel = controlvm_channel;
+
+   err = sysfs_create_groups(&chipset_dev->acpi_device->dev.kobj,
+ visorchipset_dev_groups);
+   if (err < 0)
+   goto error_destroy_channel;
+
if (!SPAR_CONTROLVM_CHANNEL_OK_CLIENT(
visorchannel_get_header(controlvm_channel)))
-   goto error_destroy_channel;
+   goto error_delete_groups;
 
/* if booting in a crash kernel */
if (is_kdump_kernel())
@@ -1863,26 +1856,21 @@ visorchipset_init(struct acpi_device *acpi_device)
schedule_delayed_work(&chipset_dev->periodic_controlvm_work,
  chipset_dev->poll_jiffies);
 
-   if (platform_device_register(&visorchipset_platform_device) < 0) {
-   POSTCODE_LINUX(DEVICE_REGISTER_FAILURE_PC, 0, 0,
-  DIAG_SEVERITY_ERR);
-   err = -ENODEV;
-   goto error_cancel_work;
-   }
POSTCODE_LINUX(CHIPSET_INIT_SUCCESS_PC, 0, 0, DIAG_SEVERITY_PRINT);
 
err = visorbus_init();
if (err < 0)
-   goto error_unregister;
+   goto error_cancel_work;
 
return 0;
 
-error_unregister:
-   platform_device_unregister(&visorchipset_platform_device);
-
 error_cancel_work:
cancel_delayed_work_sync(&chipset_dev->periodic_controlvm_work);
 
+error_delete_groups:
+   sysfs_remove_groups(&chipset_dev->acpi_device->dev.kobj,
+   visorchipset_dev_groups);
+
 error_destroy_channel:
visorchannel_destroy(chipset_dev->controlvm_channel);
 
@@ -1901,8 +1889,10 @@ visorchipset_exit(struct acpi_device *acpi_device)
 
visorbus_exit();
cancel_delayed_work_sync(&chipset_dev->periodic_controlvm_work);
+   sysfs_remove_groups(&chipset_dev->acpi_device-

[PATCH 10/12] staging: unisys: visorbus: added struct visorchipset_device

2017-02-21 Thread David Kershner
From: Sameer Wadgaonkar 

Added the structure visorchipset_device and moved the globals to
the struct. The visorchipset_init() function saves acpi_device
within this structure.

Reported-by: Greg Kroah-Hartman 
Signed-off-by: Sameer Wadgaonkar 
Signed-off-by: David Kershner 
Reviewed-by: Tim Sell 
---
 drivers/staging/unisys/visorbus/visorchipset.c | 197 ++
 1 file changed, 112 insertions(+), 85 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index 74c41fc..b3c3cdd 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -72,9 +72,6 @@ visorchipset_release(struct inode *inode, struct file *file)
  * message, we switch back to fast polling mode.
  */
 #define MIN_IDLE_SECONDS 10
-static unsigned long poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST;
-/* when we got our last controlvm message */
-static unsigned long most_recent_message_jiffies;
 
 struct parser_context {
unsigned long allocbytes;
@@ -85,22 +82,28 @@ struct parser_context {
char data[0];
 };
 
-static struct delayed_work periodic_controlvm_work;
-
-static struct cdev file_cdev;
-static struct visorchannel **file_controlvm_channel;
-
-static struct visorchannel *controlvm_channel;
-static unsigned long controlvm_payload_bytes_buffered;
+struct visorchipset_device {
+   struct acpi_device *acpi_device;
+   unsigned long poll_jiffies;
+   /* when we got our last controlvm message */
+   unsigned long most_recent_message_jiffies;
+   struct delayed_work periodic_controlvm_work;
+   struct cdev file_cdev;
+   struct visorchannel **file_controlvm_channel;
+   struct visorchannel *controlvm_channel;
+   unsigned long controlvm_payload_bytes_buffered;
+   /*
+* The following variables are used to handle the scenario where we are
+* unable to offload the payload from a controlvm message due to memory
+* requirements. In this scenario, we simply stash the controlvm
+* message, then attempt to process it again the next time
+* controlvm_periodic_work() runs.
+*/
+   struct controlvm_message controlvm_pending_msg;
+   bool controlvm_pending_msg_valid;
+};
 
-/*
- * The following globals are used to handle the scenario where we are unable to
- * offload the payload from a controlvm message due to memory requirements. In
- * this scenario, we simply stash the controlvm message, then attempt to
- * process it again the next time controlvm_periodic_work() runs.
- */
-static struct controlvm_message controlvm_pending_msg;
-static bool controlvm_pending_msg_valid;
+static struct visorchipset_device *chipset_dev;
 
 struct parahotplug_request {
struct list_head list;
@@ -119,7 +122,7 @@ static ssize_t toolaction_show(struct device *dev,
 {
u8 tool_action = 0;
 
-   visorchannel_read(controlvm_channel,
+   visorchannel_read(chipset_dev->controlvm_channel,
  offsetof(struct spar_controlvm_channel_protocol,
   tool_action), &tool_action, sizeof(u8));
return sprintf(buf, "%u\n", tool_action);
@@ -136,7 +139,7 @@ static ssize_t toolaction_store(struct device *dev,
return -EINVAL;
 
ret = visorchannel_write
-   (controlvm_channel,
+   (chipset_dev->controlvm_channel,
 offsetof(struct spar_controlvm_channel_protocol,
  tool_action),
 &tool_action, sizeof(u8));
@@ -153,7 +156,7 @@ static ssize_t boottotool_show(struct device *dev,
 {
struct efi_spar_indication efi_spar_indication;
 
-   visorchannel_read(controlvm_channel,
+   visorchannel_read(chipset_dev->controlvm_channel,
  offsetof(struct spar_controlvm_channel_protocol,
   efi_spar_ind), &efi_spar_indication,
  sizeof(struct efi_spar_indication));
@@ -172,7 +175,7 @@ static ssize_t boottotool_store(struct device *dev,
 
efi_spar_indication.boot_to_tool = val;
ret = visorchannel_write
-   (controlvm_channel,
+   (chipset_dev->controlvm_channel,
 offsetof(struct spar_controlvm_channel_protocol,
  efi_spar_ind), &(efi_spar_indication),
 sizeof(struct efi_spar_indication));
@@ -188,7 +191,7 @@ static ssize_t error_show(struct device *dev, struct 
device_attribute *attr,
 {
u32 error = 0;
 
-   visorchannel_read(controlvm_channel,
+   visorchannel_read(chipset_dev->controlvm_channel,
  offsetof(struct spar_controlvm_channel_protocol,
   installation_error),
  &error, sizeof(u32));
@@ -205,7 +208,7 @@ static ssize_t error_store(struct device *dev, struct 
device_attribute *attr,
  

[PATCH 07/12] staging: unisys: visorbus: vbuschannel.h: Remove kernel-doc comment

2017-02-21 Thread David Kershner
From: David Binder 

Removes kernel-doc formatting for comment that precedes a static function.

Signed-off-by: David Binder 
Signed-off-by: David Kershner 
Reviewed-by: Tim Sell 
---
 drivers/staging/unisys/visorbus/vbuschannel.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/visorbus/vbuschannel.h 
b/drivers/staging/unisys/visorbus/vbuschannel.h
index b0df261..5dbf6c5 100644
--- a/drivers/staging/unisys/visorbus/vbuschannel.h
+++ b/drivers/staging/unisys/visorbus/vbuschannel.h
@@ -66,7 +66,7 @@ struct ultra_vbus_deviceinfo {
u8 reserved[128];   /* pad size to 256 bytes */
 };
 
-/**
+/*
  * vbuschannel_print_devinfo() - format a struct ultra_vbus_deviceinfo
  *   and write it to a seq_file
  * @devinfo: the struct ultra_vbus_deviceinfo to format
-- 
git-series 0.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 05/12] staging: unisys: visorbus: visorbus_main.c: Remove kernel-doc comments

2017-02-21 Thread David Kershner
From: David Binder 

Removes kernel-doc formatting for comments that precede static functions.

Signed-off-by: David Binder 
Signed-off-by: David Kershner 
Reviewed-by: Tim Sell 
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 36 +-
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index b36452f..1d54190 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -92,7 +92,7 @@ visorbus_uevent(struct device *xdev, struct kobj_uevent_env 
*env)
return 0;
 }
 
-/**
+/*
  * visorbus_match() - called automatically upon adding a visor_device
  *(device_add), or adding a visor_driver
  *(visorbus_register_visor_driver)
@@ -142,7 +142,7 @@ struct bus_type visorbus_type = {
.dev_groups = visorbus_dev_groups,
 };
 
-/**
+/*
  * visorbus_release_busdevice() - called when device_unregister() is called for
  *the bus device instance, after all other 
tasks
  *involved with destroying the dev are complete
@@ -158,7 +158,7 @@ visorbus_release_busdevice(struct device *xdev)
kfree(dev);
 }
 
-/**
+/*
  * visorbus_release_device() - called when device_unregister() is called for
  * each child device instance
  * @xdev: struct device for the visor device being released
@@ -464,7 +464,7 @@ dev_stop_periodic_work(struct visor_device *dev)
put_device(&dev->device);
 }
 
-/**
+/*
  * visordriver_remove_device() - handle visor device going away
  * @xdev: struct device for the visor device being removed
  *
@@ -583,7 +583,7 @@ visorbus_disable_channel_interrupts(struct visor_device 
*dev)
 }
 EXPORT_SYMBOL_GPL(visorbus_disable_channel_interrupts);
 
-/**
+/*
  * create_visor_device() - create visor device as a result of receiving the
  * controlvm device_create message for a new device
  * @dev: a freshly-zeroed struct visor_device, containing only filled-in values
@@ -694,7 +694,7 @@ get_vbus_header_info(struct visorchannel *chan,
return 0;
 }
 
-/**
+/*
  * write_vbus_chp_info() - write the contents of  to the struct
  * spar_vbus_channel_protocol.chp_info
  * @chan: indentifies the s-Par channel that will be updated
@@ -720,7 +720,7 @@ write_vbus_chp_info(struct visorchannel *chan,
visorchannel_write(chan, off, info, sizeof(*info));
 }
 
-/**
+/*
  * write_vbus_bus_info() - write the contents of  to the struct
  * spar_vbus_channel_protocol.bus_info
  * @chan: indentifies the s-Par channel that will be updated
@@ -746,7 +746,7 @@ write_vbus_bus_info(struct visorchannel *chan,
visorchannel_write(chan, off, info, sizeof(*info));
 }
 
-/**
+/*
  * write_vbus_dev_info() - write the contents of  to the struct
  * spar_vbus_channel_protocol.dev_info[]
  * @chan: indentifies the s-Par channel that will be updated
@@ -775,7 +775,7 @@ write_vbus_dev_info(struct visorchannel *chan,
visorchannel_write(chan, off, info, sizeof(*info));
 }
 
-/**
+/*
  * fix_vbus_dev_info() - for a child device just created on a client bus, fill
  *   in information about the driver that is controlling
  *   this device into the the appropriate slot within the
@@ -832,7 +832,7 @@ fix_vbus_dev_info(struct visor_device *visordev)
&clientbus_driverinfo);
 }
 
-/**
+/*
  * visordriver_probe_device() - handle new visor device coming online
  * @xdev: struct device for the visor device being probed
  *
@@ -956,7 +956,7 @@ int visorbus_register_visor_driver(struct visor_driver *drv)
 }
 EXPORT_SYMBOL_GPL(visorbus_register_visor_driver);
 
-/**
+/*
  * create_bus_instance() - create a device instance for the visor bus itself
  * @dev: struct visor_device indicating the bus instance
  *
@@ -1027,7 +1027,7 @@ create_bus_instance(struct visor_device *dev)
return err;
 }
 
-/**
+/*
  * remove_bus_instance() - remove a device instance for the visor bus itself
  * @dev: struct visor_device indentifying the bus to remove
  */
@@ -1051,7 +1051,7 @@ remove_bus_instance(struct visor_device *dev)
device_unregister(&dev->device);
 }
 
-/**
+/*
  * create_bus_type() - create and register the one-and-only one instance of
  * the visor bus type (visorbus_type)
  * Return: 0 for success, otherwise negative errno value returned by
@@ -1064,7 +1064,7 @@ create_bus_type(void)
return busreg_rc;
 }
 
-/**
+/*
  * remove_bus_type() - remove the one-and-only one instance of the visor bus
  * type (visorbus_type)
  */
@@ -1074,7 +1074,7 @@ remove_bus_type(void)
bus_unregister(&visorbus_type);
 }
 
-/**
+/*
  * remove_all_visor_devices() - remove all child visor

Re: [Outreachy kernel] [PATCH 4/6] staging: Drop useless initialisation

2017-02-21 Thread Julia Lawall
>   Also, note that the above semantic patch is not completely safe,
>   because
>   the code could be, eg:
>
>   int a = 0;
>   a = a + 1;
>
>   In that case, the initialization of a would be needed.  You
>   should check
>   each case for this issue.
>
>
> I have checked that case before sending the patch by diff .

OK, good :)

> Should I cut this patch as a totally different patch series and do I have 
> to mention v2.
>
>  If I have to mention v2 then how will I relate that new patch series with
> this 
> particular patch.

It's true that the subject lines will be completely different.  Maybe just
respond to your previous patch and say to ignore it, and then start over
with these patches, with one patch per driver.

julia


> Thanks,
> Simran
>  
>
>   julia
>
>   > Signed-off-by: simran singhal 
>   > ---
>   >  drivers/staging/android/ion/ion_heap.c              | 2 +-
>   >  drivers/staging/gdm724x/gdm_lte.c                   | 2 +-
>   >  drivers/staging/gdm724x/gdm_mux.c                   | 4 ++--
>   >  drivers/staging/iio/addac/adt7316-i2c.c             | 2 +-
>   >  drivers/staging/lustre/lustre/ldlm/ldlm_request.c   | 2 +-
>   >  drivers/staging/lustre/lustre/obdclass/cl_page.c    | 2 +-
>   >  drivers/staging/media/s5p-cec/exynos_hdmi_cecctrl.c | 2 +-
>   >  drivers/staging/media/s5p-cec/s5p_cec.c             | 2 +-
>   >  drivers/staging/rtl8188eu/core/rtw_ap.c             | 4 ++--
>   >  drivers/staging/rtl8188eu/core/rtw_efuse.c          | 2 +-
>   >  drivers/staging/rtl8188eu/core/rtw_mlme_ext.c       | 2 +-
>   >  drivers/staging/rtl8188eu/core/rtw_recv.c           | 4 ++--
>   >  drivers/staging/rtl8188eu/core/rtw_sreset.c         | 2 +-
>   >  drivers/staging/rtl8188eu/core/rtw_wlan_util.c      | 2 +-
>   >  drivers/staging/rtl8188eu/core/rtw_xmit.c           | 2 +-
>   >  drivers/staging/rtl8188eu/hal/hal_intf.c            | 2 +-
>   >  drivers/staging/rtl8188eu/os_dep/ioctl_linux.c      | 2 +-
>   >  drivers/staging/rtl8188eu/os_dep/xmit_linux.c       | 2 +-
>   >  drivers/staging/rtl8712/rtl8712_xmit.c              | 2 +-
>   >  drivers/staging/rtl8712/rtl871x_mp.c                | 6
>   +++---
>   >  drivers/staging/rts5208/rtsx_chip.c                 | 2 +-
>   >  drivers/staging/rts5208/sd.c                        | 4 ++--
>   >  drivers/staging/sm750fb/ddk750_chip.c               | 2 +-
>   >  drivers/staging/sm750fb/ddk750_power.c              | 2 +-
>   >  drivers/staging/speakup/speakup_ltlk.c              | 2 +-
>   >  drivers/staging/unisys/visorbus/visorchipset.c      | 4 ++--
>   >  drivers/staging/wlan-ng/cfg80211.c                  | 2 +-
>   >  drivers/staging/xgifb/XGI_main_26.c                 | 2 +-
>   >  28 files changed, 35 insertions(+), 35 deletions(-)
>   >
>   > diff --git a/drivers/staging/android/ion/ion_heap.c
>   b/drivers/staging/android/ion/ion_heap.c
>   > index 4e5c0f1..4bd844b 100644
>   > --- a/drivers/staging/android/ion/ion_heap.c
>   > +++ b/drivers/staging/android/ion/ion_heap.c
>   > @@ -270,7 +270,7 @@ static unsigned long
>   ion_heap_shrink_count(struct shrinker *shrinker,
>   >  {
>   >  struct ion_heap *heap = container_of(shrinker, struct
>   ion_heap,
>   >       shrinker);
>   > -int total = 0;
>   > +int total;
>   >
>   >  total = ion_heap_freelist_size(heap) / PAGE_SIZE;
>   >  if (heap->ops->shrink)
>   > diff --git a/drivers/staging/gdm724x/gdm_lte.c
>   b/drivers/staging/gdm724x/gdm_lte.c
>   > index a182757..e0f0912 100644
>   > --- a/drivers/staging/gdm724x/gdm_lte.c
>   > +++ b/drivers/staging/gdm724x/gdm_lte.c
>   > @@ -353,7 +353,7 @@ static s32 gdm_lte_tx_nic_type(struct
>   net_device *dev, struct sk_buff *skb)
>   >  struct ipv6hdr *ipv6;
>   >  int mac_proto;
>   >  void *network_data;
>   > -u32 nic_type = 0;
>   > +u32 nic_type;
>   >
>   >  /* NIC TYPE is based on the nic_id of this net_device
>   */
>   >  nic_type = 0x0010 | nic->nic_id;
>   > diff --git a/drivers/staging/gdm724x/gdm_mux.c
>   b/drivers/staging/gdm724x/gdm_mux.c
>   > index 4009691..aba32e2 100644
>   > --- a/drivers/staging/gdm724x/gdm_mux.c
>   > +++ b/drivers/staging/gdm724x/gdm_mux.c
>   > @@ -62,7 +62,7 @@ static int packet_type_to_index(u16
>   packetType)
>   >
>   >  static struct mux_tx *alloc_mux_tx(int len)
>   >  {
>   > -struct mux_tx *t = NULL;
>   > +struct mux_tx *t;
>   >
>   >  t = kzalloc(sizeof(*t), GFP_ATOMIC);
>   >  if (!t)
>   > @@ -91,7 +91,7 @@ static void free_mux_tx(struct mux_tx *t)
>   >
> 

Re: [PATCH] Staging: comedi: drivers: comedi_test: Avoid multiple line dereference

2017-02-21 Thread Joe Perches
On Wed, 2017-02-22 at 00:31 +0800, Cheah Kok Cheong wrote:
> > Another option could be using the typedefs from include/linux/types.h,
> > e.g. ushort.  However, this might require changing other declarations as
> > well to keep consistency.
> 
> Thanks for the idea. I counted seven instances of 'unsigned short'
> in this file so it's not viable for our situation.

I believe using ushort is relatively undesirable as
"unsigned short" is preferred ~10:1 in the kernel

$ git grep -w ushort | wc -l
1381
$ git grep -E "\bunsigned\s+short\b" | wc -l
11288

$ git grep --name-only -w "ushort" | wc -l
129
$ git grep --name-only -E "\bunsigned\s+short\b" | wc -l
2497

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


[PATCH] staging: xgifb: function definition argument should have an identifier name

2017-02-21 Thread Arushi Singhal
function definition argument like 'struct vb_device_info *','unsigned
long' etc. should have an identifier name.

Signed-off-by: Arushi Singhal 
---
 drivers/staging/xgifb/vb_setmode.h | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/xgifb/vb_setmode.h 
b/drivers/staging/xgifb/vb_setmode.h
index 6f082a7a5a4a..e4cf9a633676 100644
--- a/drivers/staging/xgifb/vb_setmode.h
+++ b/drivers/staging/xgifb/vb_setmode.h
@@ -1,14 +1,15 @@
 #ifndef _VBSETMODE_
 #define _VBSETMODE_
 
-void InitTo330Pointer(unsigned char, struct vb_device_info *);
-void XGI_UnLockCRT2(struct vb_device_info *);
-void XGI_LockCRT2(struct vb_device_info *);
-void XGI_DisplayOff(struct xgifb_video_info *,
-   struct xgi_hw_device_info *,
-   struct vb_device_info *);
-void XGI_GetVBType(struct vb_device_info *);
-void XGI_SenseCRT1(struct vb_device_info *);
+void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo);
+void XGI_UnLockCRT2(struct vb_device_info *pVBInfo);
+void XGI_LockCRT2(struct vb_device_info *pVBInfo);
+void XGI_DisplayOff(struct xgifb_video_info *xgifb_info,
+   struct xgi_hw_device_info *pXGIHWDE,
+   struct vb_device_info *pVBInfo);
+void XGI_GetVBType(struct vb_device_info *pVBInfo);
+   pVBInfo->VBInfo = DisableCRT2Display;
+void XGI_SenseCRT1(struct vb_device_info *pVBInfo);
 unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
struct xgi_hw_device_info *HwDeviceExtension,
unsigned short ModeNo);
@@ -18,6 +19,6 @@ unsigned char XGI_SearchModeID(unsigned short ModeNo,
 unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE,
  unsigned short ModeNo,
  unsigned short ModeIdIndex,
- struct vb_device_info *);
+ struct vb_device_info *pVBInfo);
 
 #endif
-- 
2.11.0

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


[PATCH 11/12] staging: unisys: visorbus: remove character device interface

2017-02-21 Thread David Kershner
From: Sameer Wadgaonkar 

Removed the character device interface from visorchipset and
removed the major and minor numbers.

Reported-by: Greg Kroah-Hartman 
Signed-off-by: Sameer Wadgaonkar 
Signed-off-by: David Kershner 
Reviewed-by: Tim Sell 
---
 drivers/staging/unisys/visorbus/visorchipset.c | 158 +--
 1 file changed, 158 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index b3c3cdd..c120c46 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -15,7 +15,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -36,8 +35,6 @@
 
 #define MAX_CONTROLVM_PAYLOAD_BYTES (1024 * 128)
 
-#define VISORCHIPSET_MMAP_CONTROLCHANOFFSET0x
-
 #define UNISYS_SPAR_LEAF_ID 0x4000
 
 /* The s-Par leaf ID returns "UnisysSpar64" encoded across ebx, ecx, edx */
@@ -46,27 +43,6 @@
 #define UNISYS_SPAR_ID_EDX 0x34367261
 
 /*
- * Module parameters
- */
-static int visorchipset_major;
-
-static int
-visorchipset_open(struct inode *inode, struct file *file)
-{
-   unsigned int minor_number = iminor(inode);
-
-   if (minor_number)
-   return -ENODEV;
-   return 0;
-}
-
-static int
-visorchipset_release(struct inode *inode, struct file *file)
-{
-   return 0;
-}
-
-/*
  * When the controlvm channel is idle for at least MIN_IDLE_SECONDS,
  * we switch to slow polling mode. As soon as we get a controlvm
  * message, we switch back to fast polling mode.
@@ -88,8 +64,6 @@ struct visorchipset_device {
/* when we got our last controlvm message */
unsigned long most_recent_message_jiffies;
struct delayed_work periodic_controlvm_work;
-   struct cdev file_cdev;
-   struct visorchannel **file_controlvm_channel;
struct visorchannel *controlvm_channel;
unsigned long controlvm_payload_bytes_buffered;
/*
@@ -112,9 +86,6 @@ struct parahotplug_request {
struct controlvm_message msg;
 };
 
-/* info for /dev/visorchipset */
-static dev_t major_dev = -1; /*< indicates major num for device */
-
 /* prototypes for attributes */
 static ssize_t toolaction_show(struct device *dev,
   struct device_attribute *attr,
@@ -1537,46 +1508,6 @@ device_resume_response(struct visor_device *dev_info, 
int response)
dev_info->pending_msg_hdr = NULL;
 }
 
-static int
-visorchipset_mmap(struct file *file, struct vm_area_struct *vma)
-{
-   unsigned long physaddr = 0;
-   unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
-   u64 addr = 0;
-
-   /* sv_enable_dfp(); */
-   if (offset & (PAGE_SIZE - 1))
-   return -ENXIO;  /* need aligned offsets */
-
-   switch (offset) {
-   case VISORCHIPSET_MMAP_CONTROLCHANOFFSET:
-   vma->vm_flags |= VM_IO;
-   if (!*chipset_dev->file_controlvm_channel)
-   return -ENXIO;
-
-   visorchannel_read
-   (*chipset_dev->file_controlvm_channel,
-offsetof(struct spar_controlvm_channel_protocol,
- gp_control_channel),
-&addr, sizeof(addr));
-   if (!addr)
-   return -ENXIO;
-
-   physaddr = (unsigned long)addr;
-   if (remap_pfn_range(vma, vma->vm_start,
-   physaddr >> PAGE_SHIFT,
-   vma->vm_end - vma->vm_start,
-   /*pgprot_noncached */
-   (vma->vm_page_prot))) {
-   return -EAGAIN;
-   }
-   break;
-   default:
-   return -ENXIO;
-   }
-   return 0;
-}
-
 static inline s64 issue_vmcall_query_guest_virtual_time_offset(void)
 {
u64 result = VMCALL_SUCCESS;
@@ -1595,79 +1526,6 @@ static inline int issue_vmcall_update_physical_time(u64 
adjustment)
return result;
 }
 
-static long visorchipset_ioctl(struct file *file, unsigned int cmd,
-  unsigned long arg)
-{
-   u64 adjustment;
-   s64 vrtc_offset;
-
-   switch (cmd) {
-   case VMCALL_QUERY_GUEST_VIRTUAL_TIME_OFFSET:
-   /* get the physical rtc offset */
-   vrtc_offset = issue_vmcall_query_guest_virtual_time_offset();
-   if (copy_to_user((void __user *)arg, &vrtc_offset,
-sizeof(vrtc_offset))) {
-   return -EFAULT;
-   }
-   return 0;
-   case VMCALL_UPDATE_PHYSICAL_TIME:
-   if (copy_from_user(&adjustment, (void __user *)arg,
-  sizeof(adjustment))) {
-   return -EFAULT;
-   }
-   return issue_vmcall_update_physical_time(adjustment);
-   default:
-   return -EFAU

Re: [Outreachy kernel] [PATCH] staging: xgifb: function definition argument should have an identifier name

2017-02-21 Thread Julia Lawall


On Tue, 21 Feb 2017, Arushi Singhal wrote:

> function definition argument like 'struct vb_device_info *','unsigned
> long' etc. should have an identifier name.
>
> Signed-off-by: Arushi Singhal 
> ---
>  drivers/staging/xgifb/vb_setmode.h | 19 ++-
>  1 file changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/staging/xgifb/vb_setmode.h 
> b/drivers/staging/xgifb/vb_setmode.h
> index 6f082a7a5a4a..e4cf9a633676 100644
> --- a/drivers/staging/xgifb/vb_setmode.h
> +++ b/drivers/staging/xgifb/vb_setmode.h
> @@ -1,14 +1,15 @@
>  #ifndef _VBSETMODE_
>  #define _VBSETMODE_
>
> -void InitTo330Pointer(unsigned char, struct vb_device_info *);
> -void XGI_UnLockCRT2(struct vb_device_info *);
> -void XGI_LockCRT2(struct vb_device_info *);
> -void XGI_DisplayOff(struct xgifb_video_info *,
> - struct xgi_hw_device_info *,
> - struct vb_device_info *);
> -void XGI_GetVBType(struct vb_device_info *);
> -void XGI_SenseCRT1(struct vb_device_info *);
> +void InitTo330Pointer(unsigned char ChipType, struct vb_device_info 
> *pVBInfo);
> +void XGI_UnLockCRT2(struct vb_device_info *pVBInfo);
> +void XGI_LockCRT2(struct vb_device_info *pVBInfo);
> +void XGI_DisplayOff(struct xgifb_video_info *xgifb_info,
> + struct xgi_hw_device_info *pXGIHWDE,
> + struct vb_device_info *pVBInfo);
> +void XGI_GetVBType(struct vb_device_info *pVBInfo);
> + pVBInfo->VBInfo = DisableCRT2Display;

How does this like fit in?

I don't think this would have successfully compiled.

julia


> +void XGI_SenseCRT1(struct vb_device_info *pVBInfo);
>  unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
>   struct xgi_hw_device_info *HwDeviceExtension,
>   unsigned short ModeNo);
> @@ -18,6 +19,6 @@ unsigned char XGI_SearchModeID(unsigned short ModeNo,
>  unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE,
> unsigned short ModeNo,
> unsigned short ModeIdIndex,
> -   struct vb_device_info *);
> +   struct vb_device_info *pVBInfo);
>
>  #endif
> --
> 2.11.0
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/20170221180852.GA19723%40arushi-HP-Pavilion-Notebook.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 6/6] staging: comedi: Using macro DIV_ROUND_UP

2017-02-21 Thread simran singhal
The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)).
It clarifies the divisor calculations. This occurence was detected using
the coccinelle script:

@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: simran singhal 
---
 drivers/staging/comedi/drivers/addi_apci_3xxx.c | 2 +-
 drivers/staging/comedi/drivers/cb_pcidas64.c| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_3xxx.c 
b/drivers/staging/comedi/drivers/addi_apci_3xxx.c
index b6af3eb..82c2211 100644
--- a/drivers/staging/comedi/drivers/addi_apci_3xxx.c
+++ b/drivers/staging/comedi/drivers/addi_apci_3xxx.c
@@ -502,7 +502,7 @@ static int apci3xxx_ai_ns_to_timer(struct comedi_device 
*dev,
timer = *ns / base;
break;
case CMDF_ROUND_UP:
-   timer = (*ns + base - 1) / base;
+   timer = DIV_ROUND_UP(*ns, base);
break;
}
 
diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
b/drivers/staging/comedi/drivers/cb_pcidas64.c
index efbf277..3b98193 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -2007,7 +2007,7 @@ static unsigned int get_divisor(unsigned int ns, unsigned 
int flags)
 
switch (flags & CMDF_ROUND_MASK) {
case CMDF_ROUND_UP:
-   divisor = (ns + TIMER_BASE - 1) / TIMER_BASE;
+   divisor = DIV_ROUND_UP(ns, TIMER_BASE);
break;
case CMDF_ROUND_DOWN:
divisor = ns / TIMER_BASE;
-- 
2.7.4

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


Re: [Outreachy kernel] [PATCH] staging: xgifb: correct the multiple line dereference to fix coding stye errors

2017-02-21 Thread Joe Perches
On Tue, 2017-02-21 at 18:40 +0100, Julia Lawall wrote:
> 
> On Tue, 21 Feb 2017, Arushi Singhal wrote:
> 
> > Error was reported by checkpatch.pl as
> > WARNING: Avoid multiple line dereference...
> > if there is boolean operator then it is fixed by Splitting line at
> > boolean operator.
> 
> This is massively execeeding the 80 character boundary, and not for
> something trivial like a string.  Maybe the code can be reorganized in
> some other way.

The easiest way to do that is to change the test above it
to reduce indentation from

if (xgifb_info->display2 == XGIFB_DISP_TV &&
xgifb_info->hasVB == HASVB_301) {
[code...];
}
}

to

if (xgifb_info->display2 != XGIFB_DISP_TV ||
xgifb_in
fo->hasVB != HASVB_301)
return;

[code...];
}

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


Re: [PATCH] staging/ks7010: formatting updates.

2017-02-21 Thread Joe Perches
On Tue, 2017-02-21 at 09:32 -0800, Matthew Giassa wrote:
> * Geert Uytterhoeven  [2017-02-21 15:22:10 +0100]:
> 
> > The first declaration fit nicely on a single line.
> > The second one indeed has a few spaces instead of TABs in the
> > continuation line. But that can be fixed easily, without moving the
> > first parameter to a continuation line.
> 
> What would the proposed fix be? A combination of spaces and hard-tabs? I
> don't see checkpatch complaining about it, so that could work too.

Maximal initial tabs, followed by required spaces to align
to open parenthesis

So from:

int ks_wlan_setup_parameter(struct ks_wlan_private *priv,
 unsigned int commit_flag);

(2 tabs followed by 13 spaces)

to:

int ks_wlan_setup_parameter(struct ks_wlan_private *priv,
unsigned int commit_flag);

(3 tabs followed by 4 spaces)

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


[PATCH 1/7] staging: vc04_services: Using macro DIV_ROUND_UP

2017-02-21 Thread simran singhal
The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)).
It clarifies the divisor calculations. This occurence was detected using
the coccinelle script:

@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: simran singhal 
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 2 +-
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index e6241fb..e09731e 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -400,7 +400,7 @@ create_pagelist(char __user *buf, size_t count, unsigned 
short type,
dma_addr_t dma_addr;
 
offset = ((unsigned int)(unsigned long)buf & (PAGE_SIZE - 1));
-   num_pages = (count + offset + PAGE_SIZE - 1) / PAGE_SIZE;
+   num_pages = DIV_ROUND_UP(count + offset, PAGE_SIZE);
 
pagelist_size = sizeof(PAGELIST_T) +
(num_pages * sizeof(u32)) +
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 0525211..d0938de 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -1557,7 +1557,7 @@ dump_phys_mem(void *virt_addr, u32 num_bytes)
offset = (int)(long)virt_addr & (PAGE_SIZE - 1);
end_offset = (int)(long)end_virt_addr & (PAGE_SIZE - 1);
 
-   num_pages = (offset + num_bytes + PAGE_SIZE - 1) / PAGE_SIZE;
+   num_pages = DIV_ROUND_UP(offset + num_bytes, PAGE_SIZE);
 
pages = kmalloc(sizeof(struct page *) * num_pages, GFP_KERNEL);
if (pages == NULL) {
-- 
2.7.4

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


[PATCH 2/7] staging: most: Using macro DIV_ROUND_UP

2017-02-21 Thread simran singhal
The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)).
It clarifies the divisor calculations. This occurence was detected using
the coccinelle script:

@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: simran singhal 
---
 drivers/staging/most/hdm-dim2/dim2_hal.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c 
b/drivers/staging/most/hdm-dim2/dim2_hal.c
index 0b9816c..6824826 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hal.c
+++ b/drivers/staging/most/hdm-dim2/dim2_hal.c
@@ -49,7 +49,7 @@
 #define DBR_SIZE  (16 * 1024) /* specified by IP */
 #define DBR_BLOCK_SIZE  (DBR_SIZE / 32 / DBR_MAP_SIZE)
 
-#define ROUND_UP_TO(x, d)  (((x) + (d) - 1) / (d) * (d))
+#define ROUND_UP_TO(x, d)  (DIV_ROUND_UP(x, (d)) * (d))
 
 /* -- 
*/
 /* generic helper functions and macros */
@@ -117,7 +117,7 @@ static int alloc_dbr(u16 size)
return DBR_SIZE; /* out of memory */
 
for (i = 0; i < DBR_MAP_SIZE; i++) {
-   u32 const blocks = (size + DBR_BLOCK_SIZE - 1) / DBR_BLOCK_SIZE;
+   u32 const blocks = DIV_ROUND_UP(size, DBR_BLOCK_SIZE);
u32 mask = ~((~(u32)0) << blocks);
 
do {
@@ -137,7 +137,7 @@ static int alloc_dbr(u16 size)
 static void free_dbr(int offs, int size)
 {
int block_idx = offs / DBR_BLOCK_SIZE;
-   u32 const blocks = (size + DBR_BLOCK_SIZE - 1) / DBR_BLOCK_SIZE;
+   u32 const blocks = DIV_ROUND_UP(size, DBR_BLOCK_SIZE);
u32 mask = ~((~(u32)0) << blocks);
 
mask <<= block_idx % 32;
-- 
2.7.4

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


Re: [Linaro-mm-sig] [RFCv3][PATCH 3/5] arm64: Implement ARCH_HAS_FORCE_CACHE

2017-02-21 Thread Laura Abbott
On 02/20/2017 10:05 PM, Chen Feng wrote:
> Hi Laura,
> 
> When we enable kernel v4.4 or newer version on our platform, we meet the issue
> of flushing cache without reference device. It seems that this patch set is
> a solution. I'm curious the progress of the discussion. Do you have any plan
> to fix it in v4.4 and newer kernel verison?
> 

No, I've abandoned this approach based on feedback. The APIs had too much
potential for incorrect usage. I'm ripping out the implicit caching in Ion
and switching it to a model where there should always be a device available.

What's your use case where you don't have a device structure?

Thanks,
Laura

> On 2016/9/14 2:41, Laura Abbott wrote:
>> On 09/13/2016 08:14 AM, Will Deacon wrote:
>>> On Tue, Sep 13, 2016 at 08:02:20AM -0700, Laura Abbott wrote:
 On 09/13/2016 02:19 AM, Will Deacon wrote:
> On Mon, Sep 12, 2016 at 02:32:56PM -0700, Laura Abbott wrote:
>>
>> arm64 may need to guarantee the caches are synced. Implement versions of
>> the kernel_force_cache API to allow this.
>>
>> Signed-off-by: Laura Abbott 
>> ---
>> v3: Switch to calling cache operations directly instead of relying on
>> DMA mapping.
>> ---
>> arch/arm64/include/asm/cacheflush.h |  8 
>> arch/arm64/mm/cache.S   | 24 
>> arch/arm64/mm/flush.c   | 11 +++
>> 3 files changed, 39 insertions(+), 4 deletions(-)
>
> I'm really hesitant to expose these cache routines as an API solely to
> support a driver sitting in staging/. I appreciate that there's a chicken
> and egg problem here, but we *really* don't want people using these 
> routines
> in preference to the DMA API, and I fear that we'll simply grow a bunch
> more users of these things if we promote it as an API like you're 
> proposing.
>
> Can the code not be contained under staging/, as part of ion?
>

 I proposed that in V1 and it was suggested I make it a proper API

 http://www.mail-archive.com/driverdev-devel@linuxdriverproject.org/msg47654.html
 http://www.mail-archive.com/driverdev-devel@linuxdriverproject.org/msg47672.html
>>>
>>> :/ then I guess we're in disagreement. If ion really needs this stuff
>>> (which I don't fully grok), perhaps we should be exposing something at
>>> a higher level from the architecture, so it really can't be used for
>>> anything other than ion.
>>
>> I talked/complained about this at a past plumbers. The gist is that Ion
>> ends up acting as a fake DMA layer for clients. It doesn't match nicely
>> because clients can allocate both coherent and non-coherent memory.
>> Trying to use dma_map doesn't work because a) a device for coherency isn't
>> known at allocation time b) it kills performance. Part of the motivation
>> for taking this approach is to avoid the need to rework the existing
>> Android userspace and keep the existing behavior, as terrible as it
>> is. Having Ion out of staging and not actually usable isn't helpful.
>>
>> I'll give this all some more thought and hopefully have one or two more
>> proposals before Connect/Plumbers.
>>
>>>
>>> Will
>>>
>>
>> Thanks,
>> Laura
>> ___
>> Linaro-mm-sig mailing list
>> linaro-mm-...@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/linaro-mm-sig
> 
> 
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

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


[PATCH v2] staging: xgifb: function definition argument should also have an identifier name'

2017-02-21 Thread Arushi Singhal
function definition argument like 'struct vb_device_info *','unsigned
long' etc. should also have an identifier name.

Signed-off-by: Arushi Singhal 
Changes in v2:
  - By mistake one irrelevant line was added which is removed in this
patch.
---
 drivers/staging/xgifb/vb_setmode.h | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/xgifb/vb_setmode.h 
b/drivers/staging/xgifb/vb_setmode.h
index 6f082a7a5a4a..c6317ab00474 100644
--- a/drivers/staging/xgifb/vb_setmode.h
+++ b/drivers/staging/xgifb/vb_setmode.h
@@ -1,14 +1,14 @@
 #ifndef _VBSETMODE_
 #define _VBSETMODE_
 
-void InitTo330Pointer(unsigned char, struct vb_device_info *);
-void XGI_UnLockCRT2(struct vb_device_info *);
-void XGI_LockCRT2(struct vb_device_info *);
-void XGI_DisplayOff(struct xgifb_video_info *,
-   struct xgi_hw_device_info *,
-   struct vb_device_info *);
-void XGI_GetVBType(struct vb_device_info *);
-void XGI_SenseCRT1(struct vb_device_info *);
+void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo);
+void XGI_UnLockCRT2(struct vb_device_info *pVBInfo);
+void XGI_LockCRT2(struct vb_device_info *pVBInfo);
+void XGI_DisplayOff(struct xgifb_video_info *xgifb_info,
+   struct xgi_hw_device_info *pXGIHWDE,
+   struct vb_device_info *pVBInfo);
+void XGI_GetVBType(struct vb_device_info *pVBInfo);
+void XGI_SenseCRT1(struct vb_device_info *pVBInfo);
 unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
struct xgi_hw_device_info *HwDeviceExtension,
unsigned short ModeNo);
@@ -18,6 +18,6 @@ unsigned char XGI_SearchModeID(unsigned short ModeNo,
 unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE,
  unsigned short ModeNo,
  unsigned short ModeIdIndex,
- struct vb_device_info *);
+ struct vb_device_info *pVBInfo);
 
 #endif
-- 
2.11.0

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


Re: [PATCH] staging/ks7010: formatting updates.

2017-02-21 Thread Matthew Giassa

* Joe Perches  [2017-02-21 10:47:31 -0800]:


On Tue, 2017-02-21 at 09:32 -0800, Matthew Giassa wrote:

* Geert Uytterhoeven  [2017-02-21 15:22:10 +0100]:

> The first declaration fit nicely on a single line.
> The second one indeed has a few spaces instead of TABs in the
> continuation line. But that can be fixed easily, without moving the
> first parameter to a continuation line.

What would the proposed fix be? A combination of spaces and hard-tabs? I
don't see checkpatch complaining about it, so that could work too.


Maximal initial tabs, followed by required spaces to align
to open parenthesis



Thank you Joe. I will change it accordingly. Is there a supplementary
style guide that covers these finer details?

Cheers!

--
-Matthew Giassa
e:

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


Re: [Outreachy kernel] [PATCH v2] staging: xgifb: function definition argument should also have an identifier name'

2017-02-21 Thread Julia Lawall
On Wed, 22 Feb 2017, Arushi Singhal wrote:

> function definition argument like 'struct vb_device_info *','unsigned
> long' etc. should also have an identifier name.
>
> Signed-off-by: Arushi Singhal 
> Changes in v2:
>   - By mistake one irrelevant line was added which is removed in this
> patch.

The v2 discussion belongs under the ---.  The text below the --- is
dropped when the patch is applied.  The discussion is only relevant to
people who are watching the patches get submitted.  Once the final
instance gets applied, the change as compared to the previous instance is
not important.

julia

> ---
>  drivers/staging/xgifb/vb_setmode.h | 18 +-
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/staging/xgifb/vb_setmode.h 
> b/drivers/staging/xgifb/vb_setmode.h
> index 6f082a7a5a4a..c6317ab00474 100644
> --- a/drivers/staging/xgifb/vb_setmode.h
> +++ b/drivers/staging/xgifb/vb_setmode.h
> @@ -1,14 +1,14 @@
>  #ifndef _VBSETMODE_
>  #define _VBSETMODE_
>
> -void InitTo330Pointer(unsigned char, struct vb_device_info *);
> -void XGI_UnLockCRT2(struct vb_device_info *);
> -void XGI_LockCRT2(struct vb_device_info *);
> -void XGI_DisplayOff(struct xgifb_video_info *,
> - struct xgi_hw_device_info *,
> - struct vb_device_info *);
> -void XGI_GetVBType(struct vb_device_info *);
> -void XGI_SenseCRT1(struct vb_device_info *);
> +void InitTo330Pointer(unsigned char ChipType, struct vb_device_info 
> *pVBInfo);
> +void XGI_UnLockCRT2(struct vb_device_info *pVBInfo);
> +void XGI_LockCRT2(struct vb_device_info *pVBInfo);
> +void XGI_DisplayOff(struct xgifb_video_info *xgifb_info,
> + struct xgi_hw_device_info *pXGIHWDE,
> + struct vb_device_info *pVBInfo);
> +void XGI_GetVBType(struct vb_device_info *pVBInfo);
> +void XGI_SenseCRT1(struct vb_device_info *pVBInfo);
>  unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
>   struct xgi_hw_device_info *HwDeviceExtension,
>   unsigned short ModeNo);
> @@ -18,6 +18,6 @@ unsigned char XGI_SearchModeID(unsigned short ModeNo,
>  unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE,
> unsigned short ModeNo,
> unsigned short ModeIdIndex,
> -   struct vb_device_info *);
> +   struct vb_device_info *pVBInfo);
>
>  #endif
> --
> 2.11.0
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/20170221193534.GA23615%40arushi-HP-Pavilion-Notebook.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] [PATCH 2/7] staging: most: Using macro DIV_ROUND_UP

2017-02-21 Thread Julia Lawall


On Wed, 22 Feb 2017, simran singhal wrote:

> The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)).
> It clarifies the divisor calculations. This occurence was detected using
> the coccinelle script:
>
> @@
> expression e1;
> expression e2;
> @@
> (
> - ((e1) + e2 - 1) / (e2)
> + DIV_ROUND_UP(e1,e2)
> |
> - ((e1) + (e2 - 1)) / (e2)
> + DIV_ROUND_UP(e1,e2)
> )


DIV_ROUND_UP is defined in kernel.h, which defines some other generally
useful things.  Maybe there is an opportunity for making rules from some
of them also.

julia

>
> Signed-off-by: simran singhal 
> ---
>  drivers/staging/most/hdm-dim2/dim2_hal.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c 
> b/drivers/staging/most/hdm-dim2/dim2_hal.c
> index 0b9816c..6824826 100644
> --- a/drivers/staging/most/hdm-dim2/dim2_hal.c
> +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c
> @@ -49,7 +49,7 @@
>  #define DBR_SIZE  (16 * 1024) /* specified by IP */
>  #define DBR_BLOCK_SIZE  (DBR_SIZE / 32 / DBR_MAP_SIZE)
>
> -#define ROUND_UP_TO(x, d)  (((x) + (d) - 1) / (d) * (d))
> +#define ROUND_UP_TO(x, d)  (DIV_ROUND_UP(x, (d)) * (d))
>
>  /* 
> -- */
>  /* generic helper functions and macros */
> @@ -117,7 +117,7 @@ static int alloc_dbr(u16 size)
>   return DBR_SIZE; /* out of memory */
>
>   for (i = 0; i < DBR_MAP_SIZE; i++) {
> - u32 const blocks = (size + DBR_BLOCK_SIZE - 1) / DBR_BLOCK_SIZE;
> + u32 const blocks = DIV_ROUND_UP(size, DBR_BLOCK_SIZE);
>   u32 mask = ~((~(u32)0) << blocks);
>
>   do {
> @@ -137,7 +137,7 @@ static int alloc_dbr(u16 size)
>  static void free_dbr(int offs, int size)
>  {
>   int block_idx = offs / DBR_BLOCK_SIZE;
> - u32 const blocks = (size + DBR_BLOCK_SIZE - 1) / DBR_BLOCK_SIZE;
> + u32 const blocks = DIV_ROUND_UP(size, DBR_BLOCK_SIZE);
>   u32 mask = ~((~(u32)0) << blocks);
>
>   mask <<= block_idx % 32;
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/20170221185615.GA25627%40singhal-Inspiron-5558.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging/ks7010: formatting updates.

2017-02-21 Thread Joe Perches
On Tue, 2017-02-21 at 11:48 -0800, Matthew Giassa wrote:
> * Joe Perches  [2017-02-21 10:47:31 -0800]:
> 
> > On Tue, 2017-02-21 at 09:32 -0800, Matthew Giassa wrote:
> > > * Geert Uytterhoeven  [2017-02-21 15:22:10 +0100]:
> > > 
> > > > The first declaration fit nicely on a single line.
> > > > The second one indeed has a few spaces instead of TABs in the
> > > > continuation line. But that can be fixed easily, without moving the
> > > > first parameter to a continuation line.
> > > 
> > > What would the proposed fix be? A combination of spaces and hard-tabs? I
> > > don't see checkpatch complaining about it, so that could work too.
> > 
> > Maximal initial tabs, followed by required spaces to align
> > to open parenthesis
> > 
> 
> Thank you Joe. I will change it accordingly. Is there a supplementary
> style guide that covers these finer details?

No, coding style just says

Descendants are always substantially shorter than
the parent and are placed substantially to the right

However alignment to the open parenthesis is a
pretty common style.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/3] staging: comedi: Remove level of indentation

2017-02-21 Thread Tobin C. Harding
Re-send and include cc's

On Tue, Feb 21, 2017 at 03:55:18PM +, Ian Abbott wrote:
> On 21/02/17 11:18, Tobin C. Harding wrote:
> 
> For comedi patches affecting a single driver, we prefer the driver name to
> be mentioned in the patch subject, like...
> 
> staging: comedi: cb_pcidas64: blah blah
> 
> >For loop contains only an if conditional (and body of if conditional).
> >Conditional can be inverted and the loop continued if the new
> >conditional is true without modifying the program logic. This allows
> >one level of indentation to be removed.
> >
> >Invert conditional and continue loop if new conditional evaluates to
> >true. Remove one level of indentation from subsequent loop body.
> >
> >Signed-off-by: Tobin C. Harding 
> >---
> > drivers/staging/comedi/drivers/cb_pcidas64.c | 20 ++--
> > 1 file changed, 10 insertions(+), 10 deletions(-)
> >
> >diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
> >b/drivers/staging/comedi/drivers/cb_pcidas64.c
> >index cb9c269..352f754 100644
> >--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
> >+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
> >@@ -1497,16 +1497,16 @@ static int alloc_and_init_dma_members(struct 
> >comedi_device *dev)
> > return -ENOMEM;
> > }
> > for (i = 0; i < AO_DMA_RING_COUNT; i++) {
> >-if (ao_cmd_is_supported(board)) {
> >-devpriv->ao_buffer[i] =
> >-dma_alloc_coherent(&pcidev->dev,
> >-   DMA_BUFFER_SIZE,
> >-   &devpriv->
> >-   ao_buffer_bus_addr[i],
> >-   GFP_KERNEL);
> >-if (!devpriv->ao_buffer[i])
> >-return -ENOMEM;
> >-}
> >+if (!ao_cmd_is_supported(board))
> >+continue;
> >+devpriv->ao_buffer[i] =
> >+dma_alloc_coherent(&pcidev->dev,
> >+DMA_BUFFER_SIZE,
> >+&devpriv->
> >+ao_buffer_bus_addr[i],
> >+GFP_KERNEL);
> 
> Since you are unindenting the code, you can reformat those function
> parameters at the same time to fix the multiline dereference.

Righto, so for comedi/drivers prefer to group multiple checkpatch fixes to one
driver in a patch as apposed to grouping by individual checkpatch warning
but mixing drivers?

> 
> >+if (!devpriv->ao_buffer[i])
> >+return -ENOMEM;
> > }
> > /* allocate dma descriptors */
> > devpriv->ai_dma_desc =
> >
> 
> 
> -- 
> -=( Ian Abbott @ MEV Ltd.E-mail:  )=-
> -=(  Web: http://www.mev.co.uk/  )=-

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


Re: [PATCH 3/3] staging: comedi: Fix checkpatch MULTILINE_DEREFERENCE

2017-02-21 Thread Tobin C. Harding
On Tue, Feb 21, 2017 at 04:00:40PM +, Ian Abbott wrote:
> On 21/02/17 11:18, Tobin C. Harding wrote:
> >Checkpatch emits multiple WARNING: Avoid multiple line dereference.
> >Removing these warnings will result in line over 80 warnings being
> >introduced. However,
> >
> >Documentation/process/coding-style.rst: "Statements longer than 80
> >columns will be broken into sensible chunks, unless exceeding 80
> >columns significantly increases readability and does not hide
> >information"
> >
> >Exceeding the 80 columns limit helps readabilty when it means we
> >don't have to break apart dereferences.
> >
> >Remove line breaks from the middle of struct variable member
> >dereferences. Introduce new line over 80 checkpatch warnings.
> >
> >Signed-off-by: Tobin C. Harding 
> >---
> > drivers/staging/comedi/drivers/adl_pci9118.c |  3 +--
> > drivers/staging/comedi/drivers/cb_pcidas64.c | 19 ++-
> > drivers/staging/comedi/drivers/dt3000.c  |  3 +--
> > drivers/staging/comedi/drivers/jr3_pci.c |  3 +--
> > drivers/staging/comedi/drivers/ni_atmio.c|  4 ++--
> > drivers/staging/comedi/drivers/ni_labpc_common.c |  3 +--
> > drivers/staging/comedi/drivers/ni_mio_common.c   |  3 +--
> > drivers/staging/comedi/drivers/rtd520.c  |  3 +--
> > drivers/staging/comedi/drivers/s626.c| 11 ---
> > 9 files changed, 18 insertions(+), 34 deletions(-)
> 
> This patch ought to be split up by driver.  Also, we're bound to get
> follow-up patches from people due to lines exceeding 80 columns.

I wast hesitant to send this patch set in when I completed it because
of this issue you mention. Is this series worth pursuing or is it two
steps forward one step back?

If it is worth doing I'm happy to break it up by driver and re-submit.

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


Re: [PATCH] staging: xgifb: function definition argument should have an identifier name

2017-02-21 Thread kbuild test robot
Hi Arushi,

[auto build test ERROR on v4.9-rc8]
[cannot apply to staging/staging-testing next-20170220]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Arushi-Singhal/staging-xgifb-function-definition-argument-should-have-an-identifier-name/20170222-031312
config: x86_64-randconfig-ne0-02220257 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   In file included from drivers/staging/xgifb/XGI_main_26.c:16:0:
>> drivers/staging/xgifb/vb_setmode.h:11:11: error: expected '=', ',', ';', 
>> 'asm' or '__attribute__' before '->' token
   pVBInfo->VBInfo = DisableCRT2Display;
  ^~

vim +11 drivers/staging/xgifb/vb_setmode.h

 5  void XGI_UnLockCRT2(struct vb_device_info *pVBInfo);
 6  void XGI_LockCRT2(struct vb_device_info *pVBInfo);
 7  void XGI_DisplayOff(struct xgifb_video_info *xgifb_info,
 8  struct xgi_hw_device_info *pXGIHWDE,
 9  struct vb_device_info *pVBInfo);
10  void XGI_GetVBType(struct vb_device_info *pVBInfo);
  > 11  pVBInfo->VBInfo = DisableCRT2Display;
12  void XGI_SenseCRT1(struct vb_device_info *pVBInfo);
13  unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
14  struct xgi_hw_device_info 
*HwDeviceExtension,

---
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 5/6] staging: lustre: Using macro DIV_ROUND_UP

2017-02-21 Thread Joe Perches
On Tue, 2017-02-21 at 23:16 +0530, simran singhal wrote:
> The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)).
> It clarifies the divisor calculations. This occurence was detected using
> the coccinelle script:
> 
> @@
> expression e1;
> expression e2;
> @@
> (
> - ((e1) + e2 - 1) / (e2)
> + DIV_ROUND_UP(e1,e2)
> > 
> 
> - ((e1) + (e2 - 1)) / (e2)
> + DIV_ROUND_UP(e1,e2)
> )

Coccinelle scripts are great but please
inspect the results for appropriate style
and simplify the patch where possible.

> diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c 
> b/drivers/staging/lustre/lustre/ptlrpc/client.c
[]
> @@ -3136,8 +3136,7 @@ void ptlrpc_set_bulk_mbits(struct ptlrpc_request *req)
>* that server can infer the number of bulks that were prepared,
>* see LU-1431
>*/
> - req->rq_mbits += ((bd->bd_iov_count + LNET_MAX_IOV - 1) /
> -   LNET_MAX_IOV) - 1;
> + req->rq_mbits += (DIV_ROUND_UP(bd->bd_iov_count, LNET_MAX_IOV)) - 1;

Unnecessary parentheses.

> diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c 
> b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
[]
> @@ -272,7 +272,7 @@ static unsigned long enc_pools_shrink_scan(struct 
> shrinker *s,
>  static inline
>  int npages_to_npools(unsigned long npages)
>  {
> - return (int)((npages + PAGES_PER_POOL - 1) / PAGES_PER_POOL);
> + return (int)(DIV_ROUND_UP(npages, PAGES_PER_POOL));
>  }

Here too.

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


Comedi use of standard types

2017-02-21 Thread Tobin C. Harding
Comedi drivers make heavy use of standard types i.e unsigned
short. According to Linux Device Drivers standard C data types are not
the same size of all architectures.

Should we be converting comedi/drivers to use kernel types u8, u16 etc

Follow up question. Some comedi/drivers also use unsigned long for
variables that are not memory addresses. If we are to convert standard
types to kernel types how does one know the intended size of these
variables. I see that the register values come from the manual

http://www.ni.com/pdf/manuals/340934b.pdf

Is the choice (size) of type in a struct (eg struct ni_private,
comedi/drivers/ni_stc.h) a kernel design issue or is it a hardware
issue and should I be reading the manual to find it.

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


Re: Comedi use of standard types

2017-02-21 Thread Tobin C. Harding
On Wed, Feb 22, 2017 at 08:27:37AM +1100, Tobin C. Harding wrote:
> Comedi drivers make heavy use of standard types i.e unsigned
> short. According to Linux Device Drivers standard C data types are not
> the same size of all architectures.
> 
> Should we be converting comedi/drivers to use kernel types u8, u16 etc
> 
> Follow up question. Some comedi/drivers also use unsigned long for
> variables that are not memory addresses. If we are to convert standard
> types to kernel types how does one know the intended size of these
> variables.

Since comedi was written in 1999/2002 I guess we can safely assume
unsigned long was intended to be 32 bits. And considering that
unsigned char, short, and int are use in the same file.

> I see that the register values come from the manual
> 
> http://www.ni.com/pdf/manuals/340934b.pdf
> 
> Is the choice (size) of type in a struct (eg struct ni_private,
> comedi/drivers/ni_stc.h) a kernel design issue or is it a hardware
> issue and should I be reading the manual to find it.
> 
> thanks,
> Tobin.
> ___
> devel mailing list
> de...@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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


Re: [PATCH v4 29/36] media: imx: mipi-csi2: enable setting and getting of frame rates

2017-02-21 Thread Steve Longerbeam



On 02/21/2017 04:15 AM, Sakari Ailus wrote:

Hi Steve,

On Mon, Feb 20, 2017 at 02:56:15PM -0800, Steve Longerbeam wrote:



On 02/20/2017 02:04 PM, Sakari Ailus wrote:

Hi Steve,

On Wed, Feb 15, 2017 at 06:19:31PM -0800, Steve Longerbeam wrote:

From: Russell King 

Setting and getting frame rates is part of the negotiation mechanism
between subdevs.  The lack of support means that a frame rate at the
sensor can't be negotiated through the subdev path.


Just wondering --- what do you need this for?



Hi Sakari,

i.MX does need the ability to negotiate the frame rates in the
pipelines. The CSI has the ability to skip frames at the output,
which is something Philipp added to the CSI subdev. That affects
frame interval at the CSI output.

But as Russell pointed out, the lack of [gs]_frame_interval op
causes media-ctl to fail:

media-ctl -v -d /dev/media1 --set-v4l2
'"imx6-mipi-csi2":1[fmt:SGBRG8/512x512@1/30]'

Opening media device /dev/media1
Enumerating entities
Found 29 entities
Enumerating pads and links
Setting up format SGBRG8 512x512 on pad imx6-mipi-csi2/1
Format set: SGBRG8 512x512
Setting up frame interval 1/30 on entity imx6-mipi-csi2
Unable to set frame interval: Inappropriate ioctl for device (-25)Unable to
setup formats: Inappropriate ioctl for device (25)


So i.MX needs to implement this op in every subdev in the
pipeline, otherwise it's not possible to configure the
pipeline with media-ctl.


The frame rate is only set on the sub-device which you explicitly set it.
I.e. setting the frame rate fails if it's not supported on a pad.

Philipp recently posted patches that add frame rate propagation to
media-ctl.

Frame rate is typically settable (and gettable) only on sensor sub-device's
source pad,  which means it normally would not be propagated by the kernel
but with Philipp's patches, on the sink pad of the bus receiver. Receivers
don't have a way to control it nor they implement the IOCTLs, so that would
indeed result in an error.



Frame rate is really an essential piece of information. The spatial
dimensions and data type provided by set_fmt are really only half the
equation, the other is temporal, i.e. the data rate.

It's true that subdevices have no control over the frame rate at their
sink pads, but the same argument applies to set_fmt. Even if it has
no control over the data format it receives, it still needs that
information in order to determine the correct format at the source.
The same argument applies to frame rate.

So in my opinion, the behavior of [gs]_frame_interval should be, if a
subdevice is capable of modifying the frame rate, then it should
implement [gs]_frame_interval at _all_ of its pads, similar to set_fmt.
And frame rate should really be part of link validation the same as
set_fmt is.

Steve

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


[PATCH] staging: comedi: s626: Kernel doc format comments

2017-02-21 Thread Tobin C. Harding
Checkpatch emits WARNING: Block comments use a trailing */ on a
separate line. Offending comments are commenting variables within
the main data structure of s626 driver. We can move these comments
to kernel doc format with the benefit of clearing the warning and
improving the documentation for the driver.

Remove comments on structure members. Add original comments to the
head of the structure definition in kernel doc format.

Signed-off-by: Tobin C. Harding 
---
 drivers/staging/comedi/drivers/s626.c | 46 ---
 1 file changed, 27 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index 0dd5fe2..311bf45 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -74,26 +74,34 @@ struct s626_buffer_dma {
void *logical_base;
 };
 
+/**
+ * struct s626_private - Working data for s626 driver.
+ * @ai_cmd_running: non-zero if ai_cmd is running.
+ * @ai_sample_timer: time between samples in units of the timer.
+ * @ai_convert_count: conversion counter.
+ * @ai_convert_timer: time between conversion in units of the timer.
+ * @counter_int_enabs: counter interrupt enable mask for MISC2 register.
+ * @adc_items: number of items in ADC poll list.
+ * @rps_buf: DMA buffer used to hold ADC (RPS1) program.
+ * @ana_buf:  DMA buffer used to receive ADC data and hold DAC data.
+ * @dac_wbuf: pointer to logical adrs of DMA buffer used to hold DAC data.
+ * @dacpol: image of DAC polarity register.
+ * @trim_setpoint: images of TrimDAC setpoints.
+ * @i2c_adrs: I2C device address for onboard EEPROM (board rev dependent)
+ */
 struct s626_private {
-   u8 ai_cmd_running;  /* ai_cmd is running */
-   unsigned int ai_sample_timer;   /* time between samples in
-* units of the timer */
-   int ai_convert_count;   /* conversion counter */
-   unsigned int ai_convert_timer;  /* time between conversion in
-* units of the timer */
-   u16 counter_int_enabs;  /* counter interrupt enable mask
-* for MISC2 register */
-   u8 adc_items;   /* number of items in ADC poll list */
-   struct s626_buffer_dma rps_buf; /* DMA buffer used to hold ADC (RPS1)
-* program */
-   struct s626_buffer_dma ana_buf; /* DMA buffer used to receive ADC data
-* and hold DAC data */
-   u32 *dac_wbuf;  /* pointer to logical adrs of DMA buffer
-* used to hold DAC data */
-   u16 dacpol; /* image of DAC polarity register */
-   u8 trim_setpoint[12];   /* images of TrimDAC setpoints */
-   u32 i2c_adrs;   /* I2C device address for onboard EEPROM
-* (board rev dependent) */
+   u8 ai_cmd_running;
+   unsigned int ai_sample_timer;
+   int ai_convert_count;
+   unsigned int ai_convert_timer;
+   u16 counter_int_enabs;
+   u8 adc_items;
+   struct s626_buffer_dma rps_buf;
+   struct s626_buffer_dma ana_buf;
+   u32 *dac_wbuf;
+   u16 dacpol;
+   u8 trim_setpoint[12];
+   u32 i2c_adrs;
 };
 
 /* Counter overflow/index event flag masks for RDMISC2. */
-- 
2.7.4

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


Re: [PATCH 1/3] staging: comedi: Fix checkpatch CONST_STRUCT

2017-02-21 Thread Ian Abbott

On 21/02/17 11:18, Tobin C. Harding wrote:

Checkpatch emits WARNING: struct comedi_lrange should normally be
const.

Add const keyword to definition of struct.

Signed-off-by: Tobin C. Harding 
---
 drivers/staging/comedi/drivers/addi_apci_3501.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_3501.c 
b/drivers/staging/comedi/drivers/addi_apci_3501.c
index 57f0f46..1fdc0f8 100644
--- a/drivers/staging/comedi/drivers/addi_apci_3501.c
+++ b/drivers/staging/comedi/drivers/addi_apci_3501.c
@@ -94,7 +94,7 @@ struct apci3501_private {
unsigned char timer_mode;
 };

-static struct comedi_lrange apci3501_ao_range = {
+static const struct comedi_lrange apci3501_ao_range = {
2, {
BIP_RANGE(10),
UNI_RANGE(10)



It's mostly fine, but we prefer comedi patches that affect a single 
driver to mention the driver name on the subject line, something like


staging: comedi: addi_apci_3501: blah blah

--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4 29/36] media: imx: mipi-csi2: enable setting and getting of frame rates

2017-02-21 Thread Steve Longerbeam



On 02/21/2017 02:21 PM, Steve Longerbeam wrote:



On 02/21/2017 04:15 AM, Sakari Ailus wrote:

Hi Steve,

On Mon, Feb 20, 2017 at 02:56:15PM -0800, Steve Longerbeam wrote:



On 02/20/2017 02:04 PM, Sakari Ailus wrote:

Hi Steve,

On Wed, Feb 15, 2017 at 06:19:31PM -0800, Steve Longerbeam wrote:

From: Russell King 

Setting and getting frame rates is part of the negotiation mechanism
between subdevs.  The lack of support means that a frame rate at the
sensor can't be negotiated through the subdev path.


Just wondering --- what do you need this for?



Hi Sakari,

i.MX does need the ability to negotiate the frame rates in the
pipelines. The CSI has the ability to skip frames at the output,
which is something Philipp added to the CSI subdev. That affects
frame interval at the CSI output.

But as Russell pointed out, the lack of [gs]_frame_interval op
causes media-ctl to fail:

media-ctl -v -d /dev/media1 --set-v4l2
'"imx6-mipi-csi2":1[fmt:SGBRG8/512x512@1/30]'

Opening media device /dev/media1
Enumerating entities
Found 29 entities
Enumerating pads and links
Setting up format SGBRG8 512x512 on pad imx6-mipi-csi2/1
Format set: SGBRG8 512x512
Setting up frame interval 1/30 on entity imx6-mipi-csi2
Unable to set frame interval: Inappropriate ioctl for device
(-25)Unable to
setup formats: Inappropriate ioctl for device (25)


So i.MX needs to implement this op in every subdev in the
pipeline, otherwise it's not possible to configure the
pipeline with media-ctl.


The frame rate is only set on the sub-device which you explicitly set it.
I.e. setting the frame rate fails if it's not supported on a pad.

Philipp recently posted patches that add frame rate propagation to
media-ctl.

Frame rate is typically settable (and gettable) only on sensor
sub-device's
source pad,  which means it normally would not be propagated by the
kernel
but with Philipp's patches, on the sink pad of the bus receiver.
Receivers
don't have a way to control it nor they implement the IOCTLs, so that
would
indeed result in an error.



Frame rate is really an essential piece of information. The spatial
dimensions and data type provided by set_fmt are really only half the
equation, the other is temporal, i.e. the data rate.

It's true that subdevices have no control over the frame rate at their
sink pads, but the same argument applies to set_fmt. Even if it has
no control over the data format it receives, it still needs that
information in order to determine the correct format at the source.
The same argument applies to frame rate.

So in my opinion, the behavior of [gs]_frame_interval should be, if a
subdevice is capable of modifying the frame rate, then it should
implement [gs]_frame_interval at _all_ of its pads, similar to set_fmt.
And frame rate should really be part of link validation the same as
set_fmt is.



Actually, if frame rate were added to link validation then
[gs]_frame_interval would have to be mandatory, even if the
subdev has no control over frame rate, again this is like
set_fmt. Otherwise, if a subdev has not implemented
[gs]_frame_interval, then frame rate validation across
the whole pipeline is broken. Because, if we have

A -> B -> C

and B has not implemented [gs]_frame_interval, and C is expecting
30 fps, then pipeline validation would succeed even though A is 
outputting 60 fps.


Steve


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


Bonjour!!!

2017-02-21 Thread Rachel Thivet

Juste un coucou pour te signifier que, j aimerais  mieux te connaitre, je veux 
surtout, échanger, partager, discuter avec toi . en somme, mieux faire ta 
connaissance

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


[PATCH 3/7] staging: gdm724x: Drop useless initialisation

2017-02-21 Thread simran singhal
Removed initialisation of a varible if it is immediately reassigned.

Changes were made using Coccinelle.

@@
type T;
constant C;
expression e;
identifier i;
@@
T i
- = C
;
i = e;

Signed-off-by: simran singhal 
---
 drivers/staging/gdm724x/gdm_lte.c | 2 +-
 drivers/staging/gdm724x/gdm_mux.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/gdm724x/gdm_lte.c 
b/drivers/staging/gdm724x/gdm_lte.c
index a182757..e0f0912 100644
--- a/drivers/staging/gdm724x/gdm_lte.c
+++ b/drivers/staging/gdm724x/gdm_lte.c
@@ -353,7 +353,7 @@ static s32 gdm_lte_tx_nic_type(struct net_device *dev, 
struct sk_buff *skb)
struct ipv6hdr *ipv6;
int mac_proto;
void *network_data;
-   u32 nic_type = 0;
+   u32 nic_type;
 
/* NIC TYPE is based on the nic_id of this net_device */
nic_type = 0x0010 | nic->nic_id;
diff --git a/drivers/staging/gdm724x/gdm_mux.c 
b/drivers/staging/gdm724x/gdm_mux.c
index 4009691..aba32e2 100644
--- a/drivers/staging/gdm724x/gdm_mux.c
+++ b/drivers/staging/gdm724x/gdm_mux.c
@@ -62,7 +62,7 @@ static int packet_type_to_index(u16 packetType)
 
 static struct mux_tx *alloc_mux_tx(int len)
 {
-   struct mux_tx *t = NULL;
+   struct mux_tx *t;
 
t = kzalloc(sizeof(*t), GFP_ATOMIC);
if (!t)
@@ -91,7 +91,7 @@ static void free_mux_tx(struct mux_tx *t)
 
 static struct mux_rx *alloc_mux_rx(void)
 {
-   struct mux_rx *r = NULL;
+   struct mux_rx *r;
 
r = kzalloc(sizeof(*r), GFP_KERNEL);
if (!r)
-- 
2.7.4

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


[PATCH v3] staging: xgifb: function definition argument should also have an identifier name

2017-02-21 Thread Arushi Singhal
function definition argument like 'struct vb_device_info *','unsigned
long' etc. should also have an identifier name.

Signed-off-by: Arushi Singhal 
---
Changes in v2:
  - By mistake one irrelevant line was added which is removed in this
patch.
  - write the changes done in previous version in correct format.
---
 drivers/staging/xgifb/vb_setmode.h | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/xgifb/vb_setmode.h 
b/drivers/staging/xgifb/vb_setmode.h
index 6f082a7a5a4a..c6317ab00474 100644
--- a/drivers/staging/xgifb/vb_setmode.h
+++ b/drivers/staging/xgifb/vb_setmode.h
@@ -1,14 +1,14 @@
 #ifndef _VBSETMODE_
 #define _VBSETMODE_
 
-void InitTo330Pointer(unsigned char, struct vb_device_info *);
-void XGI_UnLockCRT2(struct vb_device_info *);
-void XGI_LockCRT2(struct vb_device_info *);
-void XGI_DisplayOff(struct xgifb_video_info *,
-   struct xgi_hw_device_info *,
-   struct vb_device_info *);
-void XGI_GetVBType(struct vb_device_info *);
-void XGI_SenseCRT1(struct vb_device_info *);
+void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo);
+void XGI_UnLockCRT2(struct vb_device_info *pVBInfo);
+void XGI_LockCRT2(struct vb_device_info *pVBInfo);
+void XGI_DisplayOff(struct xgifb_video_info *xgifb_info,
+   struct xgi_hw_device_info *pXGIHWDE,
+   struct vb_device_info *pVBInfo);
+void XGI_GetVBType(struct vb_device_info *pVBInfo);
+void XGI_SenseCRT1(struct vb_device_info *pVBInfo);
 unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
struct xgi_hw_device_info *HwDeviceExtension,
unsigned short ModeNo);
@@ -18,6 +18,6 @@ unsigned char XGI_SearchModeID(unsigned short ModeNo,
 unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE,
  unsigned short ModeNo,
  unsigned short ModeIdIndex,
- struct vb_device_info *);
+ struct vb_device_info *pVBInfo);
 
 #endif
-- 
2.11.0

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


Re: [Outreachy kernel] [PATCH] staging: xgifb: correct the multiple line dereference to fix coding stye errors

2017-02-21 Thread Joe Perches
On Wed, 2017-02-22 at 09:46 +0530, Arushi Singhal wrote:
> On Wed, Feb 22, 2017 at 12:12 AM, Joe Perches  wrote:
> 
> > On Tue, 2017-02-21 at 18:40 +0100, Julia Lawall wrote:
> > > 
> > > On Tue, 21 Feb 2017, Arushi Singhal wrote:
> > > 
> > > > Error was reported by checkpatch.pl as
> > > > WARNING: Avoid multiple line dereference...
> > > > if there is boolean operator then it is fixed by Splitting line at
> > > > boolean operator.
> > > 
> > > This is massively execeeding the 80 character boundary, and not for
> > > something trivial like a string.  Maybe the code can be reorganized in
> > > some other way.
> > 
> > The easiest way to do that is to change the test above it
> > to reduce indentation from
> > 
> > if (xgifb_info->display2 == XGIFB_DISP_TV &&
> > xgifb_info->hasVB == HASVB_301) {
> > [code...];
> > }
> > }
> > 
> > to
> > 
> > if (xgifb_info->display2 != XGIFB_DISP_TV ||
> > xgifb_in
> > fo->hasVB != HASVB_301)
> > return;
> > 
> > [code...];
> > }
> > 
> > 
> 
> Hi
> So basically you are saying that cut one word and put the other part of the
> word in the next line.

No, evolution is a horrible email client
that wraps lines oddly sometimes and sends
out different content than it displays in
its on-screen editor.

What I am saying is the block after the test
can be unindented one level by inverting the
test and using return.

It should be:

if (xgifb_info->display2 != XGIFB_DISP_TV ||
xgifb_in> > fo->hasVB != HASVB_301)
return;

[code...];

I sent you a separate attachment privately a
few hours ago but I'll attach it here too.
 drivers/staging/xgifb/XGI_main_26.c | 256 +---
 1 file changed, 92 insertions(+), 164 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index 6930f7eb741b..0df7fb2b8892 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -731,179 +731,107 @@ static void XGIfb_post_setmode(struct xgifb_video_info *xgifb_info)
 
 	xgifb_reg_and(XGISR, IND_SIS_RAMDAC_CONTROL, ~0x04);
 
-	if (xgifb_info->display2 == XGIFB_DISP_TV &&
-	xgifb_info->hasVB == HASVB_301) {
-		reg = xgifb_reg_get(XGIPART4, 0x01);
+	if (xgifb_info->display2 != XGIFB_DISP_TV ||
+	xgifb_info->hasVB != HASVB_301)
+		return;
 
-		if (reg < 0xB0) { /* Set filter for XGI301 */
-			int filter_tb;
+	reg = xgifb_reg_get(XGIPART4, 0x01);
+	if (reg < 0xB0) { /* Set filter for XGI301 */
+		int filter_tb;
 
-			switch (xgifb_info->video_width) {
-			case 320:
-filter_tb = (xgifb_info->TV_type ==
-	 TVMODE_NTSC) ? 4 : 12;
-break;
-			case 640:
-filter_tb = (xgifb_info->TV_type ==
-	 TVMODE_NTSC) ? 5 : 13;
-break;
-			case 720:
-filter_tb = (xgifb_info->TV_type ==
-	 TVMODE_NTSC) ? 6 : 14;
-break;
-			case 800:
-filter_tb = (xgifb_info->TV_type ==
-	 TVMODE_NTSC) ? 7 : 15;
-break;
-			default:
-filter_tb = 0;
-filter = -1;
-break;
-			}
-			xgifb_reg_or(XGIPART1,
- SIS_CRT2_WENABLE_315,
- 0x01);
+		switch (xgifb_info->video_width) {
+		case 320:
+			filter_tb = xgifb_info->TV_type == TVMODE_NTSC ? 4 : 12;
+			break;
+		case 640:
+			filter_tb = xgifb_info->TV_type == TVMODE_NTSC ? 5 : 13;
+			break;
+		case 720:
+			filter_tb = xgifb_info->TV_type == TVMODE_NTSC ? 6 : 14;
+			break;
+		case 800:
+			filter_tb = xgifb_info->TV_type == TVMODE_NTSC ? 7 : 15;
+			break;
+		default:
+			filter_tb = 0;
+			filter = -1;
+			break;
+		}
+		xgifb_reg_or(XGIPART1, SIS_CRT2_WENABLE_315, 0x01);
 
-			if (xgifb_info->TV_type == TVMODE_NTSC) {
-xgifb_reg_and(XGIPART2, 0x3a, 0x1f);
-
-if (xgifb_info->TV_plug == TVPLUG_SVIDEO) {
-	xgifb_reg_and(XGIPART2, 0x30, 0xdf);
-
-} else if (xgifb_info->TV_plug
-		== TVPLUG_COMPOSITE) {
-	xgifb_reg_or(XGIPART2, 0x30, 0x20);
-
-	switch (xgifb_info->video_width) {
-	case 640:
-		xgifb_reg_set(XGIPART2,
-			  0x35,
-			  0xEB);
-		xgifb_reg_set(XGIPART2,
-			  0x36,
-			  0x04);
-		xgifb_reg_set(XGIPART2,
-			  0x37,
-			  0x25);
-		xgifb_reg_set(XGIPART2,
-			  0x38,
-			  0x18);
-		break;
-	case 720:
-		xgifb_reg_set(XGIPART2,
-			  0x35,
-			  0xEE);
-		xgifb_reg_set(XGIPART2,
-			  0x36,
-			  0x0C);
-		xgifb_reg_set(XGIPART2,
-			  0x37,
-			  0x22);
-		xgifb_reg_set(XGIPART2,
-			  0x38,
-			  0x08);
-		break;
-	case 800:
-		xgifb_reg_set(XGIPART2,
-			  0x35,
-			  0xEB);
-		xgifb_reg_set(XGIPART2,
-			  0x36,
-			  0x15);
-		xgifb_reg_set(XGIPART2,
-			  0x37,
-			  0x25);
-		xgifb_reg_set(XGIPART2,
-			  0x38,
-			  0xF6);
-		break;
-	}
-}
+		if (xgif

[PATCH] staging: wilc1000: renames struct tstrRSSI and its members u8Index, u8Full

2017-02-21 Thread Tahia Khan
Fixes multiple camel case checks on struct tstrRSSI from checkpatch.pl:

Avoid CamelCase: 
Avoid CamelCase: 
Avoid CamelCase: 

Signed-off-by: Tahia Khan 
---
 drivers/staging/wilc1000/coreconfigurator.h   |  8 
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 10 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index cff1698..c9cf23b 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -70,9 +70,9 @@ enum connect_status {
CONNECT_STS_FORCE_16_BIT = 0x
 };
 
-struct tstrRSSI {
-   u8 u8Full;
-   u8 u8Index;
+struct tstr_RSSI {
+   u8 u8_full;
+   u8 u8_index;
s8 as8RSSI[NUM_RSSI];
 };
 
@@ -93,7 +93,7 @@ struct network_info {
u8 *ies;
u16 ies_len;
void *join_params;
-   struct tstrRSSI str_rssi;
+   struct tstr_RSSI str_rssi;
u64 tsf_hi;
 };
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index f7ce47c..30285b9 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -205,8 +205,8 @@ static u32 get_rssi_avg(struct network_info *network_info)
 {
u8 i;
int rssi_v = 0;
-   u8 num_rssi = (network_info->str_rssi.u8Full) ?
-  NUM_RSSI : (network_info->str_rssi.u8Index);
+   u8 num_rssi = (network_info->str_rssi.u8_full) ?
+  NUM_RSSI : (network_info->str_rssi.u8_index);
 
for (i = 0; i < num_rssi; i++)
rssi_v += network_info->str_rssi.as8RSSI[i];
@@ -346,13 +346,13 @@ static void add_network_to_shadow(struct network_info 
*pstrNetworkInfo,
} else {
ap_index = ap_found;
}
-   rssi_index = last_scanned_shadow[ap_index].str_rssi.u8Index;
+   rssi_index = last_scanned_shadow[ap_index].str_rssi.u8_index;
last_scanned_shadow[ap_index].str_rssi.as8RSSI[rssi_index++] = 
pstrNetworkInfo->rssi;
if (rssi_index == NUM_RSSI) {
rssi_index = 0;
-   last_scanned_shadow[ap_index].str_rssi.u8Full = 1;
+   last_scanned_shadow[ap_index].str_rssi.u8_full = 1;
}
-   last_scanned_shadow[ap_index].str_rssi.u8Index = rssi_index;
+   last_scanned_shadow[ap_index].str_rssi.u8_index = rssi_index;
last_scanned_shadow[ap_index].rssi = pstrNetworkInfo->rssi;
last_scanned_shadow[ap_index].cap_info = pstrNetworkInfo->cap_info;
last_scanned_shadow[ap_index].ssid_len = pstrNetworkInfo->ssid_len;
-- 
2.7.4

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


Re: [Outreachy kernel] [PATCH] staging: wilc1000: renames struct tstrRSSI and its members u8Index, u8Full

2017-02-21 Thread Julia Lawall


On Tue, 21 Feb 2017, Tahia Khan wrote:

> Fixes multiple camel case checks on struct tstrRSSI from checkpatch.pl:
>
> Avoid CamelCase: 
> Avoid CamelCase: 
> Avoid CamelCase: 
>
> Signed-off-by: Tahia Khan 
> ---
>  drivers/staging/wilc1000/coreconfigurator.h   |  8 
>  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 10 +-
>  2 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
> b/drivers/staging/wilc1000/coreconfigurator.h
> index cff1698..c9cf23b 100644
> --- a/drivers/staging/wilc1000/coreconfigurator.h
> +++ b/drivers/staging/wilc1000/coreconfigurator.h
> @@ -70,9 +70,9 @@ enum connect_status {
>   CONNECT_STS_FORCE_16_BIT = 0x
>  };
>
> -struct tstrRSSI {
> - u8 u8Full;
> - u8 u8Index;
> +struct tstr_RSSI {
> + u8 u8_full;
> + u8 u8_index;

The kernel doesn't use variable names that incorporate types.  These could
just be full and index.

julia

>   s8 as8RSSI[NUM_RSSI];
>  };
>
> @@ -93,7 +93,7 @@ struct network_info {
>   u8 *ies;
>   u16 ies_len;
>   void *join_params;
> - struct tstrRSSI str_rssi;
> + struct tstr_RSSI str_rssi;
>   u64 tsf_hi;
>  };
>
> diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
> b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> index f7ce47c..30285b9 100644
> --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> @@ -205,8 +205,8 @@ static u32 get_rssi_avg(struct network_info *network_info)
>  {
>   u8 i;
>   int rssi_v = 0;
> - u8 num_rssi = (network_info->str_rssi.u8Full) ?
> -NUM_RSSI : (network_info->str_rssi.u8Index);
> + u8 num_rssi = (network_info->str_rssi.u8_full) ?
> +NUM_RSSI : (network_info->str_rssi.u8_index);
>
>   for (i = 0; i < num_rssi; i++)
>   rssi_v += network_info->str_rssi.as8RSSI[i];
> @@ -346,13 +346,13 @@ static void add_network_to_shadow(struct network_info 
> *pstrNetworkInfo,
>   } else {
>   ap_index = ap_found;
>   }
> - rssi_index = last_scanned_shadow[ap_index].str_rssi.u8Index;
> + rssi_index = last_scanned_shadow[ap_index].str_rssi.u8_index;
>   last_scanned_shadow[ap_index].str_rssi.as8RSSI[rssi_index++] = 
> pstrNetworkInfo->rssi;
>   if (rssi_index == NUM_RSSI) {
>   rssi_index = 0;
> - last_scanned_shadow[ap_index].str_rssi.u8Full = 1;
> + last_scanned_shadow[ap_index].str_rssi.u8_full = 1;
>   }
> - last_scanned_shadow[ap_index].str_rssi.u8Index = rssi_index;
> + last_scanned_shadow[ap_index].str_rssi.u8_index = rssi_index;
>   last_scanned_shadow[ap_index].rssi = pstrNetworkInfo->rssi;
>   last_scanned_shadow[ap_index].cap_info = pstrNetworkInfo->cap_info;
>   last_scanned_shadow[ap_index].ssid_len = pstrNetworkInfo->ssid_len;
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/20170222045543.GA27847%40coolbox.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[no subject]

2017-02-21 Thread Pranay Kr. Srivastava

Sending both patches as series instead. Made the required changes as
suggessted in earlier versions and fixed the warnings reported from
kbuild test robot.

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


[PATCH-SPEAKUP 2/2] remove unecessary initial allocation of vc

2017-02-21 Thread Pranay Kr. Srivastava
This patch removes the unnecessary allocation of
current foreground vc during initialization.

This initialization is already handled in the loop
that follows it for all available virtual consoles.

Also change the prototype of speakup_allocate to take
extra argument of gfp_* flags. Thus not requiring
GFP_ATOMIC during initialization.

Signed-off-by: Pranay Kr. Srivastava 
---
 drivers/staging/speakup/main.c | 19 ---
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index 6667cf2..f81a936 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1327,14 +1327,14 @@ static int edit_bits(struct vc_data *vc, u_char type, 
u_char ch, u_short key)
 }
 
 /* Allocation concurrency is protected by the console semaphore */
-static int speakup_allocate(struct vc_data *vc)
+static int speakup_allocate(struct vc_data *vc, gfp_t gfp_flags)
 {
int vc_num;
 
vc_num = vc->vc_num;
if (speakup_console[vc_num] == NULL) {
speakup_console[vc_num] = kzalloc(sizeof(*speakup_console[0]),
- GFP_ATOMIC);
+ gfp_flags);
if (speakup_console[vc_num] == NULL)
return -ENOMEM;
speakup_date(vc);
@@ -2257,7 +2257,7 @@ static int vt_notifier_call(struct notifier_block *nb,
switch (code) {
case VT_ALLOCATE:
if (vc->vc_mode == KD_TEXT)
-   speakup_allocate(vc);
+   speakup_allocate(vc, GFP_ATOMIC);
break;
case VT_DEALLOCATE:
speakup_deallocate(vc);
@@ -2317,7 +2317,6 @@ static int __init speakup_init(void)
 {
int i;
long err = 0;
-   struct st_spk_t *first_console;
struct vc_data *vc = vc_cons[fg_console].d;
struct var_t *var;
 
@@ -2342,18 +2341,9 @@ static int __init speakup_init(void)
if (err)
goto error_virtkeyboard;
 
-   first_console = kzalloc(sizeof(*first_console), GFP_KERNEL);
-   if (!first_console) {
-   err = -ENOMEM;
-   goto error_alloc;
-   }
-
-   speakup_console[vc->vc_num] = first_console;
-   speakup_date(vc);
-
for (i = 0; i < MAX_NR_CONSOLES; i++)
if (vc_cons[i].d) {
-   err = speakup_allocate(vc_cons[i].d);
+   err = speakup_allocate(vc_cons[i].d, GFP_KERNEL);
if (err)
goto error_kobjects;
}
@@ -2412,7 +2402,6 @@ static int __init speakup_init(void)
for (i = 0; i < MAX_NR_CONSOLES; i++)
kfree(speakup_console[i]);
 
-error_alloc:
speakup_remove_virtual_keyboard();
 
 error_virtkeyboard:
-- 
2.10.2

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


[PATCH-SPEAKUP 1/2] return same error value from spk_set_key_info

2017-02-21 Thread Pranay Kr. Srivastava
This patch makes spk_set_key_info return -EINVAL
in case of failure instead of returning 4 different
values for the type of error that occurred.

Print the offending values instead as debug message.

Signed-off-by: Pranay Kr. Srivastava 
---
 drivers/staging/speakup/main.c | 27 +++
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index c2f70ef..6667cf2 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1216,13 +1216,19 @@ int spk_set_key_info(const u_char *key_info, u_char 
*k_buffer)
u_char ch, version, num_keys;
 
version = *cp++;
-   if (version != KEY_MAP_VER)
-   return -1;
+   if (version != KEY_MAP_VER) {
+   pr_debug("version found %d should be %d\n",
+version, KEY_MAP_VER);
+   return -EINVAL;
+   }
num_keys = *cp;
states = (int)cp[1];
key_data_len = (states + 1) * (num_keys + 1);
-   if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(spk_key_buf))
-   return -2;
+   if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(spk_key_buf)) {
+   pr_debug("too many key_infos (%d over %lu)\n",
+key_data_len + SHIFT_TBL_SIZE + 4, 
sizeof(spk_key_buf));
+   return -EINVAL;
+   }
memset(k_buffer, 0, SHIFT_TBL_SIZE);
memset(spk_our_keys, 0, sizeof(spk_our_keys));
spk_shift_table = k_buffer;
@@ -1233,14 +1239,19 @@ int spk_set_key_info(const u_char *key_info, u_char 
*k_buffer)
cp1 += 2;   /* now pointing at shift states */
for (i = 1; i <= states; i++) {
ch = *cp1++;
-   if (ch >= SHIFT_TBL_SIZE)
-   return -3;
+   if (ch >= SHIFT_TBL_SIZE) {
+   pr_debug("(%d) not valid shift state (max_allowed = 
%d)\n", ch,
+SHIFT_TBL_SIZE);
+   return -EINVAL;
+   }
spk_shift_table[ch] = i;
}
keymap_flags = *cp1++;
while ((ch = *cp1)) {
-   if (ch >= MAX_KEY)
-   return -4;
+   if (ch >= MAX_KEY) {
+   pr_debug("(%d), not valid key, (max_allowed = %d)\n", 
ch, MAX_KEY);
+   return -EINVAL;
+   }
spk_our_keys[ch] = cp1;
cp1 += states + 1;
}
-- 
2.10.2

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


  1   2   >