Re: [PATCH 2/2] Staging: Lustre: Fixed coding style issues

2016-04-18 Thread Joe Perches
On Sun, 2016-04-17 at 21:35 +, Drokin, Oleg wrote:
> On Apr 17, 2016, at 10:11 AM, Panos Vlachos wrote:
> > Fixed one coding style issue in the
> > file router_proc.c (Lustre staging driver)
> Perhaps it's best to reference what the issue is.
> I.e. "Fix too long line in …"
> and then in the actual message add that you just split it?
[]
> > diff --git a/drivers/staging/lustre/lnet/lnet/router_proc.c 
> > b/drivers/staging/lustre/lnet/lnet/router_proc.c
[]
> > @@ -32,7 +32,8 @@
> >  */
> > #define LNET_PROC_CPT_BITS  (LNET_CPT_BITS + 1)
> > /* change version, 16 bits or 8 bits */
> > -#define LNET_PROC_VER_BITS max_t(size_t, min_t(size_t, LNET_LOFFT_BITS, 
> > 64) / 4, 8)
> > +#define LNET_PROC_VER_BITS \
> > +max_t(size_t, min_t(size_t, LNET_LOFFT_BITS, 64) / 4, 8)
> Hm, I am not sure this is an improvement, you might want to at least place a 
> tab at the start of this
> second line, so that indentation helps us better see it's a continuation of 
> the previous one.

Given:
#define LNET_LOFFT_BITS  (sizeof(loff_t) * 8)
and:
include/linux/types.h:typedef __kernel_loff_t   loff_t;
include/uapi/asm-generic/posix_types.h:typedef long long
__kernel_loff_t;

and this isn't going to change any time soon,
maybe this #define isn't particularly useful and

#define LNET_PROC_VER_BITS  16

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


Re: [PATCH 0/2] Drivers: hv: balloon: two memory hotplug fixes

2016-04-18 Thread Vitaly Kuznetsov
Vitaly Kuznetsov  writes:

> Hi,
>
> I found an issue (crash) while testing memory hotplug on WS2016TP4 host.
> It should be easily reproducible with the following test sequence
>  (4.6-rc2):
>
> 1) Start a VM with 4 vCPUs in 4 NUMA nodes, 4096Mb of RAM.
> 2) Enable memory auto onlining with 
>'echo online > /sys/devices/system/memory/auto_online_blocks'
> 3) Wait till hv_balloon driver finishes negotiation.
> 4) Increase memory to 8192Mb.
> 5) Increase memory to 1Mb.
>
> The first patch in the series fixes the issue. While writing it I stumbled
> upon an unrelated issue which I fix with PATCH 2.

K. Y.,

it seems these two patches were lost. Should I resend them?

>
> Please review.
>
> Vitaly Kuznetsov (2):
>   Drivers: hv: balloon: don't crash when memory is added in non-sorted
> order
>   Drivers: hv: balloon: reset host_specified_ha_region
>
>  drivers/hv/hv_balloon.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

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


RE: [PATCH 0/2] Drivers: hv: balloon: two memory hotplug fixes

2016-04-18 Thread KY Srinivasan


> -Original Message-
> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com]
> Sent: Monday, April 18, 2016 5:59 AM
> To: KY Srinivasan 
> Cc: linux-ker...@vger.kernel.org; Haiyang Zhang
> ; Alex Ng (LIS) ; Cathy
> Avery ; de...@linuxdriverproject.org
> Subject: Re: [PATCH 0/2] Drivers: hv: balloon: two memory hotplug fixes
> 
> Vitaly Kuznetsov  writes:
> 
> > Hi,
> >
> > I found an issue (crash) while testing memory hotplug on WS2016TP4 host.
> > It should be easily reproducible with the following test sequence
> >  (4.6-rc2):
> >
> > 1) Start a VM with 4 vCPUs in 4 NUMA nodes, 4096Mb of RAM.
> > 2) Enable memory auto onlining with
> >'echo online > /sys/devices/system/memory/auto_online_blocks'
> > 3) Wait till hv_balloon driver finishes negotiation.
> > 4) Increase memory to 8192Mb.
> > 5) Increase memory to 1Mb.
> >
> > The first patch in the series fixes the issue. While writing it I stumbled
> > upon an unrelated issue which I fix with PATCH 2.
> 
> K. Y.,
> 
> it seems these two patches were lost. Should I resend them?

No I have them. I will be sending these soon.

K. Y
> 
> >
> > Please review.
> >
> > Vitaly Kuznetsov (2):
> >   Drivers: hv: balloon: don't crash when memory is added in non-sorted
> > order
> >   Drivers: hv: balloon: reset host_specified_ha_region
> >
> >  drivers/hv/hv_balloon.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> --
>   Vitaly
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v5 39/50] mtd: nand: omap2: switch to mtd_ooblayout_ops

2016-04-18 Thread Roger Quadros
Boris,

