Use of schedule() function while holding a lock in ql4_nx.c

2016-09-11 Thread Vaishali Thakkar
Hello,

I was wondering about the call to schedule in function qla4_82xx_crb_win_lock 
for driver
drivers/scsi/qla4xxx/ql4_nx.c. It is called in 2 functions [qla4_82xx_rd_32 and
qla4_82xx_wr_32] while holding a write_lock_irqsave. Normally we avoid using 
sleeping
functions while holding a lock.

Is there some reason that I am overlooking? Why it is OK in this case? Are we 
using
schedule() here intentionally?

Thank you.


-- 
Vaishali
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: dtc, pas16 and t128 removal, was Re: status of NCR5380-based ISA drivers

2016-09-11 Thread Finn Thain

On Mon, 12 Sep 2016, I wrote:

> 
> BTW, DTC3x80 support (NCR 53C406 chip I believe) should be easy to do in 
> g_NCR5380, which already supports the DTC3181E card.
> 

Sorry, I should have written DTC406 chip, which is "supposedly compatible 
with the NCR 53C400" but is nothing like a NCR 53C406.

-- 
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


dtc, pas16 and t128 removal, was Re: status of NCR5380-based ISA drivers

2016-09-11 Thread Finn Thain

On Sun, 11 Sep 2016, Christoph Hellwig wrote:

> Hi all,
> 
> you seem to the currently active NCR580 cabal.  Which frontends to 
> NCR5380 do you test at the moment, or could you test?

I test the dmx3191d and mac_scsi drivers.

> 
> NCR5380-based ISA drivers make up a significant part of those drivers 
> still using scsi_module.c after it's 15 year deprecation period, and I'd 
> like to either move them to this century or to the dust bin.
> 
> The drivers in question are: dtc, g_NCR5380, pas16 and t128.

I don't have any hardware with an ISA slot so I take a best-effort 
approach to maintaining those drivers.

I have not heard of anyone actually using dtc, pas16 or t128 so I don't 
mind seeing them removed (along with Documentation/scsi/dtc3x80.txt).

BTW, DTC3x80 support (NCR 53C406 chip I believe) should be easy to do in 
g_NCR5380, which already supports the DTC3181E card.

-- 

> 
> Thanks,
>   Christoph
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/26] constify local structures

2016-09-11 Thread Julia Lawall

On Sun, 11 Sep 2016, Joe Perches wrote:

> On Sun, 2016-09-11 at 15:05 +0200, Julia Lawall wrote:
> > Constify local structures.
>
> Thanks Julia.
>
> A few suggestions & questions:
>
> Perhaps the script should go into scripts/coccinelle/
> so that future cases could be caught by the robot
> and commit message referenced by the patch instances.

OK.

> Can you please compile the files modified using the
> appropriate defconfig/allyesconfig and show the

I currently send patches for this issue only for files that compile using
the x86 allyesconfig.

> movement from data to const by using
>   $ size .new/old
> and include that in the changelogs (maybe next time)?

OK, thanks for the suggestion.

> Is it possible for a rule to trace the instances where
> an address of a struct or struct member is taken by
> locally defined and declared function call where the
> callee does not modify any dereferenced object?
>
> ie:
>
> struct foo {
>   int bar;
>   char *baz;
> };
>
> struct foo qux[] = {
>   { 1, "description 1" },
>   { 2, "dewcription 2" },
>   [ n, "etc" ]...,
> };
>
> void message(struct foo *msg)
> {
>   printk("%d %s\n", msg->bar, msg->baz);
> }
>
> where some code uses
>
>   message(qux[index]);
>
> So could a coccinelle script change:
>
> struct foo qux[] = { to const struct foo quz[] = {
>
> and
>
> void message(struct foo *msg) to void message(const struct foo *msg)

Yes, this could be possible too.

Thanks for the feedback.

julia
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/26] constify local structures

2016-09-11 Thread Joe Perches
On Sun, 2016-09-11 at 15:05 +0200, Julia Lawall wrote:
> Constify local structures.

Thanks Julia.

A few suggestions & questions:

Perhaps the script should go into scripts/coccinelle/
so that future cases could be caught by the robot
and commit message referenced by the patch instances.

Can you please compile the files modified using the
appropriate defconfig/allyesconfig and show the
movement from data to const by using
$ size .new/old
and include that in the changelogs (maybe next time)?

Is it possible for a rule to trace the instances where
an address of a struct or struct member is taken by
locally defined and declared function call where the
callee does not modify any dereferenced object?

ie:

struct foo {
int bar;
char *baz;
};

struct foo qux[] = {
{ 1, "description 1" },
{ 2, "dewcription 2" },
[ n, "etc" ]...,
};

void message(struct foo *msg)
{
printk("%d %s\n", msg->bar, msg->baz);
}

where some code uses

message(qux[index]);

So could a coccinelle script change:

struct foo qux[] = { to const struct foo quz[] = {

and

void message(struct foo *msg) to void message(const struct foo *msg)

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] qla2xxx: use struct t10_pi_tuple

2016-09-11 Thread Christoph Hellwig
Instead of defining a local version of it.

Signed-off-by: Christoph Hellwig 
---
 drivers/scsi/qla2xxx/qla_def.h | 10 --
 drivers/scsi/qla2xxx/qla_isr.c |  2 +-
 2 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index ae4a747..73b12e4 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -279,16 +279,6 @@ struct req_que;
 struct qla_tgt_sess;
 
 /*
- * (sd.h is not exported, hence local inclusion)
- * Data Integrity Field tuple.
- */
-struct sd_dif_tuple {
-   __be16 guard_tag;   /* Checksum */
-   __be16 app_tag; /* Opaque storage */
-   __be32 ref_tag; /* Target LBA or indirect LBA */
-};
-
-/*
  * SCSI Request Block
  */
 struct srb_cmd {
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 987f1c7..068c4e4 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1828,7 +1828,7 @@ qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx 
*sts24)
if (scsi_prot_sg_count(cmd)) {
uint32_t i, j = 0, k = 0, num_ent;
struct scatterlist *sg;
-   struct sd_dif_tuple *spt;
+   struct t10_pi_tuple *spt;
 
/* Patch the corresponding protection tags */
scsi_for_each_prot_sg(cmd, sg,
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] sd: move DIF protection types to t10-pi.h

2016-09-11 Thread Christoph Hellwig
These should go together with the rest of the T10 protection
information defintions.

Signed-off-by: Christoph Hellwig 
---
 drivers/scsi/scsi_debug.c | 39 +++
 drivers/scsi/sd.c | 11 ++-
 drivers/scsi/sd.h | 21 -
 drivers/scsi/sd_dif.c | 10 +-
 include/linux/t10-pi.h| 20 
 5 files changed, 50 insertions(+), 51 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 044fc93..5f0695a 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -1350,7 +1350,7 @@ static int resp_inquiry(struct scsi_cmnd *scp, struct 
sdebug_dev_info *devip)
} else if (0x86 == cmd[2]) { /* extended inquiry */
arr[1] = cmd[2];/*sanity */
arr[3] = 0x3c;  /* number of following entries */
-   if (sdebug_dif == SD_DIF_TYPE3_PROTECTION)
+   if (sdebug_dif == T10_DIF_TYPE3_PROTECTION)
arr[4] = 0x4;   /* SPT: GRD_CHK:1 */
else if (have_dif_prot)
arr[4] = 0x5;   /* SPT: GRD_CHK:1, REF_CHK:1 */
@@ -2443,13 +2443,13 @@ static int dif_verify(struct t10_pi_tuple *sdt, const 
void *data,
be16_to_cpu(csum));
return 0x01;
}
-   if (sdebug_dif == SD_DIF_TYPE1_PROTECTION &&
+   if (sdebug_dif == T10_DIF_TYPE1_PROTECTION &&
be32_to_cpu(sdt->ref_tag) != (sector & 0x)) {
pr_err("REF check failed on sector %lu\n",
(unsigned long)sector);
return 0x03;
}
-   if (sdebug_dif == SD_DIF_TYPE2_PROTECTION &&
+   if (sdebug_dif == T10_DIF_TYPE2_PROTECTION &&
be32_to_cpu(sdt->ref_tag) != ei_lba) {
pr_err("REF check failed on sector %lu\n",
(unsigned long)sector);
@@ -2581,13 +2581,13 @@ static int resp_read_dt0(struct scsi_cmnd *scp, struct 
sdebug_dev_info *devip)
break;
}
if (unlikely(have_dif_prot && check_prot)) {
-   if (sdebug_dif == SD_DIF_TYPE2_PROTECTION &&
+   if (sdebug_dif == T10_DIF_TYPE2_PROTECTION &&
(cmd[1] & 0xe0)) {
mk_sense_invalid_opcode(scp);
return check_condition_result;
}
-   if ((sdebug_dif == SD_DIF_TYPE1_PROTECTION ||
-sdebug_dif == SD_DIF_TYPE3_PROTECTION) &&
+   if ((sdebug_dif == T10_DIF_TYPE1_PROTECTION ||
+sdebug_dif == T10_DIF_TYPE3_PROTECTION) &&
(cmd[1] & 0xe0) == 0)
sdev_printk(KERN_ERR, scp->device, "Unprotected RD "
"to DIF device\n");
@@ -2894,13 +2894,13 @@ static int resp_write_dt0(struct scsi_cmnd *scp, struct 
sdebug_dev_info *devip)
break;
}
if (unlikely(have_dif_prot && check_prot)) {
-   if (sdebug_dif == SD_DIF_TYPE2_PROTECTION &&
+   if (sdebug_dif == T10_DIF_TYPE2_PROTECTION &&
(cmd[1] & 0xe0)) {
mk_sense_invalid_opcode(scp);
return check_condition_result;
}
-   if ((sdebug_dif == SD_DIF_TYPE1_PROTECTION ||
-sdebug_dif == SD_DIF_TYPE3_PROTECTION) &&
+   if ((sdebug_dif == T10_DIF_TYPE1_PROTECTION ||
+sdebug_dif == T10_DIF_TYPE3_PROTECTION) &&
(cmd[1] & 0xe0) == 0)
sdev_printk(KERN_ERR, scp->device, "Unprotected WR "
"to DIF device\n");
@@ -3136,13 +3136,13 @@ static int resp_comp_write(struct scsi_cmnd *scp,
num = cmd[13];  /* 1 to a maximum of 255 logical blocks */
if (0 == num)
return 0;   /* degenerate case, not an error */
-   if (sdebug_dif == SD_DIF_TYPE2_PROTECTION &&
+   if (sdebug_dif == T10_DIF_TYPE2_PROTECTION &&
(cmd[1] & 0xe0)) {
mk_sense_invalid_opcode(scp);
return check_condition_result;
}
-   if ((sdebug_dif == SD_DIF_TYPE1_PROTECTION ||
-sdebug_dif == SD_DIF_TYPE3_PROTECTION) &&
+   if ((sdebug_dif == T10_DIF_TYPE1_PROTECTION ||
+sdebug_dif == T10_DIF_TYPE3_PROTECTION) &&
(cmd[1] & 0xe0) == 0)
sdev_printk(KERN_ERR, scp->device, "Unprotected WR "
"to DIF device\n");
@@ -4940,12 +4940,11 @@ static int __init scsi_debug_init(void)
}
 
switch (sdebug_dif) {
-
-   case SD_DIF_TYPE0_PROTECTION:
+   case T10_DIF_TYPE0_PROTECTION:
break;
-   case SD_DIF_TYPE1_PROTECTION:
-   case SD_DIF_TYPE2_PROTECTION:
-   case SD_DIF_TYPE3_PROTECTION:
+  

consolidate T10 PI defintions

2016-09-11 Thread Christoph Hellwig
Hi Martin,

this series ensures scsi_debug and qla2xxx use the common t10_pi_tuple
defintion, and then also moves the remaining T10 PI related defintions
to .

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] scsi_debug: use struct t10_pi_tuple instead of struct sd_dif_tuple

2016-09-11 Thread Christoph Hellwig
And remove the declaration of the latter in sd.h as scsi_debug was the
only user.

Signed-off-by: Christoph Hellwig 
---
 drivers/scsi/scsi_debug.c | 15 ---
 drivers/scsi/sd.h |  9 -
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 6a219a0..044fc93 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -627,7 +628,7 @@ static LIST_HEAD(sdebug_host_list);
 static DEFINE_SPINLOCK(sdebug_host_list_lock);
 
 static unsigned char *fake_storep; /* ramdisk storage */
-static struct sd_dif_tuple *dif_storep;/* protection info */
+static struct t10_pi_tuple *dif_storep;/* protection info */
 static void *map_storep;   /* provisioning map */
 
 static unsigned long map_size;
@@ -682,7 +683,7 @@ static void *fake_store(unsigned long long lba)
return fake_storep + lba * sdebug_sector_size;
 }
 
-static struct sd_dif_tuple *dif_store(sector_t sector)
+static struct t10_pi_tuple *dif_store(sector_t sector)
 {
sector = sector_div(sector, sdebug_store_sectors);
 
@@ -2430,7 +2431,7 @@ static __be16 dif_compute_csum(const void *buf, int len)
return csum;
 }
 
-static int dif_verify(struct sd_dif_tuple *sdt, const void *data,
+static int dif_verify(struct t10_pi_tuple *sdt, const void *data,
  sector_t sector, u32 ei_lba)
 {
__be16 csum = dif_compute_csum(data, sdebug_sector_size);
@@ -2504,7 +2505,7 @@ static int prot_verify_read(struct scsi_cmnd *SCpnt, 
sector_t start_sec,
unsigned int sectors, u32 ei_lba)
 {
unsigned int i;
-   struct sd_dif_tuple *sdt;
+   struct t10_pi_tuple *sdt;
sector_t sector;
 
for (i = 0; i < sectors; i++, ei_lba++) {
@@ -2696,7 +2697,7 @@ static int prot_verify_write(struct scsi_cmnd *SCpnt, 
sector_t start_sec,
 unsigned int sectors, u32 ei_lba)
 {
int ret;
-   struct sd_dif_tuple *sdt;
+   struct t10_pi_tuple *sdt;
void *daddr;
sector_t sector = start_sec;
int ppage_offset;
@@ -2722,7 +2723,7 @@ static int prot_verify_write(struct scsi_cmnd *SCpnt, 
sector_t start_sec,
}
 
for (ppage_offset = 0; ppage_offset < piter.length;
-ppage_offset += sizeof(struct sd_dif_tuple)) {
+ppage_offset += sizeof(struct t10_pi_tuple)) {
/* If we're at the end of the current
 * data page advance to the next one
 */
@@ -5026,7 +5027,7 @@ static int __init scsi_debug_init(void)
if (sdebug_dix) {
int dif_size;
 
-   dif_size = sdebug_store_sectors * sizeof(struct sd_dif_tuple);
+   dif_size = sdebug_store_sectors * sizeof(struct t10_pi_tuple);
dif_storep = vmalloc(dif_size);
 
pr_err("dif_storep %u bytes @ %p\n", dif_size, dif_storep);
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
index 765a6f1..d00966d 100644
--- a/drivers/scsi/sd.h
+++ b/drivers/scsi/sd.h
@@ -239,15 +239,6 @@ static inline unsigned int sd_prot_flag_mask(unsigned int 
prot_op)
return flag_mask[prot_op];
 }
 
-/*
- * Data Integrity Field tuple.
- */
-struct sd_dif_tuple {
-   __be16 guard_tag;   /* Checksum */
-   __be16 app_tag; /* Opaque storage */
-   __be32 ref_tag; /* Target LBA or indirect LBA */
-};
-
 #ifdef CONFIG_BLK_DEV_INTEGRITY
 
 extern void sd_dif_config_host(struct scsi_disk *);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: RFC: should we deprecate unmaintained isa-only drivers?

2016-09-11 Thread Ondrej Zary
On Sunday 11 September 2016 19:01:55 Christoph Hellwig wrote:
> On Wed, Mar 25, 2015 at 09:52:53PM +0100, Ondrej Zary wrote:
> > >  - wd7000
> > >  - aha1542
> > >  - in2000
> > >  - NCR53c406
> > >  - sym53c416
> > >  - u14-34f
> > >  - ultrastor
> >
> > NCR53c406a and sym53c416 look very similar. The register numbers and
> > commands are almost the same so NCR53c406 support could probably be added
> > to sym53c416 driver (looks better of the two) and NCR53c406a driver
> > removed. Now I have cards with both chips so I'll try.
>
> Did you get a chance to look at this project?

At first try (with some quick hacking only), the 53c406 card didn't work with 
sym53c416 driver. I haven't had time for more serious work back then. 
Hopefully I'll try harder soon.

-- 
Ondrej Zary
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: status of NCR5380-based ISA drivers

2016-09-11 Thread Ondrej Zary
On Sunday 11 September 2016 19:12:49 Christoph Hellwig wrote:
> Hi all,
>
> you seem to the currently active NCR580 cabal.  Which frontends to NCR5380
> do you test at the moment, or could you test?
>
> NCR5380-based ISA drivers make up a significant part of those drivers still
> using scsi_module.c after it's 15 year deprecation period, and I'd like to
> either move them to this century or to the dust bin.
>
> The drivers in question are: dtc, g_NCR5380, pas16 and t128.
>
> Thanks,
>   Christoph

I have the HW to test g_NCR5380 - it currently works fine as it did never 
before.
I started a patch to for scsi_module.c removal (and other good things) but 
haven't had time to finish it. Hopefully, it will be ready soon.

-- 
Ondrej Zary
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/26] constify local structures

2016-09-11 Thread Jarkko Sakkinen
On Sun, Sep 11, 2016 at 03:05:42PM +0200, Julia Lawall wrote:
> Constify local structures.
> 
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)

Just my two cents but:

1. You *can* use a static analysis too to find bugs or other issues.
2. However, you should manually do the commits and proper commit
   messages to subsystems based on your findings. And I generally think
   that if one contributes code one should also at least smoke test changes
   somehow.

I don't know if I'm alone with my opinion. I just think that one should
also do the analysis part and not blindly create and submit patches.

Anyway, I'll apply the TPM change at some point. As I said they were
for better. Thanks.

/Jarkko

> // 
> // The first rule ignores some cases that posed problems
> @r disable optional_qualifier@
> identifier s != {peri_clk_data,threshold_attr,tracer_flags,tracer};
> identifier i != {s5k5baf_cis_rect,smtcfb_fix};
> position p;
> @@
> static struct s i@p = { ... };
> 
> @lstruct@
> identifier r.s;
> @@
> struct s { ... };
> 
> @used depends on lstruct@
> identifier r.i;
> @@
> i
> 
> @bad1@
> expression e;
> identifier r.i;
> assignment operator a;
> @@
>  (<+...i...+>) a e
> 
> @bad2@
> identifier r.i;
> @@
>  &(<+...i...+>)
> 
> @bad3@
> identifier r.i;
> declarer d;
> @@
>  d(...,<+...i...+>,...);
> 
> @bad4@
> identifier r.i;
> type T;
> T[] e;
> identifier f;
> position p;
> @@
> 
> f@p(...,
> (
>   (<+...i...+>)
> &
>   e
> )
> ,...)
> 
> @bad4a@
> identifier r.i;
> type T;
> T *e;
> identifier f;
> position p;
> @@
> 
> f@p(...,
> (
>   (<+...i...+>)
> &
>   e
> )
> ,...)
> 
> @ok5@
> expression *e;
> identifier r.i;
> position p;
> @@
> e =@p i
> 
> @bad5@
> expression *e;
> identifier r.i;
> position p != ok5.p;
> @@
> e =@p (<+...i...+>)
> 
> @rr depends on used && !bad1 && !bad2 && !bad3 && !bad4 && !bad4a && !bad5@
> identifier s,r.i;
> position r.p;
> @@
> 
> static
> +const
>  struct s i@p = { ... };
> 
> @depends on used && !bad1 && !bad2 && !bad3 && !bad4 && !bad4a && !bad5
>  disable optional_qualifier@
> identifier rr.s,r.i;
> @@
> 
> static
> +const
>  struct s i;
> // 
> 
> ---
> 
>  drivers/acpi/acpi_apd.c  |8 +++---
>  drivers/char/tpm/tpm-interface.c |   10 
>  drivers/char/tpm/tpm-sysfs.c |2 -
>  drivers/cpufreq/intel_pstate.c   |8 +++---
>  drivers/infiniband/hw/i40iw/i40iw_uk.c   |6 ++---
>  drivers/media/i2c/tvp514x.c  |2 -
>  drivers/media/pci/ddbridge/ddbridge-core.c   |   18 +++
>  drivers/media/pci/ngene/ngene-cards.c|   14 ++--
>  drivers/media/pci/smipcie/smipcie-main.c |8 +++---
>  drivers/misc/sgi-xp/xpc_uv.c |2 -
>  drivers/net/arcnet/com20020-pci.c|   10 
>  drivers/net/can/c_can/c_can_pci.c|4 +--
>  drivers/net/can/sja1000/plx_pci.c|   20 -
>  drivers/net/ethernet/mellanox/mlx4/main.c|4 +--
>  drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c |2 -
>  drivers/net/ethernet/renesas/sh_eth.c|   14 ++--
>  drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c |2 -
>  drivers/net/wireless/ath/dfs_pattern_detector.c  |2 -
>  drivers/net/wireless/intel/iwlegacy/3945.c   |4 +--
>  drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c  |2 -
>  drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c  |2 -
>  drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c  |2 -
>  drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c  |2 -
>  drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c  |2 -
>  drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c  |2 -
>  drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c  |2 -
>  drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c  |2 -
>  drivers/platform/chrome/chromeos_laptop.c|   22 
> +--
>  drivers/platform/x86/intel_scu_ipc.c |6 ++---
>  drivers/platform/x86/intel_telemetry_debugfs.c   |2 -
>  drivers/scsi/esas2r/esas2r_flash.c   |2 -
>  drivers/scsi/hptiop.c|6 ++---
>  drivers/spi/spi-dw-pci.c |4 +--
>  drivers/staging/rtl8192e/rtl8192e/rtl_core.c |2 -
>  drivers/usb/misc/ezusb.c |2 -
>  drivers/video/fbdev/matrox/matroxfb_g450.c   |2 -
>  lib/crc64_ecma.c |2 -
>  sound/pci/ctxfi/ctatc.c  |2 -
>  sound/pci/hda/patch_ca0132.c |   10 
>  sound/pci/riptide/riptide.c  |2 -
>  40 files changed, 110 insertions(+), 110 deletions(-)
--
To unsubscribe from this list: send 

status of NCR5380-based ISA drivers

2016-09-11 Thread Christoph Hellwig
Hi all,

you seem to the currently active NCR580 cabal.  Which frontends to NCR5380
do you test at the moment, or could you test?

NCR5380-based ISA drivers make up a significant part of those drivers still
using scsi_module.c after it's 15 year deprecation period, and I'd like to
either move them to this century or to the dust bin.

The drivers in question are: dtc, g_NCR5380, pas16 and t128.

Thanks,
Christoph
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: RFC: should we deprecate unmaintained isa-only drivers?

2016-09-11 Thread Christoph Hellwig
On Wed, Mar 25, 2015 at 09:52:53PM +0100, Ondrej Zary wrote:
> >  - wd7000
> >  - aha1542
> >  - in2000
> >  - NCR53c406
> >  - sym53c416
> >  - u14-34f
> >  - ultrastor
> 
> NCR53c406a and sym53c416 look very similar. The register numbers and commands 
> are almost the same so NCR53c406 support could probably be added to sym53c416 
> driver (looks better of the two) and NCR53c406a driver removed. Now I have 
> cards with both chips so I'll try.

Did you get a chance to look at this project?
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/6] vfio_pci: use pci_irq_allocate_vectors

2016-09-11 Thread Christoph Hellwig
Simply the interrupt setup by using the new PCI layer helpers.

Signed-off-by: Christoph Hellwig 
---
 drivers/vfio/pci/vfio_pci_intrs.c   | 45 +
 drivers/vfio/pci/vfio_pci_private.h |  1 -
 2 files changed, 10 insertions(+), 36 deletions(-)

diff --git a/drivers/vfio/pci/vfio_pci_intrs.c 
b/drivers/vfio/pci/vfio_pci_intrs.c
index 152b438..a1d283e 100644
--- a/drivers/vfio/pci/vfio_pci_intrs.c
+++ b/drivers/vfio/pci/vfio_pci_intrs.c
@@ -250,6 +250,7 @@ static irqreturn_t vfio_msihandler(int irq, void *arg)
 static int vfio_msi_enable(struct vfio_pci_device *vdev, int nvec, bool msix)
 {
struct pci_dev *pdev = vdev->pdev;
+   unsigned int flag = msix ? PCI_IRQ_MSIX : PCI_IRQ_MSI;
int ret;
 
if (!is_irq_none(vdev))
@@ -259,35 +260,13 @@ static int vfio_msi_enable(struct vfio_pci_device *vdev, 
int nvec, bool msix)
if (!vdev->ctx)
return -ENOMEM;
 
-   if (msix) {
-   int i;
-
-   vdev->msix = kzalloc(nvec * sizeof(struct msix_entry),
-GFP_KERNEL);
-   if (!vdev->msix) {
-   kfree(vdev->ctx);
-   return -ENOMEM;
-   }
-
-   for (i = 0; i < nvec; i++)
-   vdev->msix[i].entry = i;
-
-   ret = pci_enable_msix_range(pdev, vdev->msix, 1, nvec);
-   if (ret < nvec) {
-   if (ret > 0)
-   pci_disable_msix(pdev);
-   kfree(vdev->msix);
-   kfree(vdev->ctx);
-   return ret;
-   }
-   } else {
-   ret = pci_enable_msi_range(pdev, 1, nvec);
-   if (ret < nvec) {
-   if (ret > 0)
-   pci_disable_msi(pdev);
-   kfree(vdev->ctx);
-   return ret;
-   }
+   /* return the number of supported vectors if we can't get all: */
+   ret = pci_alloc_irq_vectors(pdev, 1, nvec, flag);
+   if (ret < nvec) {
+   if (ret > 0)
+   pci_free_irq_vectors(pdev);
+   kfree(vdev->ctx);
+   return ret;
}
 
vdev->num_ctx = nvec;
@@ -315,7 +294,7 @@ static int vfio_msi_set_vector_signal(struct 
vfio_pci_device *vdev,
if (vector < 0 || vector >= vdev->num_ctx)
return -EINVAL;
 
-   irq = msix ? vdev->msix[vector].vector : pdev->irq + vector;
+   irq = pci_irq_vector(pdev, vector);
 
if (vdev->ctx[vector].trigger) {
free_irq(irq, vdev->ctx[vector].trigger);
@@ -408,11 +387,7 @@ static void vfio_msi_disable(struct vfio_pci_device *vdev, 
bool msix)
 
vfio_msi_set_block(vdev, 0, vdev->num_ctx, NULL, msix);
 
-   if (msix) {
-   pci_disable_msix(vdev->pdev);
-   kfree(vdev->msix);
-   } else
-   pci_disable_msi(pdev);
+   pci_free_irq_vectors(pdev);
 
vdev->irq_type = VFIO_PCI_NUM_IRQS;
vdev->num_ctx = 0;
diff --git a/drivers/vfio/pci/vfio_pci_private.h 
b/drivers/vfio/pci/vfio_pci_private.h
index 2128de8..f561ac1 100644
--- a/drivers/vfio/pci/vfio_pci_private.h
+++ b/drivers/vfio/pci/vfio_pci_private.h
@@ -72,7 +72,6 @@ struct vfio_pci_device {
struct perm_bits*msi_perm;
spinlock_t  irqlock;
struct mutexigate;
-   struct msix_entry   *msix;
struct vfio_pci_irq_ctx *ctx;
int num_ctx;
int irq_type;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/6] ipr: use pci_irq_allocate_vectors

2016-09-11 Thread Christoph Hellwig
Switch the ipr driver to use pci_alloc_irq_vectors.  We need to two calls to
pci_alloc_irq_vectors as ipr only supports multiple MSI-X vectors, but not
multiple MSI vectors.

Otherwise this cleans up a lot of cruft and allows to use a common
request_irq loop for irq types, which happens to only iterate over a
single line in the non MSI-X case.

Signed-off-by: Christoph Hellwig 
---
 drivers/scsi/ipr.c | 173 -
 drivers/scsi/ipr.h |   7 +--
 2 files changed, 52 insertions(+), 128 deletions(-)

diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 17d04c7..cadf56c 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -186,16 +186,16 @@ static const struct ipr_chip_cfg_t ipr_chip_cfg[] = {
 };
 
 static const struct ipr_chip_t ipr_chip[] = {
-   { PCI_VENDOR_ID_MYLEX, PCI_DEVICE_ID_IBM_GEMSTONE, IPR_USE_LSI, 
IPR_SIS32, IPR_PCI_CFG, _chip_cfg[0] },
-   { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CITRINE, IPR_USE_LSI, IPR_SIS32, 
IPR_PCI_CFG, _chip_cfg[0] },
-   { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN, IPR_USE_LSI, 
IPR_SIS32, IPR_PCI_CFG, _chip_cfg[0] },
-   { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN, IPR_USE_LSI, 
IPR_SIS32, IPR_PCI_CFG, _chip_cfg[0] },
-   { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN_E, IPR_USE_MSI, 
IPR_SIS32, IPR_PCI_CFG, _chip_cfg[0] },
-   { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_SNIPE, IPR_USE_LSI, IPR_SIS32, 
IPR_PCI_CFG, _chip_cfg[1] },
-   { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_SCAMP, IPR_USE_LSI, 
IPR_SIS32, IPR_PCI_CFG, _chip_cfg[1] },
-   { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CROC_FPGA_E2, IPR_USE_MSI, 
IPR_SIS64, IPR_MMIO, _chip_cfg[2] },
-   { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CROCODILE, IPR_USE_MSI, 
IPR_SIS64, IPR_MMIO, _chip_cfg[2] },
-   { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_RATTLESNAKE, IPR_USE_MSI, 
IPR_SIS64, IPR_MMIO, _chip_cfg[2] }
+   { PCI_VENDOR_ID_MYLEX, PCI_DEVICE_ID_IBM_GEMSTONE, false, IPR_SIS32, 
IPR_PCI_CFG, _chip_cfg[0] },
+   { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CITRINE, false, IPR_SIS32, 
IPR_PCI_CFG, _chip_cfg[0] },
+   { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN, false, 
IPR_SIS32, IPR_PCI_CFG, _chip_cfg[0] },
+   { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN, false, IPR_SIS32, 
IPR_PCI_CFG, _chip_cfg[0] },
+   { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_OBSIDIAN_E, true, IPR_SIS32, 
IPR_PCI_CFG, _chip_cfg[0] },
+   { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_SNIPE, false, IPR_SIS32, 
IPR_PCI_CFG, _chip_cfg[1] },
+   { PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_SCAMP, false, 
IPR_SIS32, IPR_PCI_CFG, _chip_cfg[1] },
+   { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CROC_FPGA_E2, true, IPR_SIS64, 
IPR_MMIO, _chip_cfg[2] },
+   { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CROCODILE, true, IPR_SIS64, 
IPR_MMIO, _chip_cfg[2] },
+   { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_RATTLESNAKE, true, IPR_SIS64, 
IPR_MMIO, _chip_cfg[2] }
 };
 
 static int ipr_max_bus_speeds[] = {
@@ -9356,23 +9356,11 @@ static void ipr_free_mem(struct ipr_ioa_cfg *ioa_cfg)
 static void ipr_free_irqs(struct ipr_ioa_cfg *ioa_cfg)
 {
struct pci_dev *pdev = ioa_cfg->pdev;
+   int i;
 
-   if (ioa_cfg->intr_flag == IPR_USE_MSI ||
-   ioa_cfg->intr_flag == IPR_USE_MSIX) {
-   int i;
-   for (i = 0; i < ioa_cfg->nvectors; i++)
-   free_irq(ioa_cfg->vectors_info[i].vec,
-_cfg->hrrq[i]);
-   } else
-   free_irq(pdev->irq, _cfg->hrrq[0]);
-
-   if (ioa_cfg->intr_flag == IPR_USE_MSI) {
-   pci_disable_msi(pdev);
-   ioa_cfg->intr_flag &= ~IPR_USE_MSI;
-   } else if (ioa_cfg->intr_flag == IPR_USE_MSIX) {
-   pci_disable_msix(pdev);
-   ioa_cfg->intr_flag &= ~IPR_USE_MSIX;
-   }
+   for (i = 0; i < ioa_cfg->nvectors; i++)
+   free_irq(pci_irq_vector(pdev, i), _cfg->hrrq[i]);
+   pci_free_irq_vectors(pdev);
 }
 
 /**
@@ -9799,45 +9787,6 @@ static void ipr_wait_for_pci_err_recovery(struct 
ipr_ioa_cfg *ioa_cfg)
}
 }
 
-static int ipr_enable_msix(struct ipr_ioa_cfg *ioa_cfg)
-{
-   struct msix_entry entries[IPR_MAX_MSIX_VECTORS];
-   int i, vectors;
-
-   for (i = 0; i < ARRAY_SIZE(entries); ++i)
-   entries[i].entry = i;
-
-   vectors = pci_enable_msix_range(ioa_cfg->pdev,
-   entries, 1, ipr_number_of_msix);
-   if (vectors < 0) {
-   ipr_wait_for_pci_err_recovery(ioa_cfg);
-   return vectors;
-   }
-
-   for (i = 0; i < vectors; i++)
-   ioa_cfg->vectors_info[i].vec = entries[i].vector;
-   ioa_cfg->nvectors = vectors;
-
-   return 0;
-}
-
-static int ipr_enable_msi(struct ipr_ioa_cfg *ioa_cfg)
-{
-   int i, vectors;
-
-   vectors = pci_enable_msi_range(ioa_cfg->pdev, 1, ipr_number_of_msix);

[PATCH 6/6] media/cobalt: use pci_irq_allocate_vectors

2016-09-11 Thread Christoph Hellwig
Simply the interrupt setup by using the new PCI layer helpers.

Despite using pci_enable_msi_range, this driver was only requesting a
single MSI vector anyway.

Signed-off-by: Christoph Hellwig 
---
 drivers/media/pci/cobalt/cobalt-driver.c | 8 ++--
 drivers/media/pci/cobalt/cobalt-driver.h | 2 --
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/media/pci/cobalt/cobalt-driver.c 
b/drivers/media/pci/cobalt/cobalt-driver.c
index 476f7f0..5a0a9e4 100644
--- a/drivers/media/pci/cobalt/cobalt-driver.c
+++ b/drivers/media/pci/cobalt/cobalt-driver.c
@@ -307,9 +307,7 @@ static void cobalt_pci_iounmap(struct cobalt *cobalt, 
struct pci_dev *pci_dev)
 static void cobalt_free_msi(struct cobalt *cobalt, struct pci_dev *pci_dev)
 {
free_irq(pci_dev->irq, (void *)cobalt);
-
-   if (cobalt->msi_enabled)
-   pci_disable_msi(pci_dev);
+   pci_free_irq_vectors(pci_dev);
 }
 
 static int cobalt_setup_pci(struct cobalt *cobalt, struct pci_dev *pci_dev,
@@ -386,14 +384,12 @@ static int cobalt_setup_pci(struct cobalt *cobalt, struct 
pci_dev *pci_dev,
   from being generated. */
cobalt_set_interrupt(cobalt, false);
 
-   if (pci_enable_msi_range(pci_dev, 1, 1) < 1) {
+   if (pci_alloc_irq_vectors(pci_dev, 1, 1, PCI_IRQ_MSI) < 1) {
cobalt_err("Could not enable MSI\n");
-   cobalt->msi_enabled = false;
ret = -EIO;
goto err_release;
}
msi_config_show(cobalt, pci_dev);
-   cobalt->msi_enabled = true;
 
/* Register IRQ */
if (request_irq(pci_dev->irq, cobalt_irq_handler, IRQF_SHARED,
diff --git a/drivers/media/pci/cobalt/cobalt-driver.h 
b/drivers/media/pci/cobalt/cobalt-driver.h
index ed00dc9..00f773e 100644
--- a/drivers/media/pci/cobalt/cobalt-driver.h
+++ b/drivers/media/pci/cobalt/cobalt-driver.h
@@ -287,8 +287,6 @@ struct cobalt {
u32 irq_none;
u32 irq_full_fifo;
 
-   bool msi_enabled;
-
/* omnitek dma */
int dma_channels;
int first_fifo_channel;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6] genwqe: use pci_irq_allocate_vectors

2016-09-11 Thread Christoph Hellwig
Simply the interrupt setup by using the new PCI layer helpers.

One odd thing about this driver is that it looks like it could request
multiple MSI vectors, but it will then only ever use a single one.

Signed-off-by: Christoph Hellwig 
---
 drivers/misc/genwqe/card_base.h  |  1 -
 drivers/misc/genwqe/card_utils.c | 12 ++--
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/misc/genwqe/card_base.h b/drivers/misc/genwqe/card_base.h
index cb851c1..5813b5f 100644
--- a/drivers/misc/genwqe/card_base.h
+++ b/drivers/misc/genwqe/card_base.h
@@ -41,7 +41,6 @@
 #include "genwqe_driver.h"
 
 #define GENWQE_MSI_IRQS4  /* Just one supported, no 
MSIx */
-#define GENWQE_FLAG_MSI_ENABLED(1 << 0)
 
 #define GENWQE_MAX_VFS 15 /* maximum 15 VFs are possible */
 #define GENWQE_MAX_FUNCS   16 /* 1 PF and 15 VFs */
diff --git a/drivers/misc/genwqe/card_utils.c b/drivers/misc/genwqe/card_utils.c
index 222367c..da424c2 100644
--- a/drivers/misc/genwqe/card_utils.c
+++ b/drivers/misc/genwqe/card_utils.c
@@ -730,13 +730,10 @@ int genwqe_read_softreset(struct genwqe_dev *cd)
 int genwqe_set_interrupt_capability(struct genwqe_dev *cd, int count)
 {
int rc;
-   struct pci_dev *pci_dev = cd->pci_dev;
 
-   rc = pci_enable_msi_range(pci_dev, 1, count);
+   rc = pci_alloc_irq_vectors(cd->pci_dev, 1, count, PCI_IRQ_MSI);
if (rc < 0)
return rc;
-
-   cd->flags |= GENWQE_FLAG_MSI_ENABLED;
return 0;
 }
 
@@ -746,12 +743,7 @@ int genwqe_set_interrupt_capability(struct genwqe_dev *cd, 
int count)
  */
 void genwqe_reset_interrupt_capability(struct genwqe_dev *cd)
 {
-   struct pci_dev *pci_dev = cd->pci_dev;
-
-   if (cd->flags & GENWQE_FLAG_MSI_ENABLED) {
-   pci_disable_msi(pci_dev);
-   cd->flags &= ~GENWQE_FLAG_MSI_ENABLED;
-   }
+   pci_free_irq_vectors(cd->pci_dev);
 }
 
 /**
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/6] arcmsr: use pci_alloc_irq_vectors

2016-09-11 Thread Christoph Hellwig
Switch the arcmsr driver to use pci_alloc_irq_vectors.  We need to two
calls to pci_alloc_irq_vectors as arcmsr only supports multiple MSI-X
vectors, but not multiple MSI vectors.

Otherwise this cleans up a lot of cruft and allows to use a common
request_irq loop for irq types, which happens to only iterate over a
single line in the non MSI-X case.

Signed-off-by: Christoph Hellwig 
---
 drivers/scsi/arcmsr/arcmsr.h |  5 +--
 drivers/scsi/arcmsr/arcmsr_hba.c | 82 
 2 files changed, 33 insertions(+), 54 deletions(-)

diff --git a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
index cf99f8c..a254b32 100644
--- a/drivers/scsi/arcmsr/arcmsr.h
+++ b/drivers/scsi/arcmsr/arcmsr.h
@@ -629,7 +629,6 @@ struct AdapterControlBlock
struct pci_dev *pdev;
struct Scsi_Host *  host;
unsigned long   vir2phy_offset;
-   struct msix_entry   entries[ARCMST_NUM_MSIX_VECTORS];
/* Offset is used in making arc cdb physical to virtual calculations */
uint32_toutbound_int_enable;
uint32_tcdb_phyaddr_hi32;
@@ -671,8 +670,6 @@ struct AdapterControlBlock
/* iop init */
#define ACB_F_ABORT 0x0200
#define ACB_F_FIRMWARE_TRAP 0x0400
-   #define ACB_F_MSI_ENABLED   0x1000
-   #define ACB_F_MSIX_ENABLED  0x2000
struct CommandControlBlock *
pccb_pool[ARCMSR_MAX_FREECCB_NUM];
/* used for memory free */
struct list_headccb_free_list;
@@ -725,7 +722,7 @@ struct AdapterControlBlock
atomic_trq_map_token;
atomic_tante_token_value;
uint32_tmaxOutstanding;
-   int msix_vector_count;
+   int vector_count;
 };/* HW_DEVICE_EXTENSION */
 /*
 ***
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index 7640498..a267327 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -720,51 +720,39 @@ static void arcmsr_message_isr_bh_fn(struct work_struct 
*work)
 static int
 arcmsr_request_irq(struct pci_dev *pdev, struct AdapterControlBlock *acb)
 {
-   int i, j, r;
-   struct msix_entry entries[ARCMST_NUM_MSIX_VECTORS];
-
-   for (i = 0; i < ARCMST_NUM_MSIX_VECTORS; i++)
-   entries[i].entry = i;
-   r = pci_enable_msix_range(pdev, entries, 1, ARCMST_NUM_MSIX_VECTORS);
-   if (r < 0)
-   goto msi_int;
-   acb->msix_vector_count = r;
-   for (i = 0; i < r; i++) {
-   if (request_irq(entries[i].vector,
-   arcmsr_do_interrupt, 0, "arcmsr", acb)) {
+   unsigned long flags;
+   int nvec, i;
+
+   nvec = pci_alloc_irq_vectors(pdev, 1, ARCMST_NUM_MSIX_VECTORS,
+   PCI_IRQ_MSIX);
+   if (nvec > 0) {
+   pr_info("arcmsr%d: msi-x enabled\n", acb->host->host_no);
+   flags = 0;
+   } else {
+   nvec = pci_alloc_irq_vectors(pdev, 1, 1,
+   PCI_IRQ_MSI | PCI_IRQ_LEGACY);
+   if (nvec < 1)
+   return FAILED;
+
+   flags = IRQF_SHARED;
+   }
+
+   acb->vector_count = nvec;
+   for (i = 0; i < nvec; i++) {
+   if (request_irq(pci_irq_vector(pdev, i), arcmsr_do_interrupt,
+   flags, "arcmsr", acb)) {
pr_warn("arcmsr%d: request_irq =%d failed!\n",
-   acb->host->host_no, entries[i].vector);
-   for (j = 0 ; j < i ; j++)
-   free_irq(entries[j].vector, acb);
-   pci_disable_msix(pdev);
-   goto msi_int;
+   acb->host->host_no, pci_irq_vector(pdev, i));
+   goto out_free_irq;
}
-   acb->entries[i] = entries[i];
-   }
-   acb->acb_flags |= ACB_F_MSIX_ENABLED;
-   pr_info("arcmsr%d: msi-x enabled\n", acb->host->host_no);
-   return SUCCESS;
-msi_int:
-   if (pci_enable_msi_exact(pdev, 1) < 0)
-   goto legacy_int;
-   if (request_irq(pdev->irq, arcmsr_do_interrupt,
-   IRQF_SHARED, "arcmsr", acb)) {
-   pr_warn("arcmsr%d: request_irq =%d failed!\n",
-   acb->host->host_no, pdev->irq);
-   pci_disable_msi(pdev);
-   goto legacy_int;
-   }
-   acb->acb_flags |= ACB_F_MSI_ENABLED;
-   pr_info("arcmsr%d: msi enabled\n", acb->host->host_no);
-   return SUCCESS;
-legacy_int:
-   if (request_irq(pdev->irq, arcmsr_do_interrupt,
-   

[PATCH 3/6] skd: use pci_alloc_irq_vectors

2016-09-11 Thread Christoph Hellwig
Switch the skd driver to use pci_alloc_irq_vectors.  We need to two calls to
pci_alloc_irq_vectors as skd only supports multiple MSI-X vectors, but not
multiple MSI vectors.

Otherwise this cleans up a lot of cruft and allows to a lot more common code.

Signed-off-by: Christoph Hellwig 
---
 drivers/block/skd_main.c | 212 +++
 1 file changed, 66 insertions(+), 146 deletions(-)

diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index 3822eae..702f543 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -270,8 +270,6 @@ struct skd_device {
resource_size_t mem_phys[SKD_MAX_BARS];
u32 mem_size[SKD_MAX_BARS];
 
-   skd_irq_type_t irq_type;
-   u32 msix_count;
struct skd_msix_entry *msix_entries;
 
struct pci_dev *pdev;
@@ -3821,10 +3819,6 @@ static irqreturn_t skd_qfull_isr(int irq, void 
*skd_host_data)
  */
 
 struct skd_msix_entry {
-   int have_irq;
-   u32 vector;
-   u32 entry;
-   struct skd_device *rsp;
char isr_name[30];
 };
 
@@ -3853,56 +3847,21 @@ static struct skd_init_msix_entry 
msix_entries[SKD_MAX_MSIX_COUNT] = {
{ "(Queue Full 3)", skd_qfull_isr},
 };
 
-static void skd_release_msix(struct skd_device *skdev)
-{
-   struct skd_msix_entry *qentry;
-   int i;
-
-   if (skdev->msix_entries) {
-   for (i = 0; i < skdev->msix_count; i++) {
-   qentry = >msix_entries[i];
-   skdev = qentry->rsp;
-
-   if (qentry->have_irq)
-   devm_free_irq(>pdev->dev,
- qentry->vector, qentry->rsp);
-   }
-
-   kfree(skdev->msix_entries);
-   }
-
-   if (skdev->msix_count)
-   pci_disable_msix(skdev->pdev);
-
-   skdev->msix_count = 0;
-   skdev->msix_entries = NULL;
-}
-
 static int skd_acquire_msix(struct skd_device *skdev)
 {
int i, rc;
struct pci_dev *pdev = skdev->pdev;
-   struct msix_entry *entries;
-   struct skd_msix_entry *qentry;
-
-   entries = kzalloc(sizeof(struct msix_entry) * SKD_MAX_MSIX_COUNT,
- GFP_KERNEL);
-   if (!entries)
-   return -ENOMEM;
 
-   for (i = 0; i < SKD_MAX_MSIX_COUNT; i++)
-   entries[i].entry = i;
-
-   rc = pci_enable_msix_exact(pdev, entries, SKD_MAX_MSIX_COUNT);
-   if (rc) {
+   rc = pci_alloc_irq_vectors(pdev, SKD_MAX_MSIX_COUNT, SKD_MAX_MSIX_COUNT,
+   PCI_IRQ_MSIX);
+   if (rc < 0) {
pr_err("(%s): failed to enable MSI-X %d\n",
   skd_name(skdev), rc);
goto msix_out;
}
 
-   skdev->msix_count = SKD_MAX_MSIX_COUNT;
-   skdev->msix_entries = kzalloc(sizeof(struct skd_msix_entry) *
- skdev->msix_count, GFP_KERNEL);
+   skdev->msix_entries = kcalloc(SKD_MAX_MSIX_COUNT,
+   sizeof(struct skd_msix_entry), GFP_KERNEL);
if (!skdev->msix_entries) {
rc = -ENOMEM;
pr_err("(%s): msix table allocation error\n",
@@ -3910,136 +3869,98 @@ static int skd_acquire_msix(struct skd_device *skdev)
goto msix_out;
}
 
-   for (i = 0; i < skdev->msix_count; i++) {
-   qentry = >msix_entries[i];
-   qentry->vector = entries[i].vector;
-   qentry->entry = entries[i].entry;
-   qentry->rsp = NULL;
-   qentry->have_irq = 0;
-   pr_debug("%s:%s:%d %s: <%s> msix (%d) vec %d, entry %x\n",
-skdev->name, __func__, __LINE__,
-pci_name(pdev), skdev->name,
-i, qentry->vector, qentry->entry);
-   }
-
/* Enable MSI-X vectors for the base queue */
-   for (i = 0; i < skdev->msix_count; i++) {
-   qentry = >msix_entries[i];
+   for (i = 0; i < SKD_MAX_MSIX_COUNT; i++) {
+   struct skd_msix_entry *qentry = >msix_entries[i];
+
snprintf(qentry->isr_name, sizeof(qentry->isr_name),
 "%s%d-msix %s", DRV_NAME, skdev->devno,
 msix_entries[i].name);
-   rc = devm_request_irq(>pdev->dev, qentry->vector,
- msix_entries[i].handler, 0,
- qentry->isr_name, skdev);
+
+   rc = devm_request_irq(>pdev->dev,
+   pci_irq_vector(skdev->pdev, i),
+   msix_entries[i].handler, 0,
+   qentry->isr_name, skdev);
if (rc) {
pr_err("(%s): Unable to register(%d) MSI-X "
   "handler %d: %s\n",
   skd_name(skdev), rc, i, qentry->isr_name);
  

replace pci_enable_msi_{exact_range} with pci_alloc_irq_vectors

2016-09-11 Thread Christoph Hellwig
Hi all,

this series switch the remaining users of pci_enable_msi_{exact_range}
(accounting for ahci and nvme being done through other channels) to
use the pci_alloc_irq_vectors helper instead and thus simplify the
interrupt code in those drivers a lot.  I decided to post it as a
series to everyone involved and linux-pci so that we can get a bit of
cross-review given that I have none of the involved hardware myself.

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 22/26] esas2r: constify local structures

2016-09-11 Thread Julia Lawall
For structure types defined in the same file or local header files, find
top-level static structure declarations that have the following
properties:
1. Never reassigned.
2. Address never taken
3. Not passed to a top-level macro call
4. No pointer or array-typed field passed to a function or stored in a
variable.
Declare structures having all of these properties as const.

Done using Coccinelle.
Based on a suggestion by Joe Perches .

Signed-off-by: Julia Lawall 

---
The semantic patch seems too long for a commit log, but is in the cover
letter.

 drivers/scsi/esas2r/esas2r_flash.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/esas2r/esas2r_flash.c 
b/drivers/scsi/esas2r/esas2r_flash.c
index 7bd376d..f8414b5 100644
--- a/drivers/scsi/esas2r/esas2r_flash.c
+++ b/drivers/scsi/esas2r/esas2r_flash.c
@@ -54,7 +54,7 @@
 
 #define ESAS2R_FS_DRVR_VER 2
 
-static struct esas2r_sas_nvram default_sas_nvram = {
+static const struct esas2r_sas_nvram default_sas_nvram = {
{ 'E',  'S',  'A',  'S'  }, /* signature  */
SASNVR_VERSION, /* version*/
0,  /* checksum   */

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/26] constify local structures

2016-09-11 Thread Julia Lawall
Constify local structures.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// 
// The first rule ignores some cases that posed problems
@r disable optional_qualifier@
identifier s != {peri_clk_data,threshold_attr,tracer_flags,tracer};
identifier i != {s5k5baf_cis_rect,smtcfb_fix};
position p;
@@
static struct s i@p = { ... };

@lstruct@
identifier r.s;
@@
struct s { ... };

@used depends on lstruct@
identifier r.i;
@@
i

@bad1@
expression e;
identifier r.i;
assignment operator a;
@@
 (<+...i...+>) a e

@bad2@
identifier r.i;
@@
 &(<+...i...+>)

@bad3@
identifier r.i;
declarer d;
@@
 d(...,<+...i...+>,...);

@bad4@
identifier r.i;
type T;
T[] e;
identifier f;
position p;
@@

f@p(...,
(
  (<+...i...+>)
&
  e
)
,...)

@bad4a@
identifier r.i;
type T;
T *e;
identifier f;
position p;
@@

f@p(...,
(
  (<+...i...+>)
&
  e
)
,...)

@ok5@
expression *e;
identifier r.i;
position p;
@@
e =@p i

@bad5@
expression *e;
identifier r.i;
position p != ok5.p;
@@
e =@p (<+...i...+>)

@rr depends on used && !bad1 && !bad2 && !bad3 && !bad4 && !bad4a && !bad5@
identifier s,r.i;
position r.p;
@@

static
+const
 struct s i@p = { ... };

@depends on used && !bad1 && !bad2 && !bad3 && !bad4 && !bad4a && !bad5
 disable optional_qualifier@
identifier rr.s,r.i;
@@

static
+const
 struct s i;
// 

---

 drivers/acpi/acpi_apd.c  |8 +++---
 drivers/char/tpm/tpm-interface.c |   10 
 drivers/char/tpm/tpm-sysfs.c |2 -
 drivers/cpufreq/intel_pstate.c   |8 +++---
 drivers/infiniband/hw/i40iw/i40iw_uk.c   |6 ++---
 drivers/media/i2c/tvp514x.c  |2 -
 drivers/media/pci/ddbridge/ddbridge-core.c   |   18 +++
 drivers/media/pci/ngene/ngene-cards.c|   14 ++--
 drivers/media/pci/smipcie/smipcie-main.c |8 +++---
 drivers/misc/sgi-xp/xpc_uv.c |2 -
 drivers/net/arcnet/com20020-pci.c|   10 
 drivers/net/can/c_can/c_can_pci.c|4 +--
 drivers/net/can/sja1000/plx_pci.c|   20 -
 drivers/net/ethernet/mellanox/mlx4/main.c|4 +--
 drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c |2 -
 drivers/net/ethernet/renesas/sh_eth.c|   14 ++--
 drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c |2 -
 drivers/net/wireless/ath/dfs_pattern_detector.c  |2 -
 drivers/net/wireless/intel/iwlegacy/3945.c   |4 +--
 drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c  |2 -
 drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c  |2 -
 drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c  |2 -
 drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c  |2 -
 drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c  |2 -
 drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c  |2 -
 drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c  |2 -
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c  |2 -
 drivers/platform/chrome/chromeos_laptop.c|   22 +--
 drivers/platform/x86/intel_scu_ipc.c |6 ++---
 drivers/platform/x86/intel_telemetry_debugfs.c   |2 -
 drivers/scsi/esas2r/esas2r_flash.c   |2 -
 drivers/scsi/hptiop.c|6 ++---
 drivers/spi/spi-dw-pci.c |4 +--
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c |2 -
 drivers/usb/misc/ezusb.c |2 -
 drivers/video/fbdev/matrox/matroxfb_g450.c   |2 -
 lib/crc64_ecma.c |2 -
 sound/pci/ctxfi/ctatc.c  |2 -
 sound/pci/hda/patch_ca0132.c |   10 
 sound/pci/riptide/riptide.c  |2 -
 40 files changed, 110 insertions(+), 110 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/26] [SCSI] hptiop: constify local structures

2016-09-11 Thread Julia Lawall
For structure types defined in the same file or local header files, find
top-level static structure declarations that have the following
properties:
1. Never reassigned.
2. Address never taken
3. Not passed to a top-level macro call
4. No pointer or array-typed field passed to a function or stored in a
variable.
Declare structures having all of these properties as const.

Done using Coccinelle.
Based on a suggestion by Joe Perches .

Signed-off-by: Julia Lawall 

---
The semantic patch seems too long for a commit log, but is in the cover
letter.

 drivers/scsi/hptiop.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index a83f705..358732d 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -1590,7 +1590,7 @@ static void hptiop_remove(struct pci_dev *pcidev)
scsi_host_put(host);
 }
 
-static struct hptiop_adapter_ops hptiop_itl_ops = {
+static const struct hptiop_adapter_ops hptiop_itl_ops = {
.family= INTEL_BASED_IOP,
.iop_wait_ready= iop_wait_ready_itl,
.internal_memalloc = hptiop_internal_memalloc_itl,
@@ -1609,7 +1609,7 @@ static struct hptiop_adapter_ops hptiop_itl_ops = {
.host_phy_flag = cpu_to_le64(0),
 };
 
-static struct hptiop_adapter_ops hptiop_mv_ops = {
+static const struct hptiop_adapter_ops hptiop_mv_ops = {
.family= MV_BASED_IOP,
.iop_wait_ready= iop_wait_ready_mv,
.internal_memalloc = hptiop_internal_memalloc_mv,
@@ -1628,7 +1628,7 @@ static struct hptiop_adapter_ops hptiop_mv_ops = {
.host_phy_flag = cpu_to_le64(0),
 };
 
-static struct hptiop_adapter_ops hptiop_mvfrey_ops = {
+static const struct hptiop_adapter_ops hptiop_mvfrey_ops = {
.family= MVFREY_BASED_IOP,
.iop_wait_ready= iop_wait_ready_mvfrey,
.internal_memalloc = hptiop_internal_memalloc_mvfrey,

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Bug 156411] scsi host6: runtime PM trying to activate child device host6 but parent (3-4:1.0) is not active

2016-09-11 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=156411

Thorsten Leemhuis  changed:

   What|Removed |Added

 CC||regressi...@leemhuis.info

--- Comment #2 from Thorsten Leemhuis  ---
This afaics is a duplicate of Bug 153171

-- 
You are receiving this mail because:
You are the assignee for the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Bug 153171] scsi host6: runtime PM trying to activate child device host6 but parent (2-2:1.0) is not active

2016-09-11 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=153171

Thorsten Leemhuis  changed:

   What|Removed |Added

 CC||regressi...@leemhuis.info

--- Comment #4 from Thorsten Leemhuis  ---
(In reply to Martin K. Petersen from comment #2)
> Severely lacking in the reviews department, though :(
Martin, the reporter considers this a regression, but according to
https://patchwork.kernel.org/patch/9262149/ you applied the fix to
4.9/scsi-queue – and it's not in mainline yet afaics. Was that an accident or
do you think this is not serious enough and thus better dealt with in 4.9?

-- 
You are receiving this mail because:
You are the assignee for the bug.--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html