* [PATCH] scsi: libsas: Remove pcidev reference
@ 2018-11-12 17:28 John Garry
2018-11-12 17:32 ` Joe Perches
0 siblings, 1 reply; 11+ messages in thread
From: John Garry @ 2018-11-12 17:28 UTC (permalink / raw)
To: jejb, martin.petersen; +Cc: linux-scsi, linux-kernel, linuxarm, John Garry
Not all host drivers are PCI drivers - like hisi_sas, which supports a
platform driver - so remove reference to "pcidev".
The debug level is also downgraded to KERN_ERR for the same message.
Signed-off-by: John Garry <john.garry@huawei.com>
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
index 6b12c67..3428ea9 100644
--- a/drivers/scsi/libsas/sas_discover.c
+++ b/drivers/scsi/libsas/sas_discover.c
@@ -186,7 +186,7 @@ int sas_notify_lldd_dev_found(struct domain_device *dev)
res = i->dft->lldd_dev_found(dev);
if (res) {
- printk("sas: driver on pcidev %s cannot handle "
+ pr_err("sas: driver on host %s cannot handle "
"device %llx, error:%d\n",
dev_name(sas_ha->dev),
SAS_ADDR(dev->sas_addr), res);
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] scsi: libsas: Remove pcidev reference
2018-11-12 17:28 [PATCH] scsi: libsas: Remove pcidev reference John Garry
@ 2018-11-12 17:32 ` Joe Perches
2018-11-12 17:49 ` John Garry
0 siblings, 1 reply; 11+ messages in thread
From: Joe Perches @ 2018-11-12 17:32 UTC (permalink / raw)
To: John Garry, jejb, martin.petersen; +Cc: linux-scsi, linux-kernel, linuxarm
On Tue, 2018-11-13 at 01:28 +0800, John Garry wrote:
> Not all host drivers are PCI drivers - like hisi_sas, which supports a
> platform driver - so remove reference to "pcidev".
>
> The debug level is also downgraded to KERN_ERR for the same message.
[]
> diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
[]
> @@ -186,7 +186,7 @@ int sas_notify_lldd_dev_found(struct domain_device *dev)
>
> res = i->dft->lldd_dev_found(dev);
> if (res) {
> - printk("sas: driver on pcidev %s cannot handle "
> + pr_err("sas: driver on host %s cannot handle "
> "device %llx, error:%d\n",
As a printk without a KERN_<LEVEL> is printed at whatever
CONFIG_MESSAGE_LOGLEVEL_DEFAULT is set to (default: 4 and
rarely unchanged), this is effectively upgraded from a
KERN_WARNING to KERN_ERR.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] scsi: libsas: Remove pcidev reference
2018-11-12 17:32 ` Joe Perches
@ 2018-11-12 17:49 ` John Garry
2018-11-12 17:55 ` John Garry
0 siblings, 1 reply; 11+ messages in thread
From: John Garry @ 2018-11-12 17:49 UTC (permalink / raw)
To: Joe Perches, jejb, martin.petersen; +Cc: linux-scsi, linux-kernel, linuxarm
On 12/11/2018 17:32, Joe Perches wrote:
> On Tue, 2018-11-13 at 01:28 +0800, John Garry wrote:
>> Not all host drivers are PCI drivers - like hisi_sas, which supports a
>> platform driver - so remove reference to "pcidev".
>>
>> The debug level is also downgraded to KERN_ERR for the same message.
> []
>> diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
> []
>> @@ -186,7 +186,7 @@ int sas_notify_lldd_dev_found(struct domain_device *dev)
>>
>> res = i->dft->lldd_dev_found(dev);
>> if (res) {
>> - printk("sas: driver on pcidev %s cannot handle "
>> + pr_err("sas: driver on host %s cannot handle "
>> "device %llx, error:%d\n",
>
> As a printk without a KERN_<LEVEL> is printed at whatever
> CONFIG_MESSAGE_LOGLEVEL_DEFAULT is set to (default: 4 and
> rarely unchanged), this is effectively upgraded from a
> KERN_WARNING to KERN_ERR.
ah, I thought that it was printed always.
So maybe I'll just leave as-is.
Thanks,
John
>
>
>
> .
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] scsi: libsas: Remove pcidev reference
2018-11-12 17:49 ` John Garry
@ 2018-11-12 17:55 ` John Garry
2018-11-12 18:30 ` Joe Perches
0 siblings, 1 reply; 11+ messages in thread
From: John Garry @ 2018-11-12 17:55 UTC (permalink / raw)
To: Joe Perches, jejb, martin.petersen; +Cc: linux-scsi, linux-kernel, linuxarm
On 12/11/2018 17:49, John Garry wrote:
> On 12/11/2018 17:32, Joe Perches wrote:
>> On Tue, 2018-11-13 at 01:28 +0800, John Garry wrote:
>>> Not all host drivers are PCI drivers - like hisi_sas, which supports a
>>> platform driver - so remove reference to "pcidev".
>>>
>>> The debug level is also downgraded to KERN_ERR for the same message.
>> []
>>> diff --git a/drivers/scsi/libsas/sas_discover.c
>>> b/drivers/scsi/libsas/sas_discover.c
>> []
>>> @@ -186,7 +186,7 @@ int sas_notify_lldd_dev_found(struct
>>> domain_device *dev)
>>>
>>> res = i->dft->lldd_dev_found(dev);
>>> if (res) {
>>> - printk("sas: driver on pcidev %s cannot handle "
>>> + pr_err("sas: driver on host %s cannot handle "
>>> "device %llx, error:%d\n",
>>
>> As a printk without a KERN_<LEVEL> is printed at whatever
>> CONFIG_MESSAGE_LOGLEVEL_DEFAULT is set to (default: 4 and
>> rarely unchanged), this is effectively upgraded from a
>> KERN_WARNING to KERN_ERR.
>
> ah, I thought that it was printed always.
>
> So maybe I'll just leave as-is.
I forgot to mention that checkpatch complains about using printk() -
that's why I changed it.
Thanks,
John
>
>>
>>
>>
>> .
>>
>
>
>
> .
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] scsi: libsas: Remove pcidev reference
2018-11-12 17:55 ` John Garry
@ 2018-11-12 18:30 ` Joe Perches
2018-11-12 18:48 ` John Garry
0 siblings, 1 reply; 11+ messages in thread
From: Joe Perches @ 2018-11-12 18:30 UTC (permalink / raw)
To: John Garry, jejb, martin.petersen; +Cc: linux-scsi, linux-kernel, linuxarm
On Mon, 2018-11-12 at 17:55 +0000, John Garry wrote:
> On 12/11/2018 17:49, John Garry wrote:
> > On 12/11/2018 17:32, Joe Perches wrote:
> > > On Tue, 2018-11-13 at 01:28 +0800, John Garry wrote:
> > > > Not all host drivers are PCI drivers - like hisi_sas, which supports a
> > > > platform driver - so remove reference to "pcidev".
> > > >
> > > > The debug level is also downgraded to KERN_ERR for the same message.
> > > []
> > > > diff --git a/drivers/scsi/libsas/sas_discover.c
> > > > b/drivers/scsi/libsas/sas_discover.c
> > > []
> > > > @@ -186,7 +186,7 @@ int sas_notify_lldd_dev_found(struct
> > > > domain_device *dev)
> > > >
> > > > res = i->dft->lldd_dev_found(dev);
> > > > if (res) {
> > > > - printk("sas: driver on pcidev %s cannot handle "
> > > > + pr_err("sas: driver on host %s cannot handle "
> > > > "device %llx, error:%d\n",
> > >
> > > As a printk without a KERN_<LEVEL> is printed at whatever
> > > CONFIG_MESSAGE_LOGLEVEL_DEFAULT is set to (default: 4 and
> > > rarely unchanged), this is effectively upgraded from a
> > > KERN_WARNING to KERN_ERR.
> >
> > ah, I thought that it was printed always.
> >
> > So maybe I'll just leave as-is.
>
> I forgot to mention that checkpatch complains about using printk() -
> that's why I changed it.
I believe that always assigning a KERN_<LEVEL>
is good thing so I am not against this change.
Describing the change a bit more correctly than
'debug level downgraded' would be useful.
My preference is a patch like this which
always prefixes "sas: " to each log message
by adding a #define pr_fmt and converts the
bare printks to pr_notice, and converts the
slightly odd sas_printk macro and uses with
a hidden KERN_NOTICE to pr_notice.
---
drivers/scsi/libsas/sas_discover.c | 9 ++++-----
drivers/scsi/libsas/sas_expander.c | 33 ++++++++++++++++-----------------
drivers/scsi/libsas/sas_init.c | 10 +++++-----
drivers/scsi/libsas/sas_internal.h | 5 ++++-
drivers/scsi/libsas/sas_phy.c | 10 +++++-----
drivers/scsi/libsas/sas_port.c | 3 +--
6 files changed, 35 insertions(+), 35 deletions(-)
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
index dde433aa59c2..193d7a1ebeb3 100644
--- a/drivers/scsi/libsas/sas_discover.c
+++ b/drivers/scsi/libsas/sas_discover.c
@@ -128,7 +128,8 @@ static int sas_get_port_device(struct asd_sas_port *port)
SAS_FANOUT_EXPANDER_DEVICE);
break;
default:
- printk("ERROR: Unidentified device type %d\n", dev->dev_type);
+ pr_notice("ERROR: Unidentified device type %d\n",
+ dev->dev_type);
rphy = NULL;
break;
}
@@ -186,10 +187,8 @@ int sas_notify_lldd_dev_found(struct domain_device *dev)
res = i->dft->lldd_dev_found(dev);
if (res) {
- printk("sas: driver on pcidev %s cannot handle "
- "device %llx, error:%d\n",
- dev_name(sas_ha->dev),
- SAS_ADDR(dev->sas_addr), res);
+ pr_notice("driver on pcidev %s cannot handle device %llx, error:%d\n",
+ dev_name(sas_ha->dev), SAS_ADDR(dev->sas_addr), res);
}
set_bit(SAS_DEV_FOUND, &dev->state);
kref_get(&dev->kref);
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index 0d1f72752ca2..922253f1b05f 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -393,7 +393,7 @@ static int sas_ex_phy_discover_helper(struct domain_device *dev, u8 *disc_req,
return res;
dr = &((struct smp_resp *)disc_resp)->disc;
if (memcmp(dev->sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE) == 0) {
- sas_printk("Found loopback topology, just ignore it!\n");
+ pr_notice("Found loopback topology, just ignore it!\n");
return 0;
}
sas_set_ex_phy(dev, single, disc_resp);
@@ -1262,19 +1262,18 @@ static void sas_print_parent_topology_bug(struct domain_device *child,
};
struct domain_device *parent = child->parent;
- sas_printk("%s ex %016llx phy 0x%x <--> %s ex %016llx "
- "phy 0x%x has %c:%c routing link!\n",
+ pr_notice("%s ex %016llx phy 0x%x <--> %s ex %016llx phy 0x%x has %c:%c routing link!\n",
- ex_type[parent->dev_type],
- SAS_ADDR(parent->sas_addr),
- parent_phy->phy_id,
+ ex_type[parent->dev_type],
+ SAS_ADDR(parent->sas_addr),
+ parent_phy->phy_id,
- ex_type[child->dev_type],
- SAS_ADDR(child->sas_addr),
- child_phy->phy_id,
+ ex_type[child->dev_type],
+ SAS_ADDR(child->sas_addr),
+ child_phy->phy_id,
- sas_route_char(parent, parent_phy),
- sas_route_char(child, child_phy));
+ sas_route_char(parent, parent_phy),
+ sas_route_char(child, child_phy));
}
static int sas_check_eeds(struct domain_device *child,
@@ -2154,23 +2153,23 @@ void sas_smp_handler(struct bsg_job *job, struct Scsi_Host *shost,
case SAS_FANOUT_EXPANDER_DEVICE:
break;
default:
- printk("%s: can we send a smp request to a device?\n",
- __func__);
+ pr_notice("%s: can we send a smp request to a device?\n",
+ __func__);
goto out;
}
dev = sas_find_dev_by_rphy(rphy);
if (!dev) {
- printk("%s: fail to find a domain_device?\n", __func__);
+ pr_notice("%s: fail to find a domain_device?\n", __func__);
goto out;
}
/* do we need to support multiple segments? */
if (job->request_payload.sg_cnt > 1 ||
job->reply_payload.sg_cnt > 1) {
- printk("%s: multiple segments req %u, rsp %u\n",
- __func__, job->request_payload.payload_len,
- job->reply_payload.payload_len);
+ pr_notice("%s: multiple segments req %u, rsp %u\n",
+ __func__, job->request_payload.payload_len,
+ job->reply_payload.payload_len);
goto out;
}
diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c
index ede0af78144f..221340ee8651 100644
--- a/drivers/scsi/libsas/sas_init.c
+++ b/drivers/scsi/libsas/sas_init.c
@@ -128,19 +128,19 @@ int sas_register_ha(struct sas_ha_struct *sas_ha)
error = sas_register_phys(sas_ha);
if (error) {
- printk(KERN_NOTICE "couldn't register sas phys:%d\n", error);
+ pr_notice("couldn't register sas phys:%d\n", error);
return error;
}
error = sas_register_ports(sas_ha);
if (error) {
- printk(KERN_NOTICE "couldn't register sas ports:%d\n", error);
+ pr_notice("couldn't register sas ports:%d\n", error);
goto Undo_phys;
}
error = sas_init_events(sas_ha);
if (error) {
- printk(KERN_NOTICE "couldn't start event thread:%d\n", error);
+ pr_notice("couldn't start event thread:%d\n", error);
goto Undo_ports;
}
@@ -623,8 +623,8 @@ struct asd_sas_event *sas_alloc_event(struct asd_sas_phy *phy)
if (atomic_read(&phy->event_nr) > phy->ha->event_thres) {
if (i->dft->lldd_control_phy) {
if (cmpxchg(&phy->in_shutdown, 0, 1) == 0) {
- sas_printk("The phy%02d bursting events, shut it down.\n",
- phy->id);
+ pr_notice("The phy%02d bursting events, shut it down.\n",
+ phy->id);
sas_notify_phy_event(phy, PHYE_SHUTDOWN);
}
} else {
diff --git a/drivers/scsi/libsas/sas_internal.h b/drivers/scsi/libsas/sas_internal.h
index 50e12d662ffe..263cb41853c2 100644
--- a/drivers/scsi/libsas/sas_internal.h
+++ b/drivers/scsi/libsas/sas_internal.h
@@ -32,7 +32,10 @@
#include <scsi/libsas.h>
#include <scsi/sas_ata.h>
-#define sas_printk(fmt, ...) printk(KERN_NOTICE "sas: " fmt, ## __VA_ARGS__)
+#ifdef pr_fmt
+#undef pr_fmt
+#endif
+#define pr_fmt(fmt) "sas: " fmt
#define SAS_DPRINTK(fmt, ...) printk(KERN_DEBUG "sas: " fmt, ## __VA_ARGS__)
diff --git a/drivers/scsi/libsas/sas_phy.c b/drivers/scsi/libsas/sas_phy.c
index bf3e1b979ca6..d628c0e6289d 100644
--- a/drivers/scsi/libsas/sas_phy.c
+++ b/drivers/scsi/libsas/sas_phy.c
@@ -122,11 +122,11 @@ static void sas_phye_shutdown(struct work_struct *work)
phy->enabled = 0;
ret = i->dft->lldd_control_phy(phy, PHY_FUNC_DISABLE, NULL);
if (ret)
- sas_printk("lldd disable phy%02d returned %d\n",
- phy->id, ret);
- } else
- sas_printk("phy%02d is not enabled, cannot shutdown\n",
- phy->id);
+ pr_notice("lldd disable phy%02d returned %d\n",
+ phy->id, ret);
+ } else {
+ pr_notice("phy%02d is not enabled, cannot shutdown\n", phy->id);
+ }
}
/* ---------- Phy class registration ---------- */
diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c
index fad23dd39114..f2a25cef85b7 100644
--- a/drivers/scsi/libsas/sas_port.c
+++ b/drivers/scsi/libsas/sas_port.c
@@ -147,8 +147,7 @@ static void sas_form_port(struct asd_sas_phy *phy)
}
if (i >= sas_ha->num_phys) {
- printk(KERN_NOTICE "%s: couldn't find a free port, bug?\n",
- __func__);
+ pr_notice("%s: couldn't find a free port, bug?\n", __func__);
spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags);
return;
}
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] scsi: libsas: Remove pcidev reference
2018-11-12 18:30 ` Joe Perches
@ 2018-11-12 18:48 ` John Garry
2018-11-12 18:58 ` Joe Perches
0 siblings, 1 reply; 11+ messages in thread
From: John Garry @ 2018-11-12 18:48 UTC (permalink / raw)
To: Joe Perches, jejb, martin.petersen; +Cc: linux-scsi, linux-kernel, linuxarm
On 12/11/2018 18:30, Joe Perches wrote:
> On Mon, 2018-11-12 at 17:55 +0000, John Garry wrote:
>> On 12/11/2018 17:49, John Garry wrote:
>>> On 12/11/2018 17:32, Joe Perches wrote:
>>>> On Tue, 2018-11-13 at 01:28 +0800, John Garry wrote:
>>>>> Not all host drivers are PCI drivers - like hisi_sas, which supports a
>>>>> platform driver - so remove reference to "pcidev".
>>>>>
>>>>> The debug level is also downgraded to KERN_ERR for the same message.
>>>> []
>>>>> diff --git a/drivers/scsi/libsas/sas_discover.c
>>>>> b/drivers/scsi/libsas/sas_discover.c
>>>> []
>>>>> @@ -186,7 +186,7 @@ int sas_notify_lldd_dev_found(struct
>>>>> domain_device *dev)
>>>>>
>>>>> res = i->dft->lldd_dev_found(dev);
>>>>> if (res) {
>>>>> - printk("sas: driver on pcidev %s cannot handle "
>>>>> + pr_err("sas: driver on host %s cannot handle "
>>>>> "device %llx, error:%d\n",
>>>>
>>>> As a printk without a KERN_<LEVEL> is printed at whatever
>>>> CONFIG_MESSAGE_LOGLEVEL_DEFAULT is set to (default: 4 and
>>>> rarely unchanged), this is effectively upgraded from a
>>>> KERN_WARNING to KERN_ERR.
>>>
>>> ah, I thought that it was printed always.
>>>
>>> So maybe I'll just leave as-is.
>>
>> I forgot to mention that checkpatch complains about using printk() -
>> that's why I changed it.
>
> I believe that always assigning a KERN_<LEVEL>
> is good thing so I am not against this change.
>
> Describing the change a bit more correctly than
> 'debug level downgraded' would be useful.
>
Right
> My preference is a patch like this which
> always prefixes "sas: " to each log message
> by adding a #define pr_fmt and converts the
> bare printks to pr_notice, and converts the
> slightly odd sas_printk macro and uses with
> a hidden KERN_NOTICE to pr_notice.
>
> ---
> drivers/scsi/libsas/sas_discover.c | 9 ++++-----
> drivers/scsi/libsas/sas_expander.c | 33 ++++++++++++++++-----------------
> drivers/scsi/libsas/sas_init.c | 10 +++++-----
> drivers/scsi/libsas/sas_internal.h | 5 ++++-
> drivers/scsi/libsas/sas_phy.c | 10 +++++-----
> drivers/scsi/libsas/sas_port.c | 3 +--
> 6 files changed, 35 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
> index dde433aa59c2..193d7a1ebeb3 100644
> --- a/drivers/scsi/libsas/sas_discover.c
> +++ b/drivers/scsi/libsas/sas_discover.c
> @@ -128,7 +128,8 @@ static int sas_get_port_device(struct asd_sas_port *port)
> SAS_FANOUT_EXPANDER_DEVICE);
> break;
> default:
[ ... ]
This all seems reasonable
> } else {
> diff --git a/drivers/scsi/libsas/sas_internal.h b/drivers/scsi/libsas/sas_internal.h
> index 50e12d662ffe..263cb41853c2 100644
> --- a/drivers/scsi/libsas/sas_internal.h
> +++ b/drivers/scsi/libsas/sas_internal.h
> @@ -32,7 +32,10 @@
> #include <scsi/libsas.h>
> #include <scsi/sas_ata.h>
>
> -#define sas_printk(fmt, ...) printk(KERN_NOTICE "sas: " fmt, ## __VA_ARGS__)
> +#ifdef pr_fmt
> +#undef pr_fmt
> +#endif
> +#define pr_fmt(fmt) "sas: " fmt
Some other subsystem may try to include this header, and gets its
message prefix overwritten. Just a consequence for doing something bad,
right?
>
> #define SAS_DPRINTK(fmt, ...) printk(KERN_DEBUG "sas: " fmt, ## __VA_ARGS__)
>
> diff --git a/drivers/scsi/libsas/sas_phy.c b/drivers/scsi/libsas/sas_phy.c
> index bf3e1b979ca6..d628c0e6289d 100644
> --- a/drivers/scsi/libsas/sas_phy.c
> +++ b/drivers/scsi/libsas/sas_phy.c
> @@ -122,11 +122,11 @@ static void sas_phye_shutdown(struct work_struct *work)
> phy->enabled = 0;
> ret = i->dft->lldd_control_phy(phy, PHY_FUNC_DISABLE, NULL);
> if (ret)
> - sas_printk("lldd disable phy%02d returned %d\n",
> - phy->id, ret);
> - } else
> - sas_printk("phy%02d is not enabled, cannot shutdown\n",
> - phy->id);
> + pr_notice("lldd disable phy%02d returned %d\n",
> + phy->id, ret);
> + } else {
> + pr_notice("phy%02d is not enabled, cannot shutdown\n", phy->id);
> + }
> }
>
> /* ---------- Phy class registration ---------- */
> diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c
> index fad23dd39114..f2a25cef85b7 100644
> --- a/drivers/scsi/libsas/sas_port.c
> +++ b/drivers/scsi/libsas/sas_port.c
> @@ -147,8 +147,7 @@ static void sas_form_port(struct asd_sas_phy *phy)
> }
>
> if (i >= sas_ha->num_phys) {
> - printk(KERN_NOTICE "%s: couldn't find a free port, bug?\n",
> - __func__);
> + pr_notice("%s: couldn't find a free port, bug?\n", __func__);
> spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags);
> return;
> }
>
>
>
> .
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] scsi: libsas: Remove pcidev reference
2018-11-12 18:48 ` John Garry
@ 2018-11-12 18:58 ` Joe Perches
2018-11-12 19:31 ` John Garry
0 siblings, 1 reply; 11+ messages in thread
From: Joe Perches @ 2018-11-12 18:58 UTC (permalink / raw)
To: John Garry, jejb, martin.petersen; +Cc: linux-scsi, linux-kernel, linuxarm
On Mon, 2018-11-12 at 18:48 +0000, John Garry wrote:
> On 12/11/2018 18:30, Joe Perches wrote:
[]
> > diff --git a/drivers/scsi/libsas/sas_internal.h b/drivers/scsi/libsas/sas_internal.h
[]
> > @@ -32,7 +32,10 @@
> > #include <scsi/libsas.h>
> > #include <scsi/sas_ata.h>
> >
> > -#define sas_printk(fmt, ...) printk(KERN_NOTICE "sas: " fmt, ## __VA_ARGS__)
> > +#ifdef pr_fmt
> > +#undef pr_fmt
> > +#endif
> > +#define pr_fmt(fmt) "sas: " fmt
>
> Some other subsystem may try to include this header, and gets its
> message prefix overwritten. Just a consequence for doing something bad,
> right?
Right.
And as this file is internal to drivers/scsi/libsas
that seems very unlikely to occur.
It also might useful to use the common debugging
mechanisms and convert SAS_DPRINTK to pr_debug
which would use the same #define pr_fmt.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] scsi: libsas: Remove pcidev reference
2018-11-12 18:58 ` Joe Perches
@ 2018-11-12 19:31 ` John Garry
2018-11-12 19:52 ` Joe Perches
0 siblings, 1 reply; 11+ messages in thread
From: John Garry @ 2018-11-12 19:31 UTC (permalink / raw)
To: Joe Perches, jejb, martin.petersen; +Cc: linux-scsi, linux-kernel, linuxarm
On 12/11/2018 18:58, Joe Perches wrote:
>>> +#define pr_fmt(fmt) "sas: " fmt
>> >
>> > Some other subsystem may try to include this header, and gets its
>> > message prefix overwritten. Just a consequence for doing something bad,
>> > right?
> Right.
>
> And as this file is internal to drivers/scsi/libsas
> that seems very unlikely to occur.
>
> It also might useful to use the common debugging
> mechanisms and convert SAS_DPRINTK to pr_debug
> which would use the same #define pr_fmt.
>
OK, I will try to put this all together as a marginally wider scope tidy-up.
Cheers,
John
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] scsi: libsas: Remove pcidev reference
2018-11-12 19:31 ` John Garry
@ 2018-11-12 19:52 ` Joe Perches
2018-11-13 13:38 ` John Garry
0 siblings, 1 reply; 11+ messages in thread
From: Joe Perches @ 2018-11-12 19:52 UTC (permalink / raw)
To: John Garry, jejb, martin.petersen; +Cc: linux-scsi, linux-kernel, linuxarm
On Mon, 2018-11-12 at 19:31 +0000, John Garry wrote:
> On 12/11/2018 18:58, Joe Perches wrote:
> > > > +#define pr_fmt(fmt) "sas: " fmt
> > > >
> > > > Some other subsystem may try to include this header, and gets its
> > > > message prefix overwritten. Just a consequence for doing something bad,
> > > > right?
> > Right.
> >
> > And as this file is internal to drivers/scsi/libsas
> > that seems very unlikely to occur.
> >
> > It also might useful to use the common debugging
> > mechanisms and convert SAS_DPRINTK to pr_debug
> > which would use the same #define pr_fmt.
> >
>
> OK, I will try to put this all together as a marginally wider scope tidy-up.
Thanks.
Another thing that could be done is to change
the #define pr_fmt(fmt) to KBUILD_MODNAME as
that would prefix "libsas" instead of just "sas".
I think that would be better but I didn't do that
as it should be in a separate patch.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] scsi: libsas: Remove pcidev reference
2018-11-12 19:52 ` Joe Perches
@ 2018-11-13 13:38 ` John Garry
2018-11-13 15:26 ` Joe Perches
0 siblings, 1 reply; 11+ messages in thread
From: John Garry @ 2018-11-13 13:38 UTC (permalink / raw)
To: Joe Perches, jejb, martin.petersen; +Cc: linux-scsi, linux-kernel, linuxarm
On 12/11/2018 19:52, Joe Perches wrote:
> On Mon, 2018-11-12 at 19:31 +0000, John Garry wrote:
>> On 12/11/2018 18:58, Joe Perches wrote:
>>>>> +#define pr_fmt(fmt) "sas: " fmt
>>>>>
>>>>> Some other subsystem may try to include this header, and gets its
>>>>> message prefix overwritten. Just a consequence for doing something bad,
>>>>> right?
>>> Right.
>>>
>>> And as this file is internal to drivers/scsi/libsas
>>> that seems very unlikely to occur.
>>>
>>> It also might useful to use the common debugging
>>> mechanisms and convert SAS_DPRINTK to pr_debug
>>> which would use the same #define pr_fmt.
>>>
>>
We have almost 100 references to SAS_DPRINTK. So when we replace with
pr_debug, we will frequently have to realign the indentation. I'm
beginning to think it's not worth the churn to remove SAS_DPRINTK.
However, with regards to using pr_debug(), there are loops to jump
through to ensure any output at all:
- ensure DEBUG is defined or DYNAMIC DEBUG enabled
- ensure current loglevel is high enough
Having said that, there are actually lots of logs in libsas where debug
level is too low (at pr_debug), and these could be upgraded.
So I think I will just go through the code and revise these levels.
>> OK, I will try to put this all together as a marginally wider scope tidy-up.
>
> Thanks.
>
> Another thing that could be done is to change
> the #define pr_fmt(fmt) to KBUILD_MODNAME as
> that would prefix "libsas" instead of just "sas".
>
I think "sas" makes more sense, as this is the technology, as opposed to
"libsas", which is just the software framework name.
> I think that would be better but I didn't do that
> as it should be in a separate patch.
>
Cheers,
John
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] scsi: libsas: Remove pcidev reference
2018-11-13 13:38 ` John Garry
@ 2018-11-13 15:26 ` Joe Perches
0 siblings, 0 replies; 11+ messages in thread
From: Joe Perches @ 2018-11-13 15:26 UTC (permalink / raw)
To: John Garry, jejb, martin.petersen; +Cc: linux-scsi, linux-kernel, linuxarm
On Tue, 2018-11-13 at 13:38 +0000, John Garry wrote:
> On 12/11/2018 19:52, Joe Perches wrote:
> > On Mon, 2018-11-12 at 19:31 +0000, John Garry wrote:
> > > On 12/11/2018 18:58, Joe Perches wrote:
> > > > > > +#define pr_fmt(fmt) "sas: " fmt
[]
> > > > It also might useful to use the common debugging
> > > > mechanisms and convert SAS_DPRINTK to pr_debug
> > > > which would use the same #define pr_fmt.
{}
> We have almost 100 references to SAS_DPRINTK. So when we replace with
> pr_debug, we will frequently have to realign the indentation. I'm
> beginning to think it's not worth the churn to remove SAS_DPRINTK.
or just convert the #define
> However, with regards to using pr_debug(), there are loops to jump
> through to ensure any output at all:
> - ensure DEBUG is defined or DYNAMIC DEBUG enabled
True
> - ensure current loglevel is high enough
That's already the case.
> Having said that, there are actually lots of logs in libsas where debug
> level is too low (at pr_debug), and these could be upgraded.
>
> So I think I will just go through the code and revise these levels.
Nice, thanks
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2018-11-13 15:27 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-12 17:28 [PATCH] scsi: libsas: Remove pcidev reference John Garry
2018-11-12 17:32 ` Joe Perches
2018-11-12 17:49 ` John Garry
2018-11-12 17:55 ` John Garry
2018-11-12 18:30 ` Joe Perches
2018-11-12 18:48 ` John Garry
2018-11-12 18:58 ` Joe Perches
2018-11-12 19:31 ` John Garry
2018-11-12 19:52 ` Joe Perches
2018-11-13 13:38 ` John Garry
2018-11-13 15:26 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).