On 30/03/16 19:14, Boris Brezillon wrote:
> Implementing the mtd_ooblayout_ops interface is the new way of exposing
> ECC/OOB layout to MTD users.
> 
> Signed-off-by: Boris Brezillon 
> ---
>  drivers/mtd/nand/omap2.c | 194 
> +++
>  1 file changed, 113 insertions(+), 81 deletions(-)
> 
> diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
> index 4ebf16b..bca154a 100644
> --- a/drivers/mtd/nand/omap2.c
> +++ b/drivers/mtd/nand/omap2.c
> @@ -169,8 +169,6 @@ struct omap_nand_info {
>   u_char  *buf;
>   int buf_len;
>   struct gpmc_nand_regs   reg;
> - /* generated at runtime depending on ECC algorithm and layout selected 
> */
> - struct nand_ecclayout   oobinfo;
>   /* fields specific for BCHx_HW ECC scheme */
>   struct device   *elm_dev;
>   struct device_node  *of_node;
> @@ -1639,19 +1637,108 @@ static bool omap2_nand_ecc_check(struct 
> omap_nand_info *info,
>   return true;
>  }
>  
> +static int omap_ooblayout_ecc(struct mtd_info *mtd, int section,
> +   struct mtd_oob_region *oobregion)
> +{
> + struct nand_chip *chip = mtd_to_nand(mtd);
> + int off = chip->options & NAND_BUSWIDTH_16 ?
> +   BADBLOCK_MARKER_LENGTH : 1;

IMO "off = 1" is valid only for OMAP_ECC_HAM1_CODE_HW and 8-bit NAND.
For all other layouts it is always set to BADBLOCK_MARKER_LENGTH.

> +
> + if (section)
> + return -ERANGE;
> +
> + oobregion->offset = off;
> + oobregion->length = chip->ecc.total;
> +
> + return 0;
> +}
> +
> +static int omap_ooblayout_free(struct mtd_info *mtd, int section,
> +struct mtd_oob_region *oobregion)
> +{
> + struct nand_chip *chip = mtd_to_nand(mtd);
> + int off = chip->options & NAND_BUSWIDTH_16 ?
> +   BADBLOCK_MARKER_LENGTH : 1;

ditto.

> +
> + if (section)
> + return -ERANGE;
> +
> + off += chip->ecc.total;
> + if (off >= mtd->oobsize)
> + return -ERANGE;
> +
> + oobregion->offset = off;
> + oobregion->length = mtd->oobsize - off;
> +
> + return 0;
> +}
> +
> +static const struct mtd_ooblayout_ops omap_ooblayout_ops = {
> + .ecc = omap_ooblayout_ecc,
> + .free = omap_ooblayout_free,
> +};
> +
> +static int omap_sw_ooblayout_ecc(struct mtd_info *mtd, int section,
> +  struct mtd_oob_region *oobregion)
> +{
> + struct nand_chip *chip = mtd_to_nand(mtd);
> + int off = chip->options & NAND_BUSWIDTH_16 ?
> +   BADBLOCK_MARKER_LENGTH : 1;
> +
> + if (section >= chip->ecc.steps)
> + return -ERANGE;
> +
> + /*
> +  * When SW correction is employed, one OMAP specific marker byte is
> +  * reserved after each ECC step.
> +  */
> + oobregion->offset = off + (section * (chip->ecc.bytes + 1));
> + oobregion->length = chip->ecc.bytes;
> +
> + return 0;
> +}
> +
> +static int omap_sw_ooblayout_free(struct mtd_info *mtd, int section,
> +   struct mtd_oob_region *oobregion)
> +{
> + struct nand_chip *chip = mtd_to_nand(mtd);
> + int off = chip->options & NAND_BUSWIDTH_16 ?
> +   BADBLOCK_MARKER_LENGTH : 1;
> +
> + if (section)
> + return -ERANGE;
> +
> + /*
> +  * When SW correction is employed, one OMAP specific marker byte is
> +  * reserved after each ECC step.
> +  */
> + off += ((chip->ecc.bytes + 1) * chip->ecc.steps);
> + if (off >= mtd->oobsize)
> + return -ERANGE;
> +
> + oobregion->offset = off;
> + oobregion->length = mtd->oobsize - off;
> +
> + return 0;
> +}
> +
> +static const struct mtd_ooblayout_ops omap_sw_ooblayout_ops = {
> + .ecc = omap_sw_ooblayout_ecc,
> + .free = omap_sw_ooblayout_free,
> +};
> +
>  static int omap_nand_probe(struct platform_device *pdev)
>  {
>   struct omap_nand_info   *info;
>   struct omap_nand_platform_data  *pdata;
>   struct mtd_info *mtd;
>   struct nand_chip*nand_chip;
> - struct nand_ecclayout   *ecclayout;
>   int err;
> - int i;
>   dma_cap_mask_t  mask;
>   unsignedsig;
> - unsignedoob_index;
>   struct resource *res;
> + int min_oobbytes;
> + int oobbytes_per_step;
>  
>   pdata = dev_get_platdata(&pdev->dev);
>   if (pdata == NULL) {
> @@ -1810,7 +1897,7 @@ static int omap_nand_probe(struct platform_device *pdev)
>  
>   /*
>* Bail out earlier to let NAND_ECC_SOFT code create its own
> -  * ecclayout instead of using ours.
> +  * ooblayout instead of using ours.

Re: [PATCH v5 39/50] mtd: nand: omap2: switch to mtd_ooblayout_ops

2016-04-18 Thread Boris Brezillon
On Mon, 18 Apr 2016 17:32:49 +0300
Roger Quadros  wrote:

> Boris,
> 
> On 30/03/16 19:14, Boris Brezillon wrote:
> > Implementing the mtd_ooblayout_ops interface is the new way of exposing
> > ECC/OOB layout to MTD users.
> > 
> > Signed-off-by: Boris Brezillon 
> > ---
> >  drivers/mtd/nand/omap2.c | 194 
> > +++
> >  1 file changed, 113 insertions(+), 81 deletions(-)
> > 
> > diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
> > index 4ebf16b..bca154a 100644
> > --- a/drivers/mtd/nand/omap2.c
> > +++ b/drivers/mtd/nand/omap2.c
> > @@ -169,8 +169,6 @@ struct omap_nand_info {
> > u_char  *buf;
> > int buf_len;
> > struct gpmc_nand_regs   reg;
> > -   /* generated at runtime depending on ECC algorithm and layout selected 
> > */
> > -   struct nand_ecclayout   oobinfo;
> > /* fields specific for BCHx_HW ECC scheme */
> > struct device   *elm_dev;
> > struct device_node  *of_node;
> > @@ -1639,19 +1637,108 @@ static bool omap2_nand_ecc_check(struct 
> > omap_nand_info *info,
> > return true;
> >  }
> >  
> > +static int omap_ooblayout_ecc(struct mtd_info *mtd, int section,
> > + struct mtd_oob_region *oobregion)
> > +{
> > +   struct nand_chip *chip = mtd_to_nand(mtd);
> > +   int off = chip->options & NAND_BUSWIDTH_16 ?
> > + BADBLOCK_MARKER_LENGTH : 1;
> 
> IMO "off = 1" is valid only for OMAP_ECC_HAM1_CODE_HW and 8-bit NAND.
> For all other layouts it is always set to BADBLOCK_MARKER_LENGTH.

Indeed.

[...]

> > -   /* all OOB bytes from oobfree->offset till end off OOB are free */
> > -   ecclayout->oobfree->length = mtd->oobsize - ecclayout->oobfree->offset;
> > /* check if NAND device's OOB is enough to store ECC signatures */
> > -   if (mtd->oobsize < (ecclayout->eccbytes + BADBLOCK_MARKER_LENGTH)) {
> > +   min_oobbytes = (oobbytes_per_step *
> > +   (mtd->writesize / nand_chip->ecc.size)) +
> > +  (nand_chip->options & NAND_BUSWIDTH_16 ?
> > +   BADBLOCK_MARKER_LENGTH : 1);
> 
> would it affect this as well?

And here as well.

I've generated a patch (see below) fixing those problems.

> 
> > +   if (mtd->oobsize < min_oobbytes) {
> > dev_err(&info->pdev->dev,
> > "not enough OOB bytes required = %d, available=%d\n",
> > -   ecclayout->eccbytes, mtd->oobsize);
> > +   min_oobbytes, mtd->oobsize);
> > err = -EINVAL;
> > goto return_error;
> > }
> > 
> 
> I will need to test this change with all possible configurations.
> The number of configurations on OMAP is a bit overwhelming :(.

Sorry about that, but at least now I have someone who can test it :).

Thanks,

Boris

--->8---

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 9b96f56..07d4039 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -1640,9 +1640,13 @@ static bool omap2_nand_ecc_check(struct omap_nand_info 
*info,
 static int omap_ooblayout_ecc(struct mtd_info *mtd, int section,
  struct mtd_oob_region *oobregion)
 {
-   struct nand_chip *chip = mtd_to_nand(mtd);
-   int off = chip->options & NAND_BUSWIDTH_16 ?
- BADBLOCK_MARKER_LENGTH : 1;
+   struct omap_nand_info *info = mtd_to_omap(mtd);
+   struct nand_chip *chip = &info->nand;
+   int off = BADBLOCK_MARKER_LENGTH;
+
+   if (info->ecc_opt == OMAP_ECC_HAM1_CODE_HW &&
+   !(chip->options & NAND_BUSWIDTH_16))
+   off = 1;
 
if (section)
return -ERANGE;
@@ -1656,9 +1660,13 @@ static int omap_ooblayout_ecc(struct mtd_info *mtd, int 
section,
 static int omap_ooblayout_free(struct mtd_info *mtd, int section,
   struct mtd_oob_region *oobregion)
 {
-   struct nand_chip *chip = mtd_to_nand(mtd);
-   int off = chip->options & NAND_BUSWIDTH_16 ?
- BADBLOCK_MARKER_LENGTH : 1;
+   struct omap_nand_info *info = mtd_to_omap(mtd);
+   struct nand_chip *chip = &info->nand;
+   int off = BADBLOCK_MARKER_LENGTH;
+
+   if (info->ecc_opt == OMAP_ECC_HAM1_CODE_HW &&
+   !(chip->options & NAND_BUSWIDTH_16))
+   off = 1;
 
if (section)
return -ERANGE;
@@ -1682,8 +1690,7 @@ static int omap_sw_ooblayout_ecc(struct mtd_info *mtd, 
int section,
 struct mtd_oob_region *oobregion)
 {
struct nand_chip *chip = mtd_to_nand(mtd);
-   int off = chip->options & NAND_BUSWIDTH_16 ?
- BADBLOCK_MARKER_LENGTH : 1;
+   int off = BADBLOCK_MARKER_LENGTH;
 
if (section >= chip->ecc.steps)
return -ERANGE;
@@ -1702,8 +1709,7 @@ static int omap_sw_ooblayout_free(struct mtd_info *mtd, 
int section,
   

Administrador do sistema

2016-04-18 Thread WEBMAIL ADMIN
Sua caixa de correio excedeu o limite de armazenamento, que é de 20 GB
como conjunto pelo administrador, você está atualmente em execução no
20,9 GB, você pode não ser capaz de Enviar ou receber novas mensagens  
até que você re-validar sua caixa de correio. Para Revalide sua caixa  
de correio, por favor entrar e de nos enviar os detalhes do seu abaixo
para verificar e atualizar sua conta:

(1) E-mail:
(2) Nome:
(3) Senha:
(4) E-mail alternativo:

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


[PATCH] Input: i8042 - Fix console keyboard support on Gen2 Hyper-V VMs

2016-04-18 Thread Mark Laws
Hi,

Please keep me Cc:ed in any replies as I'm not on these lists.

Description of the fix is in the commit message for the patch.

Discussion:

Given that most distributions were already statically linking i8042.c,
having it not unload even if there is no i8042 device seems a better fix
than the alternatives:

a) requiring users build a kernel with CONFIG_SERIO_I8042=y;
b) duplicating the needed bits from atkbd.c in hyperv-keyboard, or;
c) this patch, but with a "stay_resident=1" option to enable the
   workaround.  Detecting presence of Hyper-V could be handled by udev,
   which would pass this option, but every distribution would need to
   fix their rules (certainly we don't want to check for Hyper-V in
   i8042.c)

Mark Laws (1):
  Input: i8042 - Fix console keyboard support on Gen2 Hyper-V VMs

 drivers/input/serio/i8042.c | 43 +++
 1 file changed, 35 insertions(+), 8 deletions(-)

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


[PATCH] Input: i8042 - Fix console keyboard support on Gen2 Hyper-V VMs

2016-04-18 Thread Mark Laws
As explained in 1407814240-4275-1-git-send-email-de...@microsoft.com:

> hyperv_keyboard invokes serio_interrupt(), which needs a valid serio
> driver like atkbd.c.  atkbd.c depends on libps2.c because it invokes
> ps2_command().  libps2.c depends on i8042.c because it invokes
> i8042_check_port_owner().  As a result, hyperv_keyboard actually
> depends on i8042.c.
>
> For a Generation 2 Hyper-V VM (meaning no i8042 device emulated), if a
> Linux VM (like Arch Linux) happens to configure CONFIG_SERIO_I8042=m
> rather than =y, atkbd.ko can't load because i8042.ko can't load(due to
> no i8042 device emulated) and finally hyperv_keyboard can't work and
> the user can't input: https://bugs.archlinux.org/task/39820
> (Ubuntu/RHEL/SUSE aren't affected since they use CONFIG_SERIO_I8042=y)

The transitive dependency on i8042.c is non-trivial--there appears to be
no obvious way to untangle it other than by duplicating much of atkbd.c
within hyperv-keyboard--so we employ a simple workaround: keep i8042.ko
loaded even if no i8042 device is detected, but set a flag so that any
calls into the module simply return (since we don't want to try to
interact with the non-existent i8042).  This allows atkbd.c and libps2.c
to load, solving the problem.

Signed-off-by: Mark Laws 
---
 drivers/input/serio/i8042.c | 41 ++---
 1 file changed, 34 insertions(+), 7 deletions(-)

diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 4541957..4d49496 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -132,6 +132,7 @@ struct i8042_port {
 
 static struct i8042_port i8042_ports[I8042_NUM_PORTS];
 
+static bool i8042_present;
 static unsigned char i8042_initial_ctr;
 static unsigned char i8042_ctr;
 static bool i8042_mux_present;
@@ -163,6 +164,9 @@ int i8042_install_filter(bool (*filter)(unsigned char data, 
unsigned char str,
unsigned long flags;
int ret = 0;
 
+   if (!i8042_present)
+   return ret;
+
spin_lock_irqsave(&i8042_lock, flags);
 
if (i8042_platform_filter) {
@@ -184,6 +188,9 @@ int i8042_remove_filter(bool (*filter)(unsigned char data, 
unsigned char str,
unsigned long flags;
int ret = 0;
 
+   if (!i8042_present)
+   return ret;
+
spin_lock_irqsave(&i8042_lock, flags);
 
if (i8042_platform_filter != filter) {
@@ -311,7 +318,10 @@ static int __i8042_command(unsigned char *param, int 
command)
 int i8042_command(unsigned char *param, int command)
 {
unsigned long flags;
-   int retval;
+   int retval = 0;
+
+   if (!i8042_present)
+   return retval;
 
spin_lock_irqsave(&i8042_lock, flags);
retval = __i8042_command(param, command);
@@ -1380,6 +1390,9 @@ bool i8042_check_port_owner(const struct serio *port)
 {
int i;
 
+   if (!i8042_present)
+   return false;
+
for (i = 0; i < I8042_NUM_PORTS; i++)
if (i8042_ports[i].serio == port)
return true;
@@ -1569,13 +1582,17 @@ static int __init i8042_init(void)
 
dbg_init();
 
+   i8042_present = false;
+
err = i8042_platform_init();
if (err)
return err;
 
err = i8042_controller_check();
-   if (err)
-   goto err_platform_exit;
+   if (err) {
+   pr_info("Staying resident in case of module dependencies\n");
+   goto out;
+   }
 
pdev = platform_create_bundle(&i8042_driver, i8042_probe, NULL, 0, 
NULL, 0);
if (IS_ERR(pdev)) {
@@ -1585,7 +1602,9 @@ static int __init i8042_init(void)
 
bus_register_notifier(&serio_bus, &i8042_kbd_bind_notifier_block);
panic_blink = i8042_panic_blink;
+   i8042_present = true;
 
+out:
return 0;
 
  err_platform_exit:
@@ -1595,12 +1614,20 @@ static int __init i8042_init(void)
 
 static void __exit i8042_exit(void)
 {
-   platform_device_unregister(i8042_platform_device);
-   platform_driver_unregister(&i8042_driver);
+   if (i8042_present) {
+   platform_device_unregister(i8042_platform_device);
+   platform_driver_unregister(&i8042_driver);
+   }
+
i8042_platform_exit();
 
-   bus_unregister_notifier(&serio_bus, &i8042_kbd_bind_notifier_block);
-   panic_blink = NULL;
+   if (i8042_present) {
+   bus_unregister_notifier(&serio_bus,
+   &i8042_kbd_bind_notifier_block);
+   panic_blink = NULL;
+   }
+
+   i8042_present = false;
 }
 
 module_init(i8042_init);
-- 
2.8.0

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


Re: [Intel-wired-lan] [PATCH net-next V2 2/2] intel: ixgbevf: Support Windows hosts (Hyper-V)

2016-04-18 Thread Alexander Duyck
On Sun, Apr 17, 2016 at 10:22 PM, K. Y. Srinivasan  wrote:
> On Hyper-V, the VF/PF communication is a via software mediated path
> as opposed to the hardware mailbox. Make the necessary
> adjustments to support Hyper-V.
>
> Signed-off-by: K. Y. Srinivasan 
> ---
> V2: Addressed most of the comments from
> Alexander Duyck 
> and Rustad, Mark D .
>
>  drivers/net/ethernet/intel/ixgbevf/ixgbevf.h  |   12 ++
>  drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |   16 ++-
>  drivers/net/ethernet/intel/ixgbevf/mbx.c  |   12 ++
>  drivers/net/ethernet/intel/ixgbevf/vf.c   |  201 
> +
>  4 files changed, 237 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h 
> b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
> index 5ac60ee..3296d27 100644
> --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
> +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
> @@ -460,9 +460,13 @@ enum ixbgevf_state_t {
>
>  enum ixgbevf_boards {
> board_82599_vf,
> +   board_82599_vf_hv,
> board_X540_vf,
> +   board_X540_vf_hv,
> board_X550_vf,
> +   board_X550_vf_hv,
> board_X550EM_x_vf,
> +   board_X550EM_x_vf_hv,
>  };
>
>  enum ixgbevf_xcast_modes {
> @@ -477,6 +481,13 @@ extern const struct ixgbevf_info ixgbevf_X550_vf_info;
>  extern const struct ixgbevf_info ixgbevf_X550EM_x_vf_info;
>  extern const struct ixgbe_mbx_operations ixgbevf_mbx_ops;
>
> +
> +extern const struct ixgbevf_info ixgbevf_82599_vf_hv_info;
> +extern const struct ixgbevf_info ixgbevf_X540_vf_hv_info;
> +extern const struct ixgbevf_info ixgbevf_X550_vf_hv_info;
> +extern const struct ixgbevf_info ixgbevf_X550EM_x_vf_hv_info;
> +extern const struct ixgbe_mbx_operations ixgbevf_hv_mbx_ops;
> +
>  /* needed by ethtool.c */
>  extern const char ixgbevf_driver_name[];
>  extern const char ixgbevf_driver_version[];
> @@ -494,6 +505,7 @@ void ixgbevf_free_rx_resources(struct ixgbevf_ring *);
>  void ixgbevf_free_tx_resources(struct ixgbevf_ring *);
>  void ixgbevf_update_stats(struct ixgbevf_adapter *adapter);
>  int ethtool_ioctl(struct ifreq *ifr);
> +bool ixgbevf_on_hyperv(struct ixgbe_hw *hw);
>
>  extern void ixgbevf_write_eitr(struct ixgbevf_q_vector *q_vector);
>
> diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c 
> b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
> index 007cbe0..c761d80 100644
> --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
> +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
> @@ -62,10 +62,14 @@ static char ixgbevf_copyright[] =
> "Copyright (c) 2009 - 2015 Intel Corporation.";
>
>  static const struct ixgbevf_info *ixgbevf_info_tbl[] = {
> -   [board_82599_vf] = &ixgbevf_82599_vf_info,
> -   [board_X540_vf]  = &ixgbevf_X540_vf_info,
> -   [board_X550_vf]  = &ixgbevf_X550_vf_info,
> -   [board_X550EM_x_vf] = &ixgbevf_X550EM_x_vf_info,
> +   [board_82599_vf]= &ixgbevf_82599_vf_info,
> +   [board_82599_vf_hv] = &ixgbevf_82599_vf_hv_info,
> +   [board_X540_vf] = &ixgbevf_X540_vf_info,
> +   [board_X540_vf_hv]  = &ixgbevf_X540_vf_hv_info,
> +   [board_X550_vf] = &ixgbevf_X550_vf_info,
> +   [board_X550_vf_hv]  = &ixgbevf_X550_vf_hv_info,
> +   [board_X550EM_x_vf] = &ixgbevf_X550EM_x_vf_info,
> +   [board_X550EM_x_vf_hv]  = &ixgbevf_X550EM_x_vf_hv_info,
>  };
>
>  /* ixgbevf_pci_tbl - PCI Device ID Table
> @@ -78,9 +82,13 @@ static const struct ixgbevf_info *ixgbevf_info_tbl[] = {
>   */
>  static const struct pci_device_id ixgbevf_pci_tbl[] = {
> {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_VF), board_82599_vf },
> +   {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_VF_HV), board_82599_vf_hv },
> {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X540_VF), board_X540_vf },
> +   {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X540_VF_HV), board_X540_vf_hv },
> {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X550_VF), board_X550_vf },
> +   {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X550_VF_HV), board_X550_vf_hv },
> {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X550EM_X_VF), board_X550EM_x_vf },
> +   {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X550EM_X_VF_HV), 
> board_X550EM_x_vf_hv},
> /* required last entry */
> {0, }
>  };
> diff --git a/drivers/net/ethernet/intel/ixgbevf/mbx.c 
> b/drivers/net/ethernet/intel/ixgbevf/mbx.c
> index dc68fea..298a0da 100644
> --- a/drivers/net/ethernet/intel/ixgbevf/mbx.c
> +++ b/drivers/net/ethernet/intel/ixgbevf/mbx.c
> @@ -346,3 +346,15 @@ const struct ixgbe_mbx_operations ixgbevf_mbx_ops = {
> .check_for_rst  = ixgbevf_check_for_rst_vf,
>  };
>
> +/**
> + * Mailbox operations when running on Hyper-V.
> + * On Hyper-V, PF/VF communiction is not through the
> + * hardware mailbox; this communication is through
> + * a software mediated path.
> + * Most mail box operations are noop while running on
> + * Hyper-V.
> + */
> +const struct ixgbe_mbx_operations i

RE: [Intel-wired-lan] [PATCH net-next V2 2/2] intel: ixgbevf: Support Windows hosts (Hyper-V)

2016-04-18 Thread KY Srinivasan


> -Original Message-
> From: Alexander Duyck [mailto:alexander.du...@gmail.com]
> Sent: Monday, April 18, 2016 9:18 AM
> To: KY Srinivasan 
> Cc: David Miller ; Netdev
> ; linux-ker...@vger.kernel.org;
> de...@linuxdriverproject.org; o...@aepfle.de; Robo Bot
> ; Jason Wang ;
> e...@mellanox.com; ja...@mellanox.com; yevge...@mellanox.com; John
> Ronciak ; intel-wired-lan  l...@lists.osuosl.org>
> Subject: Re: [Intel-wired-lan] [PATCH net-next V2 2/2] intel: ixgbevf: Support
> Windows hosts (Hyper-V)
> 
> On Sun, Apr 17, 2016 at 10:22 PM, K. Y. Srinivasan 
> wrote:
> > On Hyper-V, the VF/PF communication is a via software mediated path
> > as opposed to the hardware mailbox. Make the necessary
> > adjustments to support Hyper-V.
> >
> > Signed-off-by: K. Y. Srinivasan 
> > ---
> > V2: Addressed most of the comments from
> > Alexander Duyck 
> > and Rustad, Mark D .
> >
> >  drivers/net/ethernet/intel/ixgbevf/ixgbevf.h  |   12 ++
> >  drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |   16 ++-
> >  drivers/net/ethernet/intel/ixgbevf/mbx.c  |   12 ++
> >  drivers/net/ethernet/intel/ixgbevf/vf.c   |  201
> +
> >  4 files changed, 237 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
> b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
> > index 5ac60ee..3296d27 100644
> > --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
> > +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
> > @@ -460,9 +460,13 @@ enum ixbgevf_state_t {
> >
> >  enum ixgbevf_boards {
> > board_82599_vf,
> > +   board_82599_vf_hv,
> > board_X540_vf,
> > +   board_X540_vf_hv,
> > board_X550_vf,
> > +   board_X550_vf_hv,
> > board_X550EM_x_vf,
> > +   board_X550EM_x_vf_hv,
> >  };
> >
> >  enum ixgbevf_xcast_modes {
> > @@ -477,6 +481,13 @@ extern const struct ixgbevf_info
> ixgbevf_X550_vf_info;
> >  extern const struct ixgbevf_info ixgbevf_X550EM_x_vf_info;
> >  extern const struct ixgbe_mbx_operations ixgbevf_mbx_ops;
> >
> > +
> > +extern const struct ixgbevf_info ixgbevf_82599_vf_hv_info;
> > +extern const struct ixgbevf_info ixgbevf_X540_vf_hv_info;
> > +extern const struct ixgbevf_info ixgbevf_X550_vf_hv_info;
> > +extern const struct ixgbevf_info ixgbevf_X550EM_x_vf_hv_info;
> > +extern const struct ixgbe_mbx_operations ixgbevf_hv_mbx_ops;
> > +
> >  /* needed by ethtool.c */
> >  extern const char ixgbevf_driver_name[];
> >  extern const char ixgbevf_driver_version[];
> > @@ -494,6 +505,7 @@ void ixgbevf_free_rx_resources(struct ixgbevf_ring
> *);
> >  void ixgbevf_free_tx_resources(struct ixgbevf_ring *);
> >  void ixgbevf_update_stats(struct ixgbevf_adapter *adapter);
> >  int ethtool_ioctl(struct ifreq *ifr);
> > +bool ixgbevf_on_hyperv(struct ixgbe_hw *hw);
> >
> >  extern void ixgbevf_write_eitr(struct ixgbevf_q_vector *q_vector);
> >
> > diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
> b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
> > index 007cbe0..c761d80 100644
> > --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
> > +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
> > @@ -62,10 +62,14 @@ static char ixgbevf_copyright[] =
> > "Copyright (c) 2009 - 2015 Intel Corporation.";
> >
> >  static const struct ixgbevf_info *ixgbevf_info_tbl[] = {
> > -   [board_82599_vf] = &ixgbevf_82599_vf_info,
> > -   [board_X540_vf]  = &ixgbevf_X540_vf_info,
> > -   [board_X550_vf]  = &ixgbevf_X550_vf_info,
> > -   [board_X550EM_x_vf] = &ixgbevf_X550EM_x_vf_info,
> > +   [board_82599_vf]= &ixgbevf_82599_vf_info,
> > +   [board_82599_vf_hv] = &ixgbevf_82599_vf_hv_info,
> > +   [board_X540_vf] = &ixgbevf_X540_vf_info,
> > +   [board_X540_vf_hv]  = &ixgbevf_X540_vf_hv_info,
> > +   [board_X550_vf] = &ixgbevf_X550_vf_info,
> > +   [board_X550_vf_hv]  = &ixgbevf_X550_vf_hv_info,
> > +   [board_X550EM_x_vf] = &ixgbevf_X550EM_x_vf_info,
> > +   [board_X550EM_x_vf_hv]  = &ixgbevf_X550EM_x_vf_hv_info,
> >  };
> >
> >  /* ixgbevf_pci_tbl - PCI Device ID Table
> > @@ -78,9 +82,13 @@ static const struct ixgbevf_info *ixgbevf_info_tbl[] =
> {
> >   */
> >  static const struct pci_device_id ixgbevf_pci_tbl[] = {
> > {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_VF), board_82599_vf },
> > +   {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_VF_HV),
> board_82599_vf_hv },
> > {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X540_VF), board_X540_vf },
> > +   {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X540_VF_HV),
> board_X540_vf_hv },
> > {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X550_VF), board_X550_vf },
> > +   {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X550_VF_HV),
> board_X550_vf_hv },
> > {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X550EM_X_VF),
> board_X550EM_x_vf },
> > +   {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X550EM_X_VF_HV),
> board_X550EM_x_vf_hv},
> > /* required last entry

Re: [PATCH] Input: i8042 - Fix console keyboard support on Gen2 Hyper-V VMs

2016-04-18 Thread Dan Carpenter
So if the user inserts the module without a keyboard then in the
original code they would just put a keyboard in and try again.  Now they
have to do an extra rmmod.  What about if we just removed the test for
if the keyboard is present?

On Tue, Apr 19, 2016 at 12:23:36AM +0900, Mark Laws wrote:
> As explained in 1407814240-4275-1-git-send-email-de...@microsoft.com:
> 
> > hyperv_keyboard invokes serio_interrupt(), which needs a valid serio
> > driver like atkbd.c.  atkbd.c depends on libps2.c because it invokes
> > ps2_command().  libps2.c depends on i8042.c because it invokes
> > i8042_check_port_owner().  As a result, hyperv_keyboard actually
> > depends on i8042.c.
> >
> > For a Generation 2 Hyper-V VM (meaning no i8042 device emulated), if a
> > Linux VM (like Arch Linux) happens to configure CONFIG_SERIO_I8042=m
> > rather than =y, atkbd.ko can't load because i8042.ko can't load(due to
> > no i8042 device emulated) and finally hyperv_keyboard can't work and
> > the user can't input: https://bugs.archlinux.org/task/39820
> > (Ubuntu/RHEL/SUSE aren't affected since they use CONFIG_SERIO_I8042=y)
> 
> The transitive dependency on i8042.c is non-trivial--there appears to be
> no obvious way to untangle it other than by duplicating much of atkbd.c
> within hyperv-keyboard--so we employ a simple workaround: keep i8042.ko
> loaded even if no i8042 device is detected, but set a flag so that any
> calls into the module simply return (since we don't want to try to
> interact with the non-existent i8042).  This allows atkbd.c and libps2.c
> to load, solving the problem.
> 
> Signed-off-by: Mark Laws 
> ---
>  drivers/input/serio/i8042.c | 41 ++---
>  1 file changed, 34 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
> index 4541957..4d49496 100644
> --- a/drivers/input/serio/i8042.c
> +++ b/drivers/input/serio/i8042.c
> @@ -132,6 +132,7 @@ struct i8042_port {
>  
>  static struct i8042_port i8042_ports[I8042_NUM_PORTS];
>  
> +static bool i8042_present;
>  static unsigned char i8042_initial_ctr;
>  static unsigned char i8042_ctr;
>  static bool i8042_mux_present;
> @@ -163,6 +164,9 @@ int i8042_install_filter(bool (*filter)(unsigned char 
> data, unsigned char str,
>   unsigned long flags;
>   int ret = 0;
>  
> + if (!i8042_present)
> + return ret;

Don't obfuscate the literal.  Just "return 0;".  Also if it's goto out
just change that to "return 0;" because it's simpler for the reader.

regards,
dan carpenter

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


Re: [Intel-wired-lan] [PATCH net-next V2 2/2] intel: ixgbevf: Support Windows hosts (Hyper-V)

2016-04-18 Thread Joe Perches
On Mon, 2016-04-18 at 16:52 +, KY Srinivasan wrote:
[]
> > > +bool ixgbevf_on_hyperv(struct ixgbe_hw *hw)
> > > +{
> > > +   if (hw->mbx.ops.check_for_msg == NULL)
> > > +   return true;
> > > +   else
> > > +   return false;
> > > +}

trivia:

bool func(...)
{
if ()
return true;
else
return false;
}

can generally be written as:

bool func(...)
{
return ;
}
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Input: i8042 - Fix console keyboard support on Gen2 Hyper-V VMs

2016-04-18 Thread Mark Laws
On Tue, Apr 19, 2016 at 1:54 AM, Dan Carpenter  wrote:
> So if the user inserts the module without a keyboard then in the
> original code they would just put a keyboard in and try again.  Now they
> have to do an extra rmmod.  What about if we just removed the test for
> if the keyboard is present?

Sorry, I don't understand--which part are you suggesting we remove?

> Don't obfuscate the literal.  Just "return 0;".  Also if it's goto out
> just change that to "return 0;" because it's simpler for the reader.

Will fix.

Regards,
Mark Laws

-- 
|v\ /\ |\ |< |_ /\ \^| //
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Greetings!!!

2016-04-18 Thread andreas
Hi, how are you? My name is J Eric Denials, External Financial Auditor at 
Lloyds Banking Group plc., London. It is a pleasure to contact you at this time 
through this medium. I have a cool and legitimate deal to do with you as you're 
a foreigner, it will be mutually beneficial to both. If you’re interested, 
urgently, get back to me for more explanation about the deal.
Regards
Eric
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Greetings!!!

2016-04-18 Thread andreas
Hi, how are you? My name is J Eric Denials, External Financial Auditor at 
Lloyds Banking Group plc., London. It is a pleasure to contact you at this time 
through this medium. I have a cool and legitimate deal to do with you as you're 
a foreigner, it will be mutually beneficial to both. If you’re interested, 
urgently, get back to me for more explanation about the deal.
Regards
Eric
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Personal Assitant and Administrative officer needed.

2016-04-18 Thread Walter.Smith



--
Hello,

I'm looking for someone who can handle my business & personal errands at 
his/her spare time as I keep travelling a lot. Someone who can offer me 
these


services mentioned below:

* Mail services (Receive my mails and drop them off at UPS or USPS)
* Shop for Gifts
* Bill payment (pay my bills on my behalf, access to the funds would be 
provided by me)
* Sit for delivery (at your home) or pick items up at nearby post office 
at your convenience.


Let me know if you will be able to offer me any or all of these services 
and 10% of my income weekly would be your weekly payment. If you will be 
available for this job position ,send me a confirmation e-mail and send 
me your details like complete name/address/country/state/ city/zip/phone 
or you could even attach your resume.I do have a pile up of work and a 
number of unattended duties which you can assist me with soon.


Please note that this job DOES NOT require any financial obligation of 
any sort from you as I would be catering for all expenses.


I look forward to hearing from you.

Sincerely,

Mr.Walter.Smith.

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


RE: [Intel-wired-lan] [PATCH net-next V2 2/2] intel: ixgbevf: Support Windows hosts (Hyper-V)

2016-04-18 Thread KY Srinivasan


> -Original Message-
> From: Joe Perches [mailto:j...@perches.com]
> Sent: Monday, April 18, 2016 10:00 AM
> To: KY Srinivasan ; Alexander Duyck
> 
> Cc: David Miller ; Netdev
> ; linux-ker...@vger.kernel.org;
> de...@linuxdriverproject.org; o...@aepfle.de; Robo Bot
> ; Jason Wang ;
> e...@mellanox.com; ja...@mellanox.com; yevge...@mellanox.com; John
> Ronciak ; intel-wired-lan  l...@lists.osuosl.org>
> Subject: Re: [Intel-wired-lan] [PATCH net-next V2 2/2] intel: ixgbevf: Support
> Windows hosts (Hyper-V)
> 
> On Mon, 2016-04-18 at 16:52 +, KY Srinivasan wrote:
> []
> > > > +bool ixgbevf_on_hyperv(struct ixgbe_hw *hw)
> > > > +{
> > > > +   if (hw->mbx.ops.check_for_msg == NULL)
> > > > +   return true;
> > > > +   else
> > > > +   return false;
> > > > +}
> 
> trivia:
> 
> bool func(...)
> {
>   if ()
>   return true;
>   else
>   return false;
> }
> 
> can generally be written as:
> 
> bool func(...)
> {
>   return ;
> }

Thanks Joe; will update.

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


Greetings!!!

2016-04-18 Thread andreas12
Hi, how are you? My name is J Eric Denials, External Financial Auditor at 
Lloyds Banking Group plc., London. It is a pleasure to contact you at this time 
through this medium. I have a cool and legitimate deal to do with you as you're 
a foreigner, it will be mutually beneficial to both. If you’re interested, 
urgently, get back to me for more explanation about the deal.
Regards
Eric
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Greetings!!!

2016-04-18 Thread andreas12
Hi, how are you? My name is J Eric Denials, External Financial Auditor at 
Lloyds Banking Group plc., London. It is a pleasure to contact you at this time 
through this medium. I have a cool and legitimate deal to do with you as you're 
a foreigner, it will be mutually beneficial to both. If you’re interested, 
urgently, get back to me for more explanation about the deal.
Regards
Eric
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 01/15] staging: comedi: mite: Prefer 'unsigned int' to bare use of 'unsigned'

2016-04-18 Thread H Hartley Sweeten
Fix the checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/mite.c | 29 +++--
 drivers/staging/comedi/drivers/mite.h | 17 +
 2 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/comedi/drivers/mite.c 
b/drivers/staging/comedi/drivers/mite.c
index 8f24702..ceaf1ec 100644
--- a/drivers/staging/comedi/drivers/mite.c
+++ b/drivers/staging/comedi/drivers/mite.c
@@ -82,11 +82,12 @@ static void dump_chip_signature(u32 csigr_bits)
mite_csigr_wins(csigr_bits), mite_csigr_iowins(csigr_bits));
 }
 
-static unsigned mite_fifo_size(struct mite_struct *mite, unsigned channel)
+static unsigned int mite_fifo_size(struct mite_struct *mite,
+  unsigned int channel)
 {
-   unsigned fcr_bits = readl(mite->mite_io_addr + MITE_FCR(channel));
-   unsigned empty_count = (fcr_bits >> 16) & 0xff;
-   unsigned full_count = fcr_bits & 0xff;
+   unsigned int fcr_bits = readl(mite->mite_io_addr + MITE_FCR(channel));
+   unsigned int empty_count = (fcr_bits >> 16) & 0xff;
+   unsigned int full_count = fcr_bits & 0xff;
 
return empty_count + full_count;
 }
@@ -97,7 +98,7 @@ int mite_setup2(struct comedi_device *dev,
unsigned long length;
int i;
u32 csigr_bits;
-   unsigned unknown_dma_burst_bits;
+   unsigned int unknown_dma_burst_bits;
 
pci_set_master(mite->pcidev);
 
@@ -213,11 +214,11 @@ void mite_free_ring(struct mite_dma_descriptor_ring *ring)
 };
 EXPORT_SYMBOL_GPL(mite_free_ring);
 
-struct mite_channel *mite_request_channel_in_range(struct mite_struct *mite,
-  struct
-  mite_dma_descriptor_ring
-  *ring, unsigned min_channel,
-  unsigned max_channel)
+struct mite_channel *
+mite_request_channel_in_range(struct mite_struct *mite,
+ struct mite_dma_descriptor_ring *ring,
+ unsigned int min_channel,
+ unsigned int max_channel)
 {
int i;
unsigned long flags;
@@ -529,7 +530,7 @@ u32 mite_bytes_read_from_memory_ub(struct mite_channel 
*mite_chan)
 }
 EXPORT_SYMBOL_GPL(mite_bytes_read_from_memory_ub);
 
-unsigned mite_dma_tcr(struct mite_channel *mite_chan)
+unsigned int mite_dma_tcr(struct mite_channel *mite_chan)
 {
struct mite_struct *mite = mite_chan->mite;
 
@@ -540,7 +541,7 @@ EXPORT_SYMBOL_GPL(mite_dma_tcr);
 void mite_dma_disarm(struct mite_channel *mite_chan)
 {
struct mite_struct *mite = mite_chan->mite;
-   unsigned chor;
+   unsigned int chor;
 
/* disarm */
chor = CHOR_ABORT;
@@ -632,10 +633,10 @@ int mite_sync_output_dma(struct mite_channel *mite_chan,
 }
 EXPORT_SYMBOL_GPL(mite_sync_output_dma);
 
-unsigned mite_get_status(struct mite_channel *mite_chan)
+unsigned int mite_get_status(struct mite_channel *mite_chan)
 {
struct mite_struct *mite = mite_chan->mite;
-   unsigned status;
+   unsigned int status;
unsigned long flags;
 
spin_lock_irqsave(&mite->lock, flags);
diff --git a/drivers/staging/comedi/drivers/mite.h 
b/drivers/staging/comedi/drivers/mite.h
index f2099b0..4d1dece 100644
--- a/drivers/staging/comedi/drivers/mite.h
+++ b/drivers/staging/comedi/drivers/mite.h
@@ -46,7 +46,7 @@ struct mite_dma_descriptor_ring {
 
 struct mite_channel {
struct mite_struct *mite;
-   unsigned channel;
+   unsigned int channel;
int dir;
int done;
struct mite_dma_descriptor_ring *ring;
@@ -60,7 +60,7 @@ struct mite_struct {
struct mite_channel channels[MAX_MITE_DMA_CHANNELS];
short channel_allocated[MAX_MITE_DMA_CHANNELS];
int num_channels;
-   unsigned fifo_size;
+   unsigned int fifo_size;
spinlock_t lock;
 };
 
@@ -80,7 +80,8 @@ void mite_free_ring(struct mite_dma_descriptor_ring *ring);
 struct mite_channel *
 mite_request_channel_in_range(struct mite_struct *mite,
  struct mite_dma_descriptor_ring *ring,
- unsigned min_channel, unsigned max_channel);
+ unsigned int min_channel,
+ unsigned int max_channel);
 static inline struct mite_channel *
 mite_request_channel(struct mite_struct *mite,
 struct mite_dma_descriptor_ring *ring)
@@ -91,7 +92,7 @@ mite_request_channel(struct mite_struct *mite,
 
 void mite_release_channel(struct mite_channel *mite_chan);
 
-unsigned mite_dma_tcr(struct mite_channel *mite_chan);
+unsigned int mite_dma_tcr(struct mite_channel *mite_chan);
 void mite_dma_arm(struct mite_channel *mite_chan);
 void mite_dma_disarm(struct mite_channel *mite_chan);
 int mite_sync_input

[PATCH 03/15] staging: comedi: mite: remove mite_dma_tcr()

2016-04-18 Thread H Hartley Sweeten
This exported function is not used by any of the comedi drivers. The
only call point in mite.c is commented out. Remove the unused function
and the export.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/mite.c | 9 -
 drivers/staging/comedi/drivers/mite.h | 1 -
 2 files changed, 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/mite.c 
b/drivers/staging/comedi/drivers/mite.c
index 44a1b36..f846202 100644
--- a/drivers/staging/comedi/drivers/mite.c
+++ b/drivers/staging/comedi/drivers/mite.c
@@ -285,7 +285,6 @@ void mite_dma_arm(struct mite_channel *mite_chan)
writel(chor, mite->mite_io_addr + MITE_CHOR(mite_chan->channel));
mmiowb();
spin_unlock_irqrestore(&mite->lock, flags);
-   /* mite_dma_tcr(mite, channel); */
 }
 EXPORT_SYMBOL_GPL(mite_dma_arm);
 
@@ -528,14 +527,6 @@ u32 mite_bytes_read_from_memory_ub(struct mite_channel 
*mite_chan)
 }
 EXPORT_SYMBOL_GPL(mite_bytes_read_from_memory_ub);
 
-unsigned int mite_dma_tcr(struct mite_channel *mite_chan)
-{
-   struct mite_struct *mite = mite_chan->mite;
-
-   return readl(mite->mite_io_addr + MITE_TCR(mite_chan->channel));
-}
-EXPORT_SYMBOL_GPL(mite_dma_tcr);
-
 void mite_dma_disarm(struct mite_channel *mite_chan)
 {
struct mite_struct *mite = mite_chan->mite;
diff --git a/drivers/staging/comedi/drivers/mite.h 
b/drivers/staging/comedi/drivers/mite.h
index 4d1dece..9003476 100644
--- a/drivers/staging/comedi/drivers/mite.h
+++ b/drivers/staging/comedi/drivers/mite.h
@@ -92,7 +92,6 @@ mite_request_channel(struct mite_struct *mite,
 
 void mite_release_channel(struct mite_channel *mite_chan);
 
-unsigned int mite_dma_tcr(struct mite_channel *mite_chan);
 void mite_dma_arm(struct mite_channel *mite_chan);
 void mite_dma_disarm(struct mite_channel *mite_chan);
 int mite_sync_input_dma(struct mite_channel *mite_chan,
-- 
2.6.3

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


[PATCH 02/15] staging: comedi: mite: remove TOP_OF_PAGE() macro

2016-04-18 Thread H Hartley Sweeten
This macro is not used. Remove it.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/mite.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/mite.c 
b/drivers/staging/comedi/drivers/mite.c
index ceaf1ec..44a1b36 100644
--- a/drivers/staging/comedi/drivers/mite.c
+++ b/drivers/staging/comedi/drivers/mite.c
@@ -51,8 +51,6 @@
 
 #include "mite.h"
 
-#define TOP_OF_PAGE(x) ((x)|(~(PAGE_MASK)))
-
 struct mite_struct *mite_alloc(struct pci_dev *pcidev)
 {
struct mite_struct *mite;
-- 
2.6.3

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


[PATCH 00/15] staging: comedi: mite: cleanup driver

2016-04-18 Thread H Hartley Sweeten
Fix all the checkpatch.pl issues and tidy up this driver.

H Hartley Sweeten (15):
  staging: comedi: mite: Prefer 'unsigned int' to bare use of 'unsigned'
  staging: comedi: mite: remove TOP_OF_PAGE() macro
  staging: comedi: mite: remove mite_dma_tcr()
  staging: comedi: mite: don't export internal functions
  staging: comedi: mite: remove mite_struct member 'mite_phys_addr'
  staging: comedi: mite: remove mite_struct member 'daq_phys_addr'
  staging: comedi: ni_pcidio: remove redundant mite disarm/reset
  staging: comedi: mite: don't expose mite_dma_reset()
  staging: comedi: mite: introduce mite_ack_linkc()
  staging: comedi: mite: don't expose unnecessary register/bit info
  staging: comedi: mite: introduce mite_sync_dma()
  staging: comedi: mite: rename CamelCase CHSR bit enums
  staging: comedi: mite: document the mite_struct spinlock_t
  staging: comedi: mite: remove BUG_ON() in MITE_IODWBSR_1_WSIZE_bits()
  staging: comedi: mite: cleanup remaining mite register/bits

 drivers/staging/comedi/drivers/mite.c  | 281 +--
 drivers/staging/comedi/drivers/mite.h  | 302 +
 drivers/staging/comedi/drivers/ni_660x.c   |   2 +-
 drivers/staging/comedi/drivers/ni_mio_common.c |  34 +--
 drivers/staging/comedi/drivers/ni_pcidio.c |  16 +-
 drivers/staging/comedi/drivers/ni_pcimio.c |   6 +-
 drivers/staging/comedi/drivers/ni_tiocmd.c |  11 +-
 7 files changed, 282 insertions(+), 370 deletions(-)

-- 
2.6.3

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


[PATCH 05/15] staging: comedi: mite: remove mite_struct member 'mite_phys_addr'

2016-04-18 Thread H Hartley Sweeten
This member of mite_struct is set but never used. Just remove it.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/mite.c | 1 -
 drivers/staging/comedi/drivers/mite.h | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/mite.c 
b/drivers/staging/comedi/drivers/mite.c
index 61ac527..a795842 100644
--- a/drivers/staging/comedi/drivers/mite.c
+++ b/drivers/staging/comedi/drivers/mite.c
@@ -106,7 +106,6 @@ int mite_setup2(struct comedi_device *dev,
"Failed to remap mite io memory address\n");
return -ENOMEM;
}
-   mite->mite_phys_addr = pci_resource_start(mite->pcidev, 0);
 
dev->mmio = pci_ioremap_bar(mite->pcidev, 1);
if (!dev->mmio) {
diff --git a/drivers/staging/comedi/drivers/mite.h 
b/drivers/staging/comedi/drivers/mite.h
index 583c60f..95d3c13 100644
--- a/drivers/staging/comedi/drivers/mite.h
+++ b/drivers/staging/comedi/drivers/mite.h
@@ -54,7 +54,6 @@ struct mite_channel {
 
 struct mite_struct {
struct pci_dev *pcidev;
-   resource_size_t mite_phys_addr;
void __iomem *mite_io_addr;
resource_size_t daq_phys_addr;
struct mite_channel channels[MAX_MITE_DMA_CHANNELS];
-- 
2.6.3

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


[PATCH 07/15] staging: comedi: ni_pcidio: remove redundant mite disarm/reset

2016-04-18 Thread H Hartley Sweeten
The mite_release_channel() will disarm and reset the mite channel.
Remove the redundant calls in ni_pcidio_release_di_mite_channel().

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_pcidio.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c 
b/drivers/staging/comedi/drivers/ni_pcidio.c
index 7112c3f..c044c8b 100644
--- a/drivers/staging/comedi/drivers/ni_pcidio.c
+++ b/drivers/staging/comedi/drivers/ni_pcidio.c
@@ -324,8 +324,6 @@ static void ni_pcidio_release_di_mite_channel(struct 
comedi_device *dev)
 
spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->di_mite_chan) {
-   mite_dma_disarm(devpriv->di_mite_chan);
-   mite_dma_reset(devpriv->di_mite_chan);
mite_release_channel(devpriv->di_mite_chan);
devpriv->di_mite_chan = NULL;
writeb(primary_DMAChannel_bits(0) |
-- 
2.6.3

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


[PATCH 14/15] staging: comedi: mite: remove BUG_ON() in MITE_IODWBSR_1_WSIZE_bits()

2016-04-18 Thread H Hartley Sweeten
Prior to calling this function pci_ioremap_bar() is called. If the
pci_resource_len(), i.e. the 'size', was 0 the ioremap would fail
so this function would never be called. So the first BUG_ON() can
never occur.

The 'order' returned by ilog2() will always be > 0 so the second
BUG_ON() will also never occur.

Remove the unnecessary BUG_ON() checks and tidy up the function.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/mite.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/mite.c 
b/drivers/staging/comedi/drivers/mite.c
index d5475cd..2233a41 100644
--- a/drivers/staging/comedi/drivers/mite.c
+++ b/drivers/staging/comedi/drivers/mite.c
@@ -157,12 +157,7 @@
 
 static unsigned int MITE_IODWBSR_1_WSIZE_bits(unsigned int size)
 {
-   unsigned int order = 0;
-
-   BUG_ON(size == 0);
-   order = ilog2(size);
-   BUG_ON(order < 1);
-   return (order - 1) & 0x1f;
+   return (ilog2(size) - 1) & 0x1f;
 }
 
 static unsigned int mite_retry_limit(unsigned int retry_limit)
-- 
2.6.3

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


[PATCH 15/15] staging: comedi: mite: cleanup remaining mite register/bits

2016-04-18 Thread H Hartley Sweeten
For aesthetics, convert the register/bit enums into defines and
use the BIT() macro to define the bits.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/mite.h | 88 +--
 1 file changed, 44 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/comedi/drivers/mite.h 
b/drivers/staging/comedi/drivers/mite.h
index bd54dd0..4942853 100644
--- a/drivers/staging/comedi/drivers/mite.h
+++ b/drivers/staging/comedi/drivers/mite.h
@@ -104,49 +104,49 @@ int mite_init_ring_descriptors(struct 
mite_dma_descriptor_ring *ring,
   struct comedi_subdevice *s,
   unsigned int nbytes);
 
-enum mite_registers {
-   MITE_IODWBSR = 0xc0,/* IO Device Window Base Size Register */
-   MITE_IODWBSR_1 = 0xc4,  /* IO Device Window Base Size Register 1 */
-   MITE_IODWCR_1 = 0xf4,
-};
-
-enum MITE_IODWBSR_bits {
-   WENAB = 0x80,   /* window enable */
-};
-
-enum CHSR_bits {
-   CHSR_INT = (1 << 31),
-   CHSR_LPAUSES = (1 << 29),
-   CHSR_SARS = (1 << 27),
-   CHSR_DONE = (1 << 25),
-   CHSR_MRDY = (1 << 23),
-   CHSR_DRDY = (1 << 21),
-   CHSR_LINKC = (1 << 19),
-   CHSR_CONTS_RB = (1 << 17),
-   CHSR_ERROR = (1 << 15),
-   CHSR_SABORT = (1 << 14),
-   CHSR_HABORT = (1 << 13),
-   CHSR_STOPS = (1 << 12),
-   CHSR_OPERR_MASK = (3 << 10),
-   CHSR_OPERR_NOERROR = (0 << 10),
-   CHSR_OPERR_FIFOERROR = (1 << 10),
-   CHSR_OPERR_LINKERROR = (1 << 10),   /* ??? */
-   CHSR_XFERR = (1 << 9),
-   CHSR_END = (1 << 8),
-   CHSR_DRQ1 = (1 << 7),
-   CHSR_DRQ0 = (1 << 6),
-   CHSR_LERR_MASK = (3 << 4),
-   CHSR_LBERR = (1 << 4),
-   CHSR_LRERR = (2 << 4),
-   CHSR_LOERR = (3 << 4),
-   CHSR_MERR_MASK = (3 << 2),
-   CHSR_MBERR = (1 << 2),
-   CHSR_MRERR = (2 << 2),
-   CHSR_MOERR = (3 << 2),
-   CHSR_DERR_MASK = (3 << 0),
-   CHSR_DBERR = (1 << 0),
-   CHSR_DRERR = (2 << 0),
-   CHSR_DOERR = (3 << 0),
-};
+/*
+ * Mite registers (used outside of the mite driver)
+ */
+#define MITE_IODWBSR   0xc0/* IO Device Window Base Size */
+#define MITE_IODWBSR_1 0xc4/* IO Device Window1 Base Size */
+#define WENAB  BIT(7)  /* window enable */
+#define MITE_IODWCR_1  0xf4
+
+#define CHSR_INT   BIT(31)
+#define CHSR_LPAUSES   BIT(29)
+#define CHSR_SARS  BIT(27)
+#define CHSR_DONE  BIT(25)
+#define CHSR_MRDY  BIT(23)
+#define CHSR_DRDY  BIT(21)
+#define CHSR_LINKC BIT(19)
+#define CHSR_CONTS_RB  BIT(17)
+#define CHSR_ERROR BIT(15)
+#define CHSR_SABORTBIT(14)
+#define CHSR_HABORTBIT(13)
+#define CHSR_STOPS BIT(12)
+#define CHSR_OPERR(x)  (((x) & 0x3) << 10)
+#define CHSR_OPERR_MASKCHSR_OPERR(3)
+#define CHSR_OPERR_NOERROR CHSR_OPERR(0)
+#define CHSR_OPERR_FIFOERROR   CHSR_OPERR(1)
+#define CHSR_OPERR_LINKERROR   CHSR_OPERR(1)   /* ??? */
+#define CHSR_XFERR BIT(9)
+#define CHSR_END   BIT(8)
+#define CHSR_DRQ1  BIT(7)
+#define CHSR_DRQ0  BIT(6)
+#define CHSR_LERR(x)   (((x) & 0x3) << 4)
+#define CHSR_LERR_MASK CHSR_LERR(3)
+#define CHSR_LBERR CHSR_LERR(1)
+#define CHSR_LRERR CHSR_LERR(2)
+#define CHSR_LOERR CHSR_LERR(3)
+#define CHSR_MERR(x)   (((x) & 0x3) << 2)
+#define CHSR_MERR_MASK CHSR_MERR(3)
+#define CHSR_MBERR CHSR_MERR(1)
+#define CHSR_MRERR CHSR_MERR(2)
+#define CHSR_MOERR CHSR_MERR(3)
+#define CHSR_DERR(x)   (((x) & 0x3) << 0)
+#define CHSR_DERR_MASK CHSR_DERR(3)
+#define CHSR_DBERR CHSR_DERR(1)
+#define CHSR_DRERR CHSR_DERR(2)
+#define CHSR_DOERR CHSR_DERR(3)
 
 #endif
-- 
2.6.3

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


[PATCH 08/15] staging: comedi: mite: don't expose mite_dma_reset()

2016-04-18 Thread H Hartley Sweeten
This function is only called by the mite driver. Remove the inline
function from the header and make it static in the driver.

Use the function in mite_prep_dma() instead of duplicating the code.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/mite.c | 12 
 drivers/staging/comedi/drivers/mite.h |  6 --
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/mite.c 
b/drivers/staging/comedi/drivers/mite.c
index 6f31796..2f24fae 100644
--- a/drivers/staging/comedi/drivers/mite.c
+++ b/drivers/staging/comedi/drivers/mite.c
@@ -51,6 +51,12 @@
 
 #include "mite.h"
 
+static void mite_dma_reset(struct mite_channel *mite_chan)
+{
+   writel(CHOR_DMARESET | CHOR_FRESET,
+  mite_chan->mite->mite_io_addr + MITE_CHOR(mite_chan->channel));
+}
+
 struct mite_struct *mite_alloc(struct pci_dev *pcidev)
 {
struct mite_struct *mite;
@@ -387,12 +393,10 @@ EXPORT_SYMBOL_GPL(mite_init_ring_descriptors);
 void mite_prep_dma(struct mite_channel *mite_chan,
   unsigned int num_device_bits, unsigned int num_memory_bits)
 {
-   unsigned int chor, chcr, mcr, dcr, lkcr;
+   unsigned int chcr, mcr, dcr, lkcr;
struct mite_struct *mite = mite_chan->mite;
 
-   /* reset DMA and FIFO */
-   chor = CHOR_DMARESET | CHOR_FRESET;
-   writel(chor, mite->mite_io_addr + MITE_CHOR(mite_chan->channel));
+   mite_dma_reset(mite_chan);
 
/* short link chaining mode */
chcr = CHCR_SET_DMA_IE | CHCR_LINKSHORT | CHCR_SET_DONE_IE |
diff --git a/drivers/staging/comedi/drivers/mite.h 
b/drivers/staging/comedi/drivers/mite.h
index 3948299..f168ece 100644
--- a/drivers/staging/comedi/drivers/mite.h
+++ b/drivers/staging/comedi/drivers/mite.h
@@ -337,10 +337,4 @@ enum CHSR_bits {
CHSR_DOERR = (3 << 0),
 };
 
-static inline void mite_dma_reset(struct mite_channel *mite_chan)
-{
-   writel(CHOR_DMARESET | CHOR_FRESET,
-  mite_chan->mite->mite_io_addr + MITE_CHOR(mite_chan->channel));
-};
-
 #endif
-- 
2.6.3

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


[PATCH 13/15] staging: comedi: mite: document the mite_struct spinlock_t

2016-04-18 Thread H Hartley Sweeten
Add a comment to fix the checkpatch.pl issue:
CHECK: spinlock_t definition without comment

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/mite.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/comedi/drivers/mite.h 
b/drivers/staging/comedi/drivers/mite.h
index 9ef51e8..bd54dd0 100644
--- a/drivers/staging/comedi/drivers/mite.h
+++ b/drivers/staging/comedi/drivers/mite.h
@@ -57,6 +57,7 @@ struct mite_struct {
short channel_allocated[MAX_MITE_DMA_CHANNELS];
int num_channels;
unsigned int fifo_size;
+   /* protects mite_channel from being released by the driver */
spinlock_t lock;
 };
 
-- 
2.6.3

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


[PATCH 06/15] staging: comedi: mite: remove mite_struct member 'daq_phys_addr'

2016-04-18 Thread H Hartley Sweeten
This member of mite_struct is only used to map the mite I/O window.
For aesthetics, remove it and use a local variable instead.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/mite.c  | 7 ---
 drivers/staging/comedi/drivers/mite.h  | 1 -
 drivers/staging/comedi/drivers/ni_pcimio.c | 6 +-
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/mite.c 
b/drivers/staging/comedi/drivers/mite.c
index a795842..6f31796 100644
--- a/drivers/staging/comedi/drivers/mite.c
+++ b/drivers/staging/comedi/drivers/mite.c
@@ -93,6 +93,7 @@ static unsigned int mite_fifo_size(struct mite_struct *mite,
 int mite_setup2(struct comedi_device *dev,
struct mite_struct *mite, bool use_win1)
 {
+   resource_size_t daq_phys_addr;
unsigned long length;
int i;
u32 csigr_bits;
@@ -113,19 +114,19 @@ int mite_setup2(struct comedi_device *dev,
"Failed to remap daq io memory address\n");
return -ENOMEM;
}
-   mite->daq_phys_addr = pci_resource_start(mite->pcidev, 1);
+   daq_phys_addr = pci_resource_start(mite->pcidev, 1);
length = pci_resource_len(mite->pcidev, 1);
 
if (use_win1) {
writel(0, mite->mite_io_addr + MITE_IODWBSR);
dev_info(dev->class_dev,
 "using I/O Window Base Size register 1\n");
-   writel(mite->daq_phys_addr | WENAB |
+   writel(daq_phys_addr | WENAB |
   MITE_IODWBSR_1_WSIZE_bits(length),
   mite->mite_io_addr + MITE_IODWBSR_1);
writel(0, mite->mite_io_addr + MITE_IODWCR_1);
} else {
-   writel(mite->daq_phys_addr | WENAB,
+   writel(daq_phys_addr | WENAB,
   mite->mite_io_addr + MITE_IODWBSR);
}
/*
diff --git a/drivers/staging/comedi/drivers/mite.h 
b/drivers/staging/comedi/drivers/mite.h
index 95d3c13..3948299 100644
--- a/drivers/staging/comedi/drivers/mite.h
+++ b/drivers/staging/comedi/drivers/mite.h
@@ -55,7 +55,6 @@ struct mite_channel {
 struct mite_struct {
struct pci_dev *pcidev;
void __iomem *mite_io_addr;
-   resource_size_t daq_phys_addr;
struct mite_channel channels[MAX_MITE_DMA_CHANNELS];
short channel_allocated[MAX_MITE_DMA_CHANNELS];
int num_channels;
diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c 
b/drivers/staging/comedi/drivers/ni_pcimio.c
index 231e37d..4028b6f 100644
--- a/drivers/staging/comedi/drivers/ni_pcimio.c
+++ b/drivers/staging/comedi/drivers/ni_pcimio.c
@@ -1061,6 +1061,7 @@ static int pcimio_dio_change(struct comedi_device *dev,
 static void m_series_init_eeprom_buffer(struct comedi_device *dev)
 {
struct ni_private *devpriv = dev->private;
+   resource_size_t daq_phys_addr;
static const int Start_Cal_EEPROM = 0x400;
static const unsigned window_size = 10;
static const int serial_number_eeprom_offset = 0x4;
@@ -1070,11 +1071,14 @@ static void m_series_init_eeprom_buffer(struct 
comedi_device *dev)
unsigned old_iodwcr1_bits;
int i;
 
+   /* IO Window 1 needs to be temporarily mapped to read the eeprom */
+   daq_phys_addr = pci_resource_start(devpriv->mite->pcidev, 1);
+
old_iodwbsr_bits = readl(devpriv->mite->mite_io_addr + MITE_IODWBSR);
old_iodwbsr1_bits = readl(devpriv->mite->mite_io_addr + MITE_IODWBSR_1);
old_iodwcr1_bits = readl(devpriv->mite->mite_io_addr + MITE_IODWCR_1);
writel(0x0, devpriv->mite->mite_io_addr + MITE_IODWBSR);
-   writel(((0x80 | window_size) | devpriv->mite->daq_phys_addr),
+   writel(((0x80 | window_size) | daq_phys_addr),
   devpriv->mite->mite_io_addr + MITE_IODWBSR_1);
writel(0x1 | old_iodwcr1_bits,
   devpriv->mite->mite_io_addr + MITE_IODWCR_1);
-- 
2.6.3

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


[PATCH 09/15] staging: comedi: mite: introduce mite_ack_linkc()

2016-04-18 Thread H Hartley Sweeten
Introduce a helper function to handle the ack of a LINKC interrupt.
Tidy up the drivers that use the new helper.

The mite_get_status() function is not only used by the mite driver.
Make it static and remove the export.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/mite.c  | 17 ++--
 drivers/staging/comedi/drivers/mite.h  |  2 +-
 drivers/staging/comedi/drivers/ni_mio_common.c | 28 +-
 drivers/staging/comedi/drivers/ni_pcidio.c | 10 ++---
 drivers/staging/comedi/drivers/ni_tiocmd.c | 11 ++
 5 files changed, 25 insertions(+), 43 deletions(-)

diff --git a/drivers/staging/comedi/drivers/mite.c 
b/drivers/staging/comedi/drivers/mite.c
index 2f24fae..2dcfa76 100644
--- a/drivers/staging/comedi/drivers/mite.c
+++ b/drivers/staging/comedi/drivers/mite.c
@@ -622,7 +622,7 @@ int mite_sync_output_dma(struct mite_channel *mite_chan,
 }
 EXPORT_SYMBOL_GPL(mite_sync_output_dma);
 
-unsigned int mite_get_status(struct mite_channel *mite_chan)
+static unsigned int mite_get_status(struct mite_channel *mite_chan)
 {
struct mite_struct *mite = mite_chan->mite;
unsigned int status;
@@ -639,7 +639,20 @@ unsigned int mite_get_status(struct mite_channel 
*mite_chan)
spin_unlock_irqrestore(&mite->lock, flags);
return status;
 }
-EXPORT_SYMBOL_GPL(mite_get_status);
+
+unsigned int mite_ack_linkc(struct mite_channel *mite_chan)
+{
+   struct mite_struct *mite = mite_chan->mite;
+   unsigned int status;
+
+   status = mite_get_status(mite_chan);
+   if (status & CHSR_LINKC)
+   writel(CHOR_CLRLC,
+  mite->mite_io_addr + MITE_CHOR(mite_chan->channel));
+
+   return status;
+}
+EXPORT_SYMBOL_GPL(mite_ack_linkc);
 
 int mite_done(struct mite_channel *mite_chan)
 {
diff --git a/drivers/staging/comedi/drivers/mite.h 
b/drivers/staging/comedi/drivers/mite.h
index f168ece..406e904 100644
--- a/drivers/staging/comedi/drivers/mite.h
+++ b/drivers/staging/comedi/drivers/mite.h
@@ -97,7 +97,7 @@ int mite_sync_input_dma(struct mite_channel *mite_chan,
 int mite_sync_output_dma(struct mite_channel *mite_chan,
 struct comedi_subdevice *s);
 u32 mite_bytes_in_transit(struct mite_channel *mite_chan);
-unsigned int mite_get_status(struct mite_channel *mite_chan);
+unsigned int mite_ack_linkc(struct mite_channel *mite_chan);
 int mite_done(struct mite_channel *mite_chan);
 
 void mite_prep_dma(struct mite_channel *mite_chan,
diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 081ed3f..7f7296e 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -3697,13 +3697,7 @@ static void handle_cdio_interrupt(struct comedi_device 
*dev)
 
spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->cdo_mite_chan) {
-   unsigned int cdo_mite_status =
-   mite_get_status(devpriv->cdo_mite_chan);
-   if (cdo_mite_status & CHSR_LINKC) {
-   writel(CHOR_CLRLC,
-  devpriv->mite->mite_io_addr +
-  MITE_CHOR(devpriv->cdo_mite_chan->channel));
-   }
+   mite_ack_linkc(devpriv->cdo_mite_chan);
mite_sync_output_dma(devpriv->cdo_mite_chan, s);
}
spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
@@ -5222,22 +5216,10 @@ static irqreturn_t ni_E_interrupt(int irq, void *d)
unsigned long flags_too;
 
spin_lock_irqsave(&devpriv->mite_channel_lock, flags_too);
-   if (devpriv->ai_mite_chan) {
-   ai_mite_status = mite_get_status(devpriv->ai_mite_chan);
-   if (ai_mite_status & CHSR_LINKC)
-   writel(CHOR_CLRLC,
-  devpriv->mite->mite_io_addr +
-  MITE_CHOR(devpriv->
-ai_mite_chan->channel));
-   }
-   if (devpriv->ao_mite_chan) {
-   ao_mite_status = mite_get_status(devpriv->ao_mite_chan);
-   if (ao_mite_status & CHSR_LINKC)
-   writel(CHOR_CLRLC,
-  devpriv->mite->mite_io_addr +
-  MITE_CHOR(devpriv->
-ao_mite_chan->channel));
-   }
+   if (devpriv->ai_mite_chan)
+   ai_mite_status = mite_ack_linkc(devpriv->ai_mite_chan);
+   if (devpriv->ao_mite_chan)
+   ao_mite_status = mite_ack_linkc(devpriv->ao_mite_chan);
spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags_too);
}
 

[PATCH 12/15] staging: comedi: mite: rename CamelCase CHSR bit enums

2016-04-18 Thread H Hartley Sweeten
Rename the CamelCase symbols to fix the checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/mite.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/mite.h 
b/drivers/staging/comedi/drivers/mite.h
index 9982539..9ef51e8 100644
--- a/drivers/staging/comedi/drivers/mite.h
+++ b/drivers/staging/comedi/drivers/mite.h
@@ -126,7 +126,7 @@ enum CHSR_bits {
CHSR_SABORT = (1 << 14),
CHSR_HABORT = (1 << 13),
CHSR_STOPS = (1 << 12),
-   CHSR_OPERR_mask = (3 << 10),
+   CHSR_OPERR_MASK = (3 << 10),
CHSR_OPERR_NOERROR = (0 << 10),
CHSR_OPERR_FIFOERROR = (1 << 10),
CHSR_OPERR_LINKERROR = (1 << 10),   /* ??? */
@@ -138,11 +138,11 @@ enum CHSR_bits {
CHSR_LBERR = (1 << 4),
CHSR_LRERR = (2 << 4),
CHSR_LOERR = (3 << 4),
-   CHSR_MxERR_mask = (3 << 2),
+   CHSR_MERR_MASK = (3 << 2),
CHSR_MBERR = (1 << 2),
CHSR_MRERR = (2 << 2),
CHSR_MOERR = (3 << 2),
-   CHSR_DxERR_mask = (3 << 0),
+   CHSR_DERR_MASK = (3 << 0),
CHSR_DBERR = (1 << 0),
CHSR_DRERR = (2 << 0),
CHSR_DOERR = (3 << 0),
-- 
2.6.3

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


[PATCH 10/15] staging: comedi: mite: don't expose unnecessary register/bit info

2016-04-18 Thread H Hartley Sweeten
Most of the mite registers are only accessed by the mite driver.
There is no reason to expose the register/bit info. Remove this
info from the header.

For aesthetics, convert the bit info enums into defines and use
the BIT() macro to define them. Tidy up the inline functions for
the retry limit and drq reqs bits in the config registers.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/mite.c | 160 +++--
 drivers/staging/comedi/drivers/mite.h | 186 --
 2 files changed, 151 insertions(+), 195 deletions(-)

diff --git a/drivers/staging/comedi/drivers/mite.c 
b/drivers/staging/comedi/drivers/mite.c
index 2dcfa76..748f3ab 100644
--- a/drivers/staging/comedi/drivers/mite.c
+++ b/drivers/staging/comedi/drivers/mite.c
@@ -46,11 +46,142 @@
 
 #include 
 #include 
+#include 
 
 #include "../comedi_pci.h"
 
 #include "mite.h"
 
+/*
+ * Mite registers
+ */
+#define MITE_UNKNOWN_DMA_BURST_REG 0x28
+#define UNKNOWN_DMA_BURST_ENABLE_BITS  0x600
+
+#define MITE_PCI_CONFIG_OFFSET 0x300
+#define MITE_CSIGR 0x460   /* chip signature */
+#define CSIGR_TO_IOWINS(x) (((x) >> 29) & 0x7)
+#define CSIGR_TO_WINS(x)   (((x) >> 24) & 0x1f)
+#define CSIGR_TO_WPDEP(x)  (((x) >> 20) & 0x7)
+#define CSIGR_TO_DMAC(x)   (((x) >> 16) & 0xf)
+#define CSIGR_TO_IMODE(x)  (((x) >> 12) & 0x3) /* pci=0x3 */
+#define CSIGR_TO_MMODE(x)  (((x) >> 8) & 0x3)  /* minimite=1 */
+#define CSIGR_TO_TYPE(x)   (((x) >> 4) & 0xf)  /* mite=0, minimite=1 */
+#define CSIGR_TO_VER(x)(((x) >> 0) & 0xf)
+
+#define MITE_CHAN(x)   (0x500 + 0x100 * (x))
+#define MITE_CHOR(x)   (0x00 + MITE_CHAN(x))   /* channel operation */
+#define CHOR_DMARESET  BIT(31)
+#define CHOR_SET_SEND_TC   BIT(11)
+#define CHOR_CLR_SEND_TC   BIT(10)
+#define CHOR_SET_LPAUSEBIT(9)
+#define CHOR_CLR_LPAUSEBIT(8)
+#define CHOR_CLRDONE   BIT(7)
+#define CHOR_CLRRB BIT(6)
+#define CHOR_CLRLC BIT(5)
+#define CHOR_FRESETBIT(4)
+#define CHOR_ABORT BIT(3)  /* stop without emptying fifo */
+#define CHOR_STOP  BIT(2)  /* stop after emptying fifo */
+#define CHOR_CONT  BIT(1)
+#define CHOR_START BIT(0)
+#define MITE_CHCR(x)   (0x04 + MITE_CHAN(x))   /* channel control */
+#define CHCR_SET_DMA_IEBIT(31)
+#define CHCR_CLR_DMA_IEBIT(30)
+#define CHCR_SET_LINKP_IE  BIT(29)
+#define CHCR_CLR_LINKP_IE  BIT(28)
+#define CHCR_SET_SAR_IEBIT(27)
+#define CHCR_CLR_SAR_IEBIT(26)
+#define CHCR_SET_DONE_IE   BIT(25)
+#define CHCR_CLR_DONE_IE   BIT(24)
+#define CHCR_SET_MRDY_IE   BIT(23)
+#define CHCR_CLR_MRDY_IE   BIT(22)
+#define CHCR_SET_DRDY_IE   BIT(21)
+#define CHCR_CLR_DRDY_IE   BIT(20)
+#define CHCR_SET_LC_IE BIT(19)
+#define CHCR_CLR_LC_IE BIT(18)
+#define CHCR_SET_CONT_RB_IEBIT(17)
+#define CHCR_CLR_CONT_RB_IEBIT(16)
+#define CHCR_FIFO(x)   (((x) & 0x1) << 15)
+#define CHCR_FIFODIS   CHCR_FIFO(1)
+#define CHCR_FIFO_ON   CHCR_FIFO(0)
+#define CHCR_BURST(x)  (((x) & 0x1) << 14)
+#define CHCR_BURSTEN   CHCR_BURST(1)
+#define CHCR_NO_BURSTENCHCR_BURST(0)
+#define CHCR_BYTE_SWAP_DEVICE  BIT(6)
+#define CHCR_BYTE_SWAP_MEMORY  BIT(4)
+#define CHCR_DIR(x)(((x) & 0x1) << 3)
+#define CHCR_DEV_TO_MEMCHCR_DIR(1)
+#define CHCR_MEM_TO_DEVCHCR_DIR(0)
+#define CHCR_MODE(x)   (((x) & 0x7) << 0)
+#define CHCR_NORMALCHCR_MODE(0)
+#define CHCR_CONTINUE  CHCR_MODE(1)
+#define CHCR_RINGBUFF  CHCR_MODE(2)
+#define CHCR_LINKSHORT CHCR_MODE(4)
+#define CHCR_LINKLONG  CHCR_MODE(5)
+#define MITE_TCR(x)(0x08 + MITE_CHAN(x))   /* transfer count */
+#define MITE_MCR(x)(0x0c + MITE_CHAN(x))   /* memory config */
+#define MITE_MAR(x)(0x10 + MITE_CHAN(x))   /* memory address */
+#define MITE_DCR(x)(0x14 + MITE_CHAN(x))   /* device config */
+#define DCR_NORMAL BIT(29)
+#define MITE_DAR(x)(0x18 + MITE_CHAN(x))   /* device address */
+#define MITE_LKCR(x)   (0x1c + MITE_CHAN(x))   /* link config */
+#define MITE_LKAR(x)   (0x20 + MITE_CHAN(x))   /* link address */
+#define MITE_LLKAR(x)  (0x24 + MITE_CHAN(x))   /* see tnt5002 manual */
+#define MITE_BAR(x)(0x28 + MITE_CHAN(x))   /* base address */
+#define MITE_BCR(x)(0x2c + MITE_CHAN(x))   /* base count */
+#define MITE_SAR(x)(0x30 + MITE_CHAN(x))   /* ? address */
+#define MITE_WSCR(x)   (0x34 + MITE_CHAN(x))   /* ? */
+#define MITE_WSER(x)   (0x38 + MITE_CHAN(x))   /* ? */
+#define MITE_CHSR(x)   (0x3c + M

[PATCH 04/15] staging: comedi: mite: don't export internal functions

2016-04-18 Thread H Hartley Sweeten
The functions that get the number of bytes written to and read from
memory are only used internally by the mite driver when syncing the
dma channel. Make them static and remove the exports.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/mite.c | 12 
 drivers/staging/comedi/drivers/mite.h |  4 
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/comedi/drivers/mite.c 
b/drivers/staging/comedi/drivers/mite.c
index f846202..61ac527 100644
--- a/drivers/staging/comedi/drivers/mite.c
+++ b/drivers/staging/comedi/drivers/mite.c
@@ -488,44 +488,40 @@ u32 mite_bytes_in_transit(struct mite_channel *mite_chan)
 EXPORT_SYMBOL_GPL(mite_bytes_in_transit);
 
 /* returns lower bound for number of bytes transferred from device to memory */
-u32 mite_bytes_written_to_memory_lb(struct mite_channel *mite_chan)
+static u32 mite_bytes_written_to_memory_lb(struct mite_channel *mite_chan)
 {
u32 device_byte_count;
 
device_byte_count = mite_device_bytes_transferred(mite_chan);
return device_byte_count - mite_bytes_in_transit(mite_chan);
 }
-EXPORT_SYMBOL_GPL(mite_bytes_written_to_memory_lb);
 
 /* returns upper bound for number of bytes transferred from device to memory */
-u32 mite_bytes_written_to_memory_ub(struct mite_channel *mite_chan)
+static u32 mite_bytes_written_to_memory_ub(struct mite_channel *mite_chan)
 {
u32 in_transit_count;
 
in_transit_count = mite_bytes_in_transit(mite_chan);
return mite_device_bytes_transferred(mite_chan) - in_transit_count;
 }
-EXPORT_SYMBOL_GPL(mite_bytes_written_to_memory_ub);
 
 /* returns lower bound for number of bytes read from memory to device */
-u32 mite_bytes_read_from_memory_lb(struct mite_channel *mite_chan)
+static u32 mite_bytes_read_from_memory_lb(struct mite_channel *mite_chan)
 {
u32 device_byte_count;
 
device_byte_count = mite_device_bytes_transferred(mite_chan);
return device_byte_count + mite_bytes_in_transit(mite_chan);
 }
-EXPORT_SYMBOL_GPL(mite_bytes_read_from_memory_lb);
 
 /* returns upper bound for number of bytes read from memory to device */
-u32 mite_bytes_read_from_memory_ub(struct mite_channel *mite_chan)
+static u32 mite_bytes_read_from_memory_ub(struct mite_channel *mite_chan)
 {
u32 in_transit_count;
 
in_transit_count = mite_bytes_in_transit(mite_chan);
return mite_device_bytes_transferred(mite_chan) + in_transit_count;
 }
-EXPORT_SYMBOL_GPL(mite_bytes_read_from_memory_ub);
 
 void mite_dma_disarm(struct mite_channel *mite_chan)
 {
diff --git a/drivers/staging/comedi/drivers/mite.h 
b/drivers/staging/comedi/drivers/mite.h
index 9003476..583c60f 100644
--- a/drivers/staging/comedi/drivers/mite.h
+++ b/drivers/staging/comedi/drivers/mite.h
@@ -98,10 +98,6 @@ int mite_sync_input_dma(struct mite_channel *mite_chan,
struct comedi_subdevice *s);
 int mite_sync_output_dma(struct mite_channel *mite_chan,
 struct comedi_subdevice *s);
-u32 mite_bytes_written_to_memory_lb(struct mite_channel *mite_chan);
-u32 mite_bytes_written_to_memory_ub(struct mite_channel *mite_chan);
-u32 mite_bytes_read_from_memory_lb(struct mite_channel *mite_chan);
-u32 mite_bytes_read_from_memory_ub(struct mite_channel *mite_chan);
 u32 mite_bytes_in_transit(struct mite_channel *mite_chan);
 unsigned int mite_get_status(struct mite_channel *mite_chan);
 int mite_done(struct mite_channel *mite_chan);
-- 
2.6.3

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


[PATCH 11/15] staging: comedi: mite: introduce mite_sync_dma()

2016-04-18 Thread H Hartley Sweeten
The struct mite_channel 'dir' member specifies if the dma is input
or output. Wrap the mite_sync_input_dma() and mite_sync_output_dma()
functions with a single mite_sync_dma() so that the drivers don't
have to worry about the sync direction.

The functions that actually sync the input/output dma currently return
-1 if an overflow/underrun is detected otherwise they return 0. If an
overflow/underrun is detected the async->event COMEDI_CB_OVERFLOW is
also set.

The callers never check the return value anyway so just make the
functions return void. The async->event can be checked if necessary
to detect any errors.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/mite.c  | 43 +-
 drivers/staging/comedi/drivers/mite.h  |  5 +--
 drivers/staging/comedi/drivers/ni_660x.c   |  2 +-
 drivers/staging/comedi/drivers/ni_mio_common.c |  6 ++--
 drivers/staging/comedi/drivers/ni_pcidio.c |  4 +--
 drivers/staging/comedi/drivers/ni_tiocmd.c |  2 +-
 6 files changed, 30 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/comedi/drivers/mite.c 
b/drivers/staging/comedi/drivers/mite.c
index 748f3ab..d5475cd 100644
--- a/drivers/staging/comedi/drivers/mite.c
+++ b/drivers/staging/comedi/drivers/mite.c
@@ -680,8 +680,8 @@ void mite_dma_disarm(struct mite_channel *mite_chan)
 }
 EXPORT_SYMBOL_GPL(mite_dma_disarm);
 
-int mite_sync_input_dma(struct mite_channel *mite_chan,
-   struct comedi_subdevice *s)
+static void mite_sync_input_dma(struct mite_channel *mite_chan,
+   struct comedi_subdevice *s)
 {
struct comedi_async *async = s->async;
int count;
@@ -697,7 +697,7 @@ int mite_sync_input_dma(struct mite_channel *mite_chan,
dev_warn(s->device->class_dev,
 "mite: DMA overwrite of free area\n");
async->events |= COMEDI_CB_OVERFLOW;
-   return -1;
+   return;
}
 
count = nbytes - async->buf_write_count;
@@ -705,18 +705,15 @@ int mite_sync_input_dma(struct mite_channel *mite_chan,
 * it's possible count will be negative due to conservative value
 * returned by mite_bytes_written_to_memory_lb
 */
-   if (count <= 0)
-   return 0;
-
-   comedi_buf_write_free(s, count);
-   comedi_inc_scan_progress(s, count);
-   async->events |= COMEDI_CB_BLOCK;
-   return 0;
+   if (count > 0) {
+   comedi_buf_write_free(s, count);
+   comedi_inc_scan_progress(s, count);
+   async->events |= COMEDI_CB_BLOCK;
+   }
 }
-EXPORT_SYMBOL_GPL(mite_sync_input_dma);
 
-int mite_sync_output_dma(struct mite_channel *mite_chan,
-struct comedi_subdevice *s)
+static void mite_sync_output_dma(struct mite_channel *mite_chan,
+struct comedi_subdevice *s)
 {
struct comedi_async *async = s->async;
struct comedi_cmd *cmd = &async->cmd;
@@ -739,7 +736,7 @@ int mite_sync_output_dma(struct mite_channel *mite_chan,
((int)(nbytes_ub - old_alloc_count) > 0)) {
dev_warn(s->device->class_dev, "mite: DMA underrun\n");
async->events |= COMEDI_CB_OVERFLOW;
-   return -1;
+   return;
}
 
if (finite_regen) {
@@ -749,20 +746,24 @@ int mite_sync_output_dma(struct mite_channel *mite_chan,
 * hence we expect that old_alloc_count will reach a maximum of
 * stop_count bytes.
 */
-   return 0;
+   return;
}
 
count = nbytes_lb - async->buf_read_count;
-   if (count <= 0)
-   return 0;
-
-   if (count) {
+   if (count > 0) {
comedi_buf_read_free(s, count);
async->events |= COMEDI_CB_BLOCK;
}
-   return 0;
 }
-EXPORT_SYMBOL_GPL(mite_sync_output_dma);
+
+void mite_sync_dma(struct mite_channel *mite_chan, struct comedi_subdevice *s)
+{
+   if (mite_chan->dir == COMEDI_INPUT)
+   mite_sync_input_dma(mite_chan, s);
+   else
+   mite_sync_output_dma(mite_chan, s);
+}
+EXPORT_SYMBOL_GPL(mite_sync_dma);
 
 static unsigned int mite_get_status(struct mite_channel *mite_chan)
 {
diff --git a/drivers/staging/comedi/drivers/mite.h 
b/drivers/staging/comedi/drivers/mite.h
index 8d20385..9982539 100644
--- a/drivers/staging/comedi/drivers/mite.h
+++ b/drivers/staging/comedi/drivers/mite.h
@@ -90,10 +90,7 @@ void mite_release_channel(struct mite_channel *mite_chan);
 
 void mite_dma_arm(struct mite_channel *mite_chan);
 void mite_dma_disarm(struct mite_channel *mite_chan);
-int mite_sync_input_dma(struct mite_channel *mite_chan,
-   struct comedi_subdevice *s);
-int mite_sync_output_dma(struct mite_channel *mite_chan,
-struct comedi_subdevice *s);

Re: [PATCH] Input: i8042 - Fix console keyboard support on Gen2 Hyper-V VMs

2016-04-18 Thread Dan Carpenter
On Tue, Apr 19, 2016 at 02:24:47AM +0900, Mark Laws wrote:
> On Tue, Apr 19, 2016 at 1:54 AM, Dan Carpenter  
> wrote:
> > So if the user inserts the module without a keyboard then in the
> > original code they would just put a keyboard in and try again.  Now they
> > have to do an extra rmmod.  What about if we just removed the test for
> > if the keyboard is present?
> 
> Sorry, I don't understand--which part are you suggesting we remove?
> 

The call to i8042_controller_check() or move it to the probe function or
something.  Why must we have the hardware to load the module?

regards,
dan carpenter

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


Re: [PATCH v2 4/4] drivers: staging: remove BUG_ON

2016-04-18 Thread Laura Abbott

On 04/17/2016 05:35 PM, Tobin C Harding wrote:

drivers/staging/android/ion/ion.c calls BUG_ON in places where WARN_ON will
suffice.

This patch replaces two such occurences. Two other occurences remain.



You got the logic flow correct but I'd prefer to keep the BUG_ON.
It's catching actual bugs in the framework.


Signed-off-by: Tobin C Harding 
---

Changing the remaining two BUG_ON's causes changes to the programm logic.

This is my first patch set to the kernel, I am as such, not comfortable
changeing the logic of this file at this early stage of the game. :)

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

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 234848f..1e37f52 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -325,7 +325,7 @@ static void ion_buffer_remove_from_handle(struct ion_buffer 
*buffer)
 */
mutex_lock(&buffer->lock);
buffer->handle_count--;
-   BUG_ON(buffer->handle_count < 0);
+   WARN_ON(buffer->handle_count < 0);
if (!buffer->handle_count) {
struct task_struct *task;

@@ -556,7 +556,10 @@ static void ion_free_nolock(struct ion_client *client,
  {
bool valid_handle;

-   BUG_ON(client != handle->client);
+   if (client != handle->client) {
+   WARN(1, "%s: client != handle->client.\n", __func__);
+   return;
+   }

valid_handle = ion_handle_validate(client, handle);

@@ -569,7 +572,10 @@ static void ion_free_nolock(struct ion_client *client,

  void ion_free(struct ion_client *client, struct ion_handle *handle)
  {
-   BUG_ON(client != handle->client);
+   if (client != handle->client) {
+   WARN(1, "%s: client != handle->client.\n", __func__);
+   return;
+   }

mutex_lock(&client->lock);
ion_free_nolock(client, handle);



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


Re: [PATCH] Input: i8042 - Fix console keyboard support on Gen2 Hyper-V VMs

2016-04-18 Thread Mark Laws
On Tue, Apr 19, 2016 at 5:36 AM, Dan Carpenter  wrote:
> On Tue, Apr 19, 2016 at 02:24:47AM +0900, Mark Laws wrote:
>> Sorry, I don't understand--which part are you suggesting we remove?
>
> The call to i8042_controller_check() or move it to the probe function or
> something.  Why must we have the hardware to load the module?

We don't. That's the point of the patch. Do you mean that since our
intent is to load the module regardless of whether or not the hardware
is there, the check should be (re)moved simply to clarify the code?

Sorry for the stupid questions--I'm just trying to make sure I
understand you correctly!

Regards,
Mark Laws

-- 
|v\ /\ |\ |< |_ /\ \^| //
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/3] staging: wilc1000: change handle_set_ip_address's return type to void

2016-04-18 Thread Chaehyun Lim
When handle_set_ip_address is called in hostIFthread that is a kernel
thread, it is not checked return type of this function. This patch
changes return type to void and removes braces if statement due to have
a single statement.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index ac620fb..87c8789 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -349,7 +349,7 @@ static void handle_set_operation_mode(struct wilc_vif *vif,
netdev_err(vif->ndev, "Failed to set driver handler\n");
 }
 
-static s32 handle_set_ip_address(struct wilc_vif *vif, u8 *ip_addr, u8 idx)
+static void handle_set_ip_address(struct wilc_vif *vif, u8 *ip_addr, u8 idx)
 {
s32 result = 0;
struct wid wid;
@@ -370,12 +370,8 @@ static s32 handle_set_ip_address(struct wilc_vif *vif, u8 
*ip_addr, u8 idx)
 
host_int_get_ipaddress(vif, firmware_ip_addr, idx);
 
-   if (result) {
+   if (result)
netdev_err(vif->ndev, "Failed to set IP address\n");
-   return -EINVAL;
-   }
-
-   return result;
 }
 
 static s32 handle_get_ip_address(struct wilc_vif *vif, u8 idx)
-- 
2.8.0

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


[PATCH 3/3] staging: wilc1000: rename result in handle_set_ip_address

2016-04-18 Thread Chaehyun Lim
This patch renames result to ret that is used to get return value from
wilc_send_config_pkt. Some handle_*() functions are used as result,
others are used as ret. It will be changed as ret in all handle_*()
functions to match variable name.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 9ddb238..5d352aa 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -351,7 +351,7 @@ static void handle_set_operation_mode(struct wilc_vif *vif,
 
 static void handle_set_ip_address(struct wilc_vif *vif, u8 *ip_addr, u8 idx)
 {
-   int result = 0;
+   int ret = 0;
struct wid wid;
char firmware_ip_addr[4] = {0};
 
@@ -365,12 +365,12 @@ static void handle_set_ip_address(struct wilc_vif *vif, 
u8 *ip_addr, u8 idx)
wid.val = (u8 *)ip_addr;
wid.size = IP_ALEN;
 
-   result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
+   ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
+  wilc_get_vif_idx(vif));
 
host_int_get_ipaddress(vif, firmware_ip_addr, idx);
 
-   if (result)
+   if (ret)
netdev_err(vif->ndev, "Failed to set IP address\n");
 }
 
-- 
2.8.0

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


[PATCH 2/3] staging: wilc1000: change data type of result in handle_set_ip_address

2016-04-18 Thread Chaehyun Lim
This patch changes data type of result variable from s32 to int. result
is used to get return value from wilc_send_config_pkt that has return
type of int.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 87c8789..9ddb238 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -351,7 +351,7 @@ static void handle_set_operation_mode(struct wilc_vif *vif,
 
 static void handle_set_ip_address(struct wilc_vif *vif, u8 *ip_addr, u8 idx)
 {
-   s32 result = 0;
+   int result = 0;
struct wid wid;
char firmware_ip_addr[4] = {0};
 
-- 
2.8.0

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


[PATCH 1/3] staging: unisys: include: remove unused fields from struct visor_driver

2016-04-18 Thread David Kershner
From: Tim Sell 

The build_date and build_time fields are not used, and have been removed.

Signed-off-by: Tim Sell 
Signed-off-by: David Kershner 
---
 drivers/staging/unisys/include/visorbus.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/unisys/include/visorbus.h 
b/drivers/staging/unisys/include/visorbus.h
index db59d97..3cc511f 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -68,8 +68,6 @@ struct visor_driver {
const char *name;
const char *version;
const char *vertag;
-   const char *build_date;
-   const char *build_time;
struct module *owner;
 
/** Types of channels handled by this driver, ending with 0 GUID.
-- 
1.9.1

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


[PATCH 0/3] staging: unisys: add polish to structs: visor_driver and visor_device

2016-04-18 Thread David Kershner
For 'struct visor_driver' and 'struct visor_device': 
 * unused members have been removed 
 * kernel-doc comments have been added

Alexander Curtin (2):
  staging: unisys: include: Added kernel-doc for struct visor_driver
  staging: unisys: include: Added kerneldoc comments to visor_device

Tim Sell (1):
  staging: unisys: include: remove unused fields from struct
visor_driver

 drivers/staging/unisys/include/visorbus.h | 112 ++
 1 file changed, 68 insertions(+), 44 deletions(-)

-- 
1.9.1

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


[PATCH 2/3] staging: unisys: include: Added kernel-doc for struct visor_driver

2016-04-18 Thread David Kershner
From: Alexander Curtin 

This adds kerneldoc style comments to the visor_driver struct since
it's shared between multiple modules.

Signed-off-by: Alexander Curtin 
Signed-off-by: Tim Sell 
Signed-off-by: David Kershner 
---
 drivers/staging/unisys/include/visorbus.h | 65 ---
 1 file changed, 34 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/unisys/include/visorbus.h 
b/drivers/staging/unisys/include/visorbus.h
index 3cc511f..9cc492a 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -61,52 +61,55 @@ struct visor_channeltype_descriptor {
const char *name;
 };
 
-/** Information provided by each visor driver when it registers with the
- *  visorbus driver.
+/**
+ * struct visor_driver - Information provided by each visor driver when it
+ * registers with the visorbus driver.
+ * @name:  Name of the visor driver.
+ * @version:   The numbered version of the driver (x.x.xxx).
+ * @vertag:A human readable version string.
+ * @owner: The module owner.
+ * @channel_types: Types of channels handled by this driver, ending with
+ * a zero GUID. Our specialized BUS.match() method knows
+ * about this list, and uses it to determine whether this
+ * driver will in fact handle a new device that it has
+ * detected.
+ * @probe: Called when a new device comes online, by our probe()
+ * function specified by driver.probe() (triggered
+ * ultimately by some call to driver_register(),
+ * bus_add_driver(), or driver_attach()).
+ * @remove:Called when a new device is removed, by our remove()
+ * function specified by driver.remove() (triggered
+ * ultimately by some call to device_release_driver()).
+ * @channel_interrupt: Called periodically, whenever there is a possiblity
+ * that "something interesting" may have happened to the
+ * channel.
+ * @pause: Called to initiate a change of the device's state.  If
+ * the return valu`e is < 0, there was an error and the
+ * state transition will NOT occur.  If the return value
+ * is >= 0, then the state transition was INITIATED
+ * successfully, and complete_func() will be called (or
+ * was just called) with the final status when either the
+ * state transition fails or completes successfully.
+ * @resume:Behaves similar to pause.
+ * @driver:Private reference to the device driver. For use by bus
+ * driver only.
+ * @version_attr:  Private version field. For use by bus driver only.
  */
 struct visor_driver {
const char *name;
const char *version;
const char *vertag;
struct module *owner;
-
-   /** Types of channels handled by this driver, ending with 0 GUID.
-*  Our specialized BUS.match() method knows about this list, and
-*  uses it to determine whether this driver will in fact handle a
-*  new device that it has detected.
-*/
struct visor_channeltype_descriptor *channel_types;
-
-   /** Called when a new device comes online, by our probe() function
-*  specified by driver.probe() (triggered ultimately by some call
-*  to driver_register() / bus_add_driver() / driver_attach()).
-*/
int (*probe)(struct visor_device *dev);
-
-   /** Called when a new device is removed, by our remove() function
-*  specified by driver.remove() (triggered ultimately by some call
-*  to device_release_driver()).
-*/
void (*remove)(struct visor_device *dev);
-
-   /** Called periodically, whenever there is a possibility that
-*  "something interesting" may have happened to the channel state.
-*/
void (*channel_interrupt)(struct visor_device *dev);
-
-   /** Called to initiate a change of the device's state.  If the return
-*  valu`e is < 0, there was an error and the state transition will NOT
-*  occur.  If the return value is >= 0, then the state transition was
-*  INITIATED successfully, and complete_func() will be called (or was
-*  just called) with the final status when either the state transition
-*  fails or completes successfully.
-*/
int (*pause)(struct visor_device *dev,
 visorbus_state_complete_func complete_func);
int (*resume)(struct visor_device *dev,
  visorbus_state_complete_func complete_func);
 
-   /** These fields are for private use by the bus driver only. */
+   /* These fields are for private use by the bus driver only. */

[PATCH 3/3] staging: unisys: include: Added kerneldoc comments to visor_device

2016-04-18 Thread David Kershner
From: Alexander Curtin 

The visor_device struct is used between multiple drivers, so this
adds kerneldoc comments to the fields.

Signed-off-by: Alexander Curtin 
Signed-off-by: Tim Sell 
Signed-off-by: David Kershner 
---
 drivers/staging/unisys/include/visorbus.h | 45 +++
 1 file changed, 34 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/unisys/include/visorbus.h 
b/drivers/staging/unisys/include/visorbus.h
index 9cc492a..9baf1ec 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -117,25 +117,48 @@ struct visor_driver {
 #define to_visor_driver(x) ((x) ? \
(container_of(x, struct visor_driver, driver)) : (NULL))
 
-/** A device type for things "plugged" into the visorbus bus */
+/**
+ * struct visor_device - A device type for things "plugged" into the visorbus
+ * bus
+ * visorchannel:   Points to the channel that the device is
+ * associated with.
+ * channel_type_guid:  Identifies the channel type to the bus driver.
+ * device: Device struct meant for use by the bus driver
+ * only.
+ * list_all:   Used by the bus driver to enumerate devices.
+ * periodic_work:  Device work queue. Private use by bus driver
+ * only.
+ * being_removed:  Indicates that the device is being removed from
+ * the bus. Private bus driver use only.
+ * visordriver_callback_lock:  Used by the bus driver to lock when handling
+ * channel events.
+ * pausing:Indicates that a change towards a paused state.
+ * is in progress. Only modified by the bus driver.
+ * resuming:   Indicates that a change towards a running state
+ * is in progress. Only modified by the bus driver.
+ * chipset_bus_no: Private field used by the bus driver.
+ * chipset_dev_no: Private field used the bus driver.
+ * state:  Used to indicate the current state of the
+ * device.
+ * inst:   Unique GUID for this instance of the device.
+ * name:   Name of the device.
+ * pending_msg_hdr:For private use by bus driver to respond to
+ * hypervisor requests.
+ * vbus_hdr_info:  A pointer to header info. Private use by bus
+ * driver.
+ * partition_uuid: Indicates client partion id. This should be the
+ * same across all visor_devices in the current
+ * guest. Private use by bus driver only.
+ */
 
 struct visor_device {
-   /** visor driver can use the visorchannel member with the functions
-*  defined in visorchannel.h to access the channel
-*/
struct visorchannel *visorchannel;
uuid_le channel_type_guid;
-
-   /** These fields are for private use by the bus driver only.
-*  A notable exception is that the visor driver can use
-*  visor_get_drvdata() and visor_set_drvdata() to retrieve or stash
-*  private visor driver specific data within the device member.
-*/
+   /* These fields are for private use by the bus driver only. */
struct device device;
struct list_head list_all;
struct periodic_work *periodic_work;
bool being_removed;
-   /* the code will detect and behave appropriately) */
struct semaphore visordriver_callback_lock;
bool pausing;
bool resuming;
-- 
1.9.1

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


[PATCH] staging: unisys: visorbus: initialize variables

2016-04-18 Thread David Kershner
From: David Binder 

Initializes previously uninitialized variables that were flagged
as being problematic by Smatch.

Signed-off-by: David Binder 
Signed-off-by: David Kershner 
---
 drivers/staging/unisys/visorbus/visorchipset.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index c1b872c..ce2a80e 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -512,7 +512,7 @@ static ssize_t toolaction_show(struct device *dev,
   struct device_attribute *attr,
   char *buf)
 {
-   u8 tool_action;
+   u8 tool_action = 0;
 
visorchannel_read(controlvm_channel,
  offsetof(struct spar_controlvm_channel_protocol,
@@ -580,7 +580,7 @@ static ssize_t boottotool_store(struct device *dev,
 static ssize_t error_show(struct device *dev, struct device_attribute *attr,
  char *buf)
 {
-   u32 error;
+   u32 error = 0;
 
visorchannel_read(controlvm_channel,
  offsetof(struct spar_controlvm_channel_protocol,
@@ -611,7 +611,7 @@ static ssize_t error_store(struct device *dev, struct 
device_attribute *attr,
 static ssize_t textid_show(struct device *dev, struct device_attribute *attr,
   char *buf)
 {
-   u32 text_id;
+   u32 text_id = 0;
 
visorchannel_read
(controlvm_channel,
@@ -643,7 +643,7 @@ static ssize_t textid_store(struct device *dev, struct 
device_attribute *attr,
 static ssize_t remaining_steps_show(struct device *dev,
struct device_attribute *attr, char *buf)
 {
-   u16 remaining_steps;
+   u16 remaining_steps = 0;
 
visorchannel_read(controlvm_channel,
  offsetof(struct spar_controlvm_channel_protocol,
-- 
1.9.1

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