Re: [PATCH 0/5] scsi: use platform helper macro and wrapper functions

2013-05-30 Thread Kefeng Wang
On 2013-05-30 22:38, James Bottomley wrote:
> There doesn't seem to be much point to these patches since either idiom
> is fine and easily understood.  We also try to touch the ancient drivers
> as little as possible since it can be months before anyone actually
> tries them out and notices that something got broken, so the rule for
> them is obvious bug fixes only.
> 
> James

hi James,
Thanks for remind, I got it.



--
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 0/5] scsi: use platform helper macro and wrapper functions

2013-05-30 Thread James Bottomley
On Thu, 2013-05-30 at 20:09 +0800, Kefeng Wang wrote:
> use module_platform_driver() and paltform{set,get}_drvdata to simpily code,
> and patch 2/5 delete unnecessery drvdate set to null.
> 
> Kefeng Wang (5):
>   scsi: jazz: use module_platform_driver() and
> platform_{set,get}_drvdata
>   scsi: sun: use module_platform_driver() and platform_{set,get}_drvdata
>   scsi: qlogicpti: use module_platform_driver() and
> platform_{set,get}_drvdata
>   scsi: sun3x: use module_platform_driver() and
> platform_{set,get}_drvdata
>   scsi: sni: use module_platform_driver() and platform_{set,get}_drvdata
> 
>  drivers/scsi/jazz_esp.c   | 17 +++--
>  drivers/scsi/qlogicpti.c  | 17 +++--
>  drivers/scsi/sni_53c710.c | 17 +++--
>  drivers/scsi/sun3x_esp.c  | 16 +++-
>  drivers/scsi/sun_esp.c| 19 +++
>  5 files changed, 15 insertions(+), 71 deletions(-)

There doesn't seem to be much point to these patches since either idiom
is fine and easily understood.  We also try to touch the ancient drivers
as little as possible since it can be months before anyone actually
tries them out and notices that something got broken, so the rule for
them is obvious bug fixes only.

James


--
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] [SCSI] Fix incorrect comment in scsi_logging.h

2013-05-30 Thread Ewan D. Milne
From: "Ewan D. Milne" 

The scsi_logging_level word contains 10 3-bit fields,
not 8 nibbles.  Fix the incorrect comment.

Signed-off-by: Ewan D. Milne 
---
 drivers/scsi/scsi_logging.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_logging.h b/drivers/scsi/scsi_logging.h
index 1f65139..bd6f58a 100644
--- a/drivers/scsi/scsi_logging.h
+++ b/drivers/scsi/scsi_logging.h
@@ -5,8 +5,8 @@
 /*
  * This defines the scsi logging feature.  It is a means by which the user
  * can select how much information they get about various goings on, and it
- * can be really useful for fault tracing.  The logging word is divided into
- * 8 nibbles, each of which describes a loglevel.  The division of things is
+ * can be really useful for fault tracing.  The logging word contains 10
+ * fields, each of which describes a loglevel.  The division of things is
  * somewhat arbitrary, and the division of the word could be changed if it
  * were really needed for any reason.  The numbers below are the only place
  * where these are specified.  For a first go-around, 3 bits is more than
-- 
1.7.11.7

--
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 0/5] scsi: use platform helper macro and wrapper functions

2013-05-30 Thread Kefeng Wang
use module_platform_driver() and paltform{set,get}_drvdata to simpily code,
and patch 2/5 delete unnecessery drvdate set to null.

Kefeng Wang (5):
  scsi: jazz: use module_platform_driver() and
platform_{set,get}_drvdata
  scsi: sun: use module_platform_driver() and platform_{set,get}_drvdata
  scsi: qlogicpti: use module_platform_driver() and
platform_{set,get}_drvdata
  scsi: sun3x: use module_platform_driver() and
platform_{set,get}_drvdata
  scsi: sni: use module_platform_driver() and platform_{set,get}_drvdata

 drivers/scsi/jazz_esp.c   | 17 +++--
 drivers/scsi/qlogicpti.c  | 17 +++--
 drivers/scsi/sni_53c710.c | 17 +++--
 drivers/scsi/sun3x_esp.c  | 16 +++-
 drivers/scsi/sun_esp.c| 19 +++
 5 files changed, 15 insertions(+), 71 deletions(-)

-- 
1.8.2.1


--
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/5] scsi: sun3x: use module_platform_driver() and platform_{set,get}_drvdata

2013-05-30 Thread Kefeng Wang
Use helper macro and wrapper functions to simpily code.

Signed-off-by: Kefeng Wang 
---
 drivers/scsi/sun3x_esp.c | 16 +++-
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/sun3x_esp.c b/drivers/scsi/sun3x_esp.c
index 534eb96..4c9a2b4 100644
--- a/drivers/scsi/sun3x_esp.c
+++ b/drivers/scsi/sun3x_esp.c
@@ -244,7 +244,7 @@ static int esp_sun3x_probe(struct platform_device *dev)
esp->scsi_id_mask = (1 << esp->scsi_id);
esp->cfreq = 2000;
 
-   dev_set_drvdata(&dev->dev, esp);
+   platform_set_drvdata(dev, esp);
 
err = scsi_esp_register(esp, &dev->dev);
if (err)
@@ -270,7 +270,7 @@ fail:
 
 static int esp_sun3x_remove(struct platform_device *dev)
 {
-   struct esp *esp = dev_get_drvdata(&dev->dev);
+   struct esp *esp = platform_get_drvdata(dev);
unsigned int irq = esp->host->irq;
u32 val;
 
@@ -299,21 +299,11 @@ static struct platform_driver esp_sun3x_driver = {
},
 };
 
-static int __init sun3x_esp_init(void)
-{
-   return platform_driver_register(&esp_sun3x_driver);
-}
-
-static void __exit sun3x_esp_exit(void)
-{
-   platform_driver_unregister(&esp_sun3x_driver);
-}
+module_platform_driver(esp_sun3x_driver);
 
 MODULE_DESCRIPTION("Sun3x ESP SCSI driver");
 MODULE_AUTHOR("Thomas Bogendoerfer (tsbog...@alpha.franken.de)");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
 
-module_init(sun3x_esp_init);
-module_exit(sun3x_esp_exit);
 MODULE_ALIAS("platform:sun3x_esp");
-- 
1.8.2.1


--
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/5] scsi: qlogicpti: use module_platform_driver() and platform_{set,get}_drvdata

2013-05-30 Thread Kefeng Wang
Use helper macro and wrapper functions to simpily code.

Signed-off-by: Kefeng Wang 
---
 drivers/scsi/qlogicpti.c | 17 +++--
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index 6d48d30..1349374 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -1367,7 +1367,7 @@ static int qpti_sbus_probe(struct platform_device *op)
goto fail_unmap_queues;
}
 
-   dev_set_drvdata(&op->dev, qpti);
+   platform_set_drvdata(op, qpti);
 
qpti_chain_add(qpti);
 
@@ -1404,7 +1404,7 @@ fail_unlink:
 
 static int qpti_sbus_remove(struct platform_device *op)
 {
-   struct qlogicpti *qpti = dev_get_drvdata(&op->dev);
+   struct qlogicpti *qpti = platform_get_drvdata(&op->dev);
 
qpti_chain_del(qpti);
 
@@ -1462,21 +1462,10 @@ static struct platform_driver qpti_sbus_driver = {
.remove = qpti_sbus_remove,
 };
 
-static int __init qpti_init(void)
-{
-   return platform_driver_register(&qpti_sbus_driver);
-}
-
-static void __exit qpti_exit(void)
-{
-   platform_driver_unregister(&qpti_sbus_driver);
-}
+module_platform_driver(qpti_sbus_driver);
 
 MODULE_DESCRIPTION("QlogicISP SBUS driver");
 MODULE_AUTHOR("David S. Miller (da...@davemloft.net)");
 MODULE_LICENSE("GPL");
 MODULE_VERSION("2.1");
 MODULE_FIRMWARE("qlogic/isp1000.bin");
-
-module_init(qpti_init);
-module_exit(qpti_exit);
-- 
1.8.2.1


--
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/5] scsi: sni: use module_platform_driver() and platform_{set,get}_drvdata

2013-05-30 Thread Kefeng Wang
Use helper macro and wrapper functions to simpily code.

Signed-off-by: Kefeng Wang 
---
 drivers/scsi/sni_53c710.c | 17 +++--
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/sni_53c710.c b/drivers/scsi/sni_53c710.c
index 52d54e7..eff84c4 100644
--- a/drivers/scsi/sni_53c710.c
+++ b/drivers/scsi/sni_53c710.c
@@ -104,7 +104,7 @@ static int snirm710_probe(struct platform_device *dev)
goto out_put_host;
}
 
-   dev_set_drvdata(&dev->dev, host);
+   platform_set_drvdata(dev, host);
scsi_scan_host(host);
 
return 0;
@@ -119,7 +119,7 @@ static int snirm710_probe(struct platform_device *dev)
 
 static int __exit snirm710_driver_remove(struct platform_device *dev)
 {
-   struct Scsi_Host *host = dev_get_drvdata(&dev->dev);
+   struct Scsi_Host *host = platform_get_drvdata(dev);
struct NCR_700_Host_Parameters *hostdata =
(struct NCR_700_Host_Parameters *)host->hostdata[0];
 
@@ -141,15 +141,4 @@ static struct platform_driver snirm710_driver = {
},
 };
 
-static int __init snirm710_init(void)
-{
-   return platform_driver_register(&snirm710_driver);
-}
-
-static void __exit snirm710_exit(void)
-{
-   platform_driver_unregister(&snirm710_driver);
-}
-
-module_init(snirm710_init);
-module_exit(snirm710_exit);
+module_platform_driver(snirm710_driver);
-- 
1.8.2.1


--
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/5] scsi: jazz: use module_platform_driver() and platform_{set,get}_drvdata

2013-05-30 Thread Kefeng Wang
Use helper macro and wrapper functions to simpily code.

Signed-off-by: Kefeng Wang 
---
 drivers/scsi/jazz_esp.c | 17 +++--
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/jazz_esp.c b/drivers/scsi/jazz_esp.c
index 69efbf1..08fa257 100644
--- a/drivers/scsi/jazz_esp.c
+++ b/drivers/scsi/jazz_esp.c
@@ -180,7 +180,7 @@ static int esp_jazz_probe(struct platform_device *dev)
esp->scsi_id_mask = (1 << esp->scsi_id);
esp->cfreq = 4000;
 
-   dev_set_drvdata(&dev->dev, esp);
+   platform_set_drvdata(dev, esp);
 
err = scsi_esp_register(esp, &dev->dev);
if (err)
@@ -203,7 +203,7 @@ fail:
 
 static int esp_jazz_remove(struct platform_device *dev)
 {
-   struct esp *esp = dev_get_drvdata(&dev->dev);
+   struct esp *esp = platform_get_drvdata(dev);
unsigned int irq = esp->host->irq;
 
scsi_esp_unregister(esp);
@@ -230,20 +230,9 @@ static struct platform_driver esp_jazz_driver = {
},
 };
 
-static int __init jazz_esp_init(void)
-{
-   return platform_driver_register(&esp_jazz_driver);
-}
-
-static void __exit jazz_esp_exit(void)
-{
-   platform_driver_unregister(&esp_jazz_driver);
-}
+module_platform_driver(esp_jazz_driver);
 
 MODULE_DESCRIPTION("JAZZ ESP SCSI driver");
 MODULE_AUTHOR("Thomas Bogendoerfer (tsbog...@alpha.franken.de)");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
-
-module_init(jazz_esp_init);
-module_exit(jazz_esp_exit);
-- 
1.8.2.1


--
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/5] scsi: sun: use module_platform_driver() and platform_{set,get}_drvdata

2013-05-30 Thread Kefeng Wang
Use helper macro and wrapper functions to simpily code. Meanwhile,
remove unnecessary drvdata set to null due to commint 0998d0631
(device-core: Ensure drvdata = NULL when no driver is bound).

Signed-off-by: Kefeng Wang 
---
 drivers/scsi/sun_esp.c | 19 +++
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/sun_esp.c b/drivers/scsi/sun_esp.c
index f2e6845..b7361a6 100644
--- a/drivers/scsi/sun_esp.c
+++ b/drivers/scsi/sun_esp.c
@@ -538,7 +538,7 @@ static int esp_sbus_probe_one(struct platform_device *op,
dma_write32(val & ~DMA_RST_SCSI, DMA_CSR);
}
 
-   dev_set_drvdata(&op->dev, esp);
+   platform_set_drvdata(op, esp);
 
err = scsi_esp_register(esp, &op->dev);
if (err)
@@ -585,7 +585,7 @@ static int esp_sbus_probe(struct platform_device *op)
 
 static int esp_sbus_remove(struct platform_device *op)
 {
-   struct esp *esp = dev_get_drvdata(&op->dev);
+   struct esp *esp = platform_get_drvdata(op);
struct platform_device *dma_of = esp->dma;
unsigned int irq = esp->host->irq;
bool is_hme;
@@ -611,8 +611,6 @@ static int esp_sbus_remove(struct platform_device *op)
 
scsi_host_put(esp->host);
 
-   dev_set_drvdata(&op->dev, NULL);
-
return 0;
 }
 
@@ -640,20 +638,9 @@ static struct platform_driver esp_sbus_driver = {
.remove = esp_sbus_remove,
 };
 
-static int __init sunesp_init(void)
-{
-   return platform_driver_register(&esp_sbus_driver);
-}
-
-static void __exit sunesp_exit(void)
-{
-   platform_driver_unregister(&esp_sbus_driver);
-}
+module_platform_driver(esp_sbus_driver);
 
 MODULE_DESCRIPTION("Sun ESP SCSI driver");
 MODULE_AUTHOR("David S. Miller (da...@davemloft.net)");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
-
-module_init(sunesp_init);
-module_exit(sunesp_exit);
-- 
1.8.2.1


--
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 0/4] New FC timeout handler

2013-05-30 Thread Hannes Reinecke

On 05/30/2013 10:37 AM, Ren Mingxin wrote:

Hi, Hannes:

On 05/24/2013 05:50 PM, Hannes Reinecke wrote:

this is the first step towards a new FC error handler.
This patch implements a new FC command timeout handler
which will be sending command aborts inline without
engaging SCSI EH.

In addition the commands will be returned directly
if the command abort succeeded, cutting down recovery
times dramatically.


To the commands which can be aborted successfully, I guess your
patchset has solved the problem "the error handler can't even be
called until host_failed == host_busy", because it needn't to
wait for the scheduling of EH threads(without engaging SCSI EH
as you said) now, right?


Yes.


For any other return code from 'eh_abort_handler' the command
will be pushed onto the existing SCSI EH handler, or aborted
with an error if that fails.


To the commands which can NOT be aborted successfully, there is
not any improvements for the SCSI EH will be invoked as usual.


Correct. But I'm working on a patchset to improve that.


But should we consider the repetitive/time-consuming issue for
the commands will be tried to abort again in the SCSI EH handler?


I doubt this is an issue. With this patchset even aborted commands
will be retried, with the usual retry count.
And for an successful abort we don't need to invoke the error handler
as target itself is considered alive.
If the abort itself failed the command will be pushed onto the SCSI EH 
handler, instructing the EH handler _not_ to abort the command.


Cheers,

Hannes
--
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 RESEND] scsi: megaraid: check kzalloc

2013-05-30 Thread Tomas Henzl
On 05/30/2013 04:32 AM, Libo Chen wrote:
> On 2013/5/30 9:38, Libo Chen wrote:
>> On 2013/5/29 23:03, Tomas Henzl wrote:
>>> On 05/24/2013 11:40 AM, Libo Chen wrote:
 we should check kzalloc, avoid to hit oops

 Signed-off-by: Libo Chen 
 ---
  drivers/scsi/megaraid.c |4 
  1 files changed, 4 insertions(+), 0 deletions(-)

 instead of checking scmd->device, sdev is more appropriate.

 diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
 index 846f475..6b623cb 100644
 --- a/drivers/scsi/megaraid.c
 +++ b/drivers/scsi/megaraid.c
 @@ -4161,6 +4161,10 @@ mega_internal_command(adapter_t *adapter, megacmd_t 
 *mc, mega_passthru *pthru)
memset(scb, 0, sizeof(scb_t));

sdev = kzalloc(sizeof(struct scsi_device), GFP_KERNEL);
 +  if (sdev) {
 +  scsi_free_command(GFP_KERNEL, scmd);
>>> I think, that a mutex_unlock(&adapter->int_mtx); is also needed
>>> Maybe just setting a rval = -ENOMEM and a jump to to some point below?
>>>
>>> tomash
>> thanks for catching this.
>>
>> when kzalloc broken, fist unlock and then return.  I will update later.
>>
> I think we can put kzalloc outside of mutex_lock(&adapter->int_mtx) ?
> phase:

Yes, that is also possible, depends on what you prefer.

>
>mutex_lockkzalloc
>kzalloc ->  mutex_lock
>   
>
>> Libo
>>
 +  return -ENOMEM;
 +  }
scmd->device = sdev;

memset(adapter->int_cdb, 0, sizeof(adapter->int_cdb));
>>>
>>> .
>>>
>
> --
> 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

--
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 0/4] New FC timeout handler

2013-05-30 Thread Ren Mingxin

Hi, Hannes:

On 05/24/2013 05:50 PM, Hannes Reinecke wrote:

this is the first step towards a new FC error handler.
This patch implements a new FC command timeout handler
which will be sending command aborts inline without
engaging SCSI EH.

In addition the commands will be returned directly
if the command abort succeeded, cutting down recovery
times dramatically.


To the commands which can be aborted successfully, I guess your
patchset has solved the problem "the error handler can't even be
called until host_failed == host_busy", because it needn't to
wait for the scheduling of EH threads(without engaging SCSI EH
as you said) now, right?


For any other return code from 'eh_abort_handler' the command
will be pushed onto the existing SCSI EH handler, or aborted
with an error if that fails.


To the commands which can NOT be aborted successfully, there is
not any improvements for the SCSI EH will be invoked as usual.
But should we consider the repetitive/time-consuming issue for
the commands will be tried to abort again in the SCSI EH handler?

Thanks,
Ren
--
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] [SCSI] fnic: potential dead lock in fnic_is_abts_pending()

2013-05-30 Thread Dan Carpenter
There is an unlock missing if the == FNIC_IOREQ_ABTS_PENDING is
false.

Signed-off-by: Dan Carpenter 
---
Static analysis.  I can't test this.

diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index be99e75..a97e6e5 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -2432,11 +2432,9 @@ int fnic_is_abts_pending(struct fnic *fnic, struct 
scsi_cmnd *lr_sc)
  "Found IO in %s on lun\n",
  fnic_ioreq_state_to_str(CMD_STATE(sc)));
 
-   if (CMD_STATE(sc) == FNIC_IOREQ_ABTS_PENDING) {
-   spin_unlock_irqrestore(io_lock, flags);
+   if (CMD_STATE(sc) == FNIC_IOREQ_ABTS_PENDING)
ret = 1;
-   continue;
-   }
+   spin_unlock_irqrestore(io_lock, flags);
}
 
return ret;
--
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