usb-storage: SCSI glue: use pr_fmt and pr_err
Subsystems (2)
PATCH 1/1 usb-storage: SCSI glue: use pr_fmt and pr_err
Follow common practice and retire printk(KERN_ERR ...) in favor of pr_fmt and pr_err.
--- drivers/usb/storage/scsiglue.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/storage/scsiglue.c +3 -2
@@ -28,6 +28,8 @@* status of a command. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/blkdev.h> #include <linux/dma-mapping.h> #include <linux/module.h>
@@ -379,8 +381,7 @@ static int queuecommand_lck(struct scsi_cmnd *srb,/* check for state-transition errors */ if (us->srb !=NULL ) { -printk (KERN_ERR "usb-storage: Error in %s: us->srb = %p\n" , - __func__, us->srb); +pr_err ("Error in %s: us->srb = %p\n" , __func__, us->srb);return SCSI_MLQUEUE_HOST_BUSY ; }
Signature · 1 line
2.23.0.237.gc6a4ce50a0-goog
Alan Stern
maintainerQuoted 2 lines · Matthias Maennich
Follow common practice and retire
printk(KERN_ERR ...)in favor ofpr_fmtandpr_err.
As long as you're changing this, why not change it to dev_err() instead? That would be a lot more useful.
Quoted 22 lines
Cc Alan Stern <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Matthias Maennich <[email protected]>--- drivers/usb/storage/scsiglue.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/usb/storage/scsiglue.c +2
-0@@ -28,6 +28,8 @@* status of a command. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/blkdev.h> #include <linux/dma-mapping.h> #include <linux/module.h>
drivers/usb/storage/scsiglue.c static int queuecommand_lck(struct scsi_cmnd *srb, · line 386
Quoted 8 lines
drivers/usb/storage/scsiglue.c +1
-2@@ -379,8 +381,7 @@ static int queuecommand_lck(struct scsi_cmnd *srb,/* check for state-transition errors */ if (us->srb !=NULL ) { -printk (KERN_ERR "usb-storage: Error in %s: us->srb = %p\n" , - __func__, us->srb); +pr_err ("Error in %s: us->srb = %p\n" , __func__, us->srb);return SCSI_MLQUEUE_HOST_BUSY ; }
dev_err(&us->pusb_intf->dev, "Error in ...
Alan Stern
PATCH v2 1/1 usb-storage: SCSI glue: use pr_fmt and pr_err
In reply to Matthias MaennichFollow common practice and retire printk(KERN_ERR ...) in favor of pr_fmt and dev_err().
--- drivers/usb/storage/scsiglue.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/storage/scsiglue.c +4 -2
@@ -28,6 +28,8 @@* status of a command. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/blkdev.h> #include <linux/dma-mapping.h> #include <linux/module.h>
@@ -379,8 +381,8 @@ static int queuecommand_lck(struct scsi_cmnd *srb,/* check for state-transition errors */ if (us->srb !=NULL ) { -printk (KERN_ERR "usb-storage: Error in %s: us->srb = %p\n" , - __func__, us->srb); +dev_err (&us->pusb_intf->dev, +"Error in %s: us->srb = %p\n" , __func__, us->srb);return SCSI_MLQUEUE_HOST_BUSY ; }
Signature · 1 line
2.23.0.237.gc6a4ce50a0-goog
Alan Stern
maintainerQuoted 16 lines · Matthias Maennich
Follow common practice and retire
printk(KERN_ERR ...)in favor ofpr_fmtanddev_err().Cc Alan Stern <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Matthias Maennich <[email protected]>--- drivers/usb/storage/scsiglue.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/usb/storage/scsiglue.c +0
-0
drivers/usb/storage/scsiglue.c line 32
Quoted 5 lines
drivers/usb/storage/scsiglue.c +2
-0@@ -28,6 +28,8 @@* status of a command. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +
What's this here for?
Alan Stern
Quoted 15 lines
drivers/usb/storage/scsiglue.c +2
-2#include <linux/blkdev.h> #include <linux/dma-mapping.h> #include <linux/module.h> @@ -379,8 +381,8 @@ static int queuecommand_lck(struct scsi_cmnd *srb,/* check for state-transition errors */ if (us->srb !=NULL ) { -printk (KERN_ERR "usb-storage: Error in %s: us->srb = %p\n" , - __func__, us->srb); +dev_err (&us->pusb_intf->dev, +"Error in %s: us->srb = %p\n" , __func__, us->srb);return SCSI_MLQUEUE_HOST_BUSY ; }
PATCH v3 1/1 usb-storage: SCSI glue: use dev_err instead of printk
In reply to Matthias MaennichFollow common practice and retire printk(KERN_ERR ...) in favor of dev_err().
--- drivers/usb/storage/scsiglue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/storage/scsiglue.c +2 -2
@@ -379,8 +379,8 @@ static int queuecommand_lck(struct scsi_cmnd *srb,/* check for state-transition errors */ if (us->srb !=NULL ) { -printk (KERN_ERR "usb-storage: Error in %s: us->srb = %p\n" , - __func__, us->srb); +dev_err (&us->pusb_intf->dev, +"Error in %s: us->srb = %p\n" , __func__, us->srb);return SCSI_MLQUEUE_HOST_BUSY ; }
Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
PATCH 1/1 depmod: create and use System.map.no_namespaces
In reply to Matthias Maennichdepmod in its current version is not aware of symbol namespace in ksymtab entries introduced with 8651ec01daed ("module: add support for symbol namespaces."). They have the form
__ksymtab_NAMESPACE.symbol_name
A fix for kmod's depmod has been proposed [1]. In order to support older versions of depmod as well, create a System.map.no_namespaces during scripts/depmod.sh that has the pre-namespaces format. That way users do not immediately upgrade the userspace tool.
[1] https://lore.kernel.org/linux-modules/[email protected]/
---
Please note this depends on the new ksymtab entry format proposed in
https://lore.kernel.org/lkml/[email protected]/
That is likely to be merged soon as well as it fixes problems in 5.4-rc*, hence this patch depends on it.
Cheers,
Matthias
.gitignore | 1 + scripts/depmod.sh | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-)
.gitignore +1 -0
@@ -59,6 +59,7 @@ modules.order /vmlinux-gdb.py /vmlinuz /System.map +/System.map.no_namespaces /Module.markers /modules.builtin.modinfo
scripts/depmod.sh +7 -1
@@ -39,7 +39,13 @@ if $depmod_hack_needed; then KERNELRELEASE=99.98.$KERNELRELEASE fi -set -- -ae -F System.map +# Older versions of depmod do not support symbol namespaces in ksymtab entries, +# hence create an alternative System.map with namespace patched out to use for +# depmod. I.e. transform entries as follows: +# __ksymtab_NAMESPACE.symbol_name -> __ksymtab_symbol_name +sed 's/__ksymtab_.*\./__ksymtab_/' System.map > System.map.no_namespaces + +set -- -ae -F System.map.no_namespaces if test -n "$INSTALL_MOD_PATH"; then set -- "$@" -b "$INSTALL_MOD_PATH" fi
Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
Re: [PATCH] depmod: create and use System.map.no_namespaces
Quoted 23 lines · Matthias Maennich
depmod in its current version is not aware of symbol namespace in ksymtab entries introduced with
8651ec01daed("module: add support for symbol namespaces."). They have the form__ksymtab_NAMESPACE.symbol_name
A fix for kmod's depmod has been proposed [1]. In order to support older versions of depmod as well, create a System.map.no_namespaces during
scripts/depmod.shthat has the pre-namespaces format. That way users do not immediately upgrade the userspace tool.[1] https://lore.kernel.org/linux-modules/[email protected]/
Reported-by Stefan Wahren <[email protected]>Fixes 8651ec01daed ("module: add support for symbol namespaces.")Cc Masahiro Yamada <[email protected]>Cc Lucas De Marchi <[email protected]>Cc Jessica Yu <[email protected]>Cc Martijn Coenen <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Matthias Maennich <[email protected]>
Quoted 4 lines
---
Please note this depends on the new ksymtab entry format proposed in
https://lore.kernel.org/lkml/[email protected]/
I don't really agree with that thought, more below.
Quoted 28 lines
That is likely to be merged soon as well as it fixes problems in 5.4-rc*, hence this patch depends on it.
Cheers,
Matthias.gitignore | 1 + scripts/depmod.sh | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-).gitignore +1
-0@@ -59,6 +59,7 @@ modules.order /vmlinux-gdb.py /vmlinuz /System.map +/System.map.no_namespaces /Module.markers /modules.builtin.modinfoscripts/depmod.sh +0
-0
scripts/depmod.sh if $depmod_hack_needed; then · line 46
Quoted 9 lines
scripts/depmod.sh +5
-1@@ -39,7 +39,13 @@ if $depmod_hack_needed; then KERNELRELEASE=99.98.$KERNELRELEASE fi -set -- -ae -F System.map +# Older versions of depmod do not support symbol namespaces in ksymtab entries, +# hence create an alternative System.map with namespace patched out to use for +# depmod. I.e. transform entries as follows: +# __ksymtab_NAMESPACE.symbol_name -> __ksymtab_symbol_name +sed 's/__ksymtab_.*\./__ksymtab_/' System.map > System.map.no_namespaces
So people with old kmod will have to know they need to pass System.map.no_namespaces rather than the usual
System.map. Also, distros will need to be update to also copy the new file to the kernel package (or upgrade/patch kmod).
I'd rather maintain the current format and fix the bug that patch is fixing. The namespace
in the end IMO is just a small annoyance with a reason to exist.
Lucas De Marchi
Quoted 8 lines
scripts/depmod.sh +2
-1+ +set -- -ae -F System.map.no_namespaces if test -n "$INSTALL_MOD_PATH"; then set -- "$@" -b "$INSTALL_MOD_PATH" fi --2.23.0.581.g78d2f28ef7-goog
Signature · 1 line
Lucas De Marchi
Re: [PATCH] depmod: create and use System.map.no_namespaces
Quoted 75 lines · Lucas De Marchi
Quoted 23 lines · Matthias Maennich
depmod in its current version is not aware of symbol namespace in ksymtab entries introduced with
8651ec01daed("module: add support for symbol namespaces."). They have the form__ksymtab_NAMESPACE.symbol_name
A fix for kmod's depmod has been proposed [1]. In order to support older versions of depmod as well, create a System.map.no_namespaces during
scripts/depmod.shthat has the pre-namespaces format. That way users do not immediately upgrade the userspace tool.[1] https://lore.kernel.org/linux-modules/[email protected]/
Reported-by Stefan Wahren <[email protected]>Fixes 8651ec01daed ("module: add support for symbol namespaces.")Cc Masahiro Yamada <[email protected]>Cc Lucas De Marchi <[email protected]>Cc Jessica Yu <[email protected]>Cc Martijn Coenen <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Matthias Maennich <[email protected]>Quoted 4 lines
---
Please note this depends on the new ksymtab entry format proposed in
https://lore.kernel.org/lkml/[email protected]/I don't really agree with that thought, more below.
Quoted 28 lines
That is likely to be merged soon as well as it fixes problems in 5.4-rc*, hence this patch depends on it.
Cheers,
Matthias.gitignore | 1 + scripts/depmod.sh | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-).gitignore +1
-0@@ -59,6 +59,7 @@ modules.order /vmlinux-gdb.py /vmlinuz /System.map +/System.map.no_namespaces /Module.markers /modules.builtin.modinfoscripts/depmod.sh +0
-0scripts/depmod.sh if $depmod_hack_needed; then · line 46
Quoted 9 lines
scripts/depmod.sh +5
-1@@ -39,7 +39,13 @@ if $depmod_hack_needed; then KERNELRELEASE=99.98.$KERNELRELEASE fi -set -- -ae -F System.map +# Older versions of depmod do not support symbol namespaces in ksymtab entries, +# hence create an alternative System.map with namespace patched out to use for +# depmod. I.e. transform entries as follows: +# __ksymtab_NAMESPACE.symbol_name -> __ksymtab_symbol_name +sed 's/__ksymtab_.*\./__ksymtab_/' System.map > System.map.no_namespacesSo people with old kmod will have to know they need to pass System.map.no_namespaces rather than the usual
System.map. Also, distros will need to be update to also copy the new file to the kernel package (or upgrade/patch kmod).
Quoted 3 lines
I'd rather maintain the current format and fix the bug that patch is fixing. The namespace
in the end IMO is just a small annoyance with a reason to exist.
I agree, this fix is bad.
We should not bother kmod or any tools.
And System.map.no_namespaces is a cheesy workaround.
BTW, I expressed my negative opinion in the review process for the patch set. I am still not convinced with the namespace feature, but anyway it was merged
(with poor review and test).
Get back on track, probably the right fix would be to stop using __ksymtab_<namespace>.<symbol>.
It is not used for any purposes but passing
<namespace> / <symbol> pairs to modpost.
For example, __kstrtabns_##sym points to
the namespace string, so it would be possible
to parse it from modpost?
Then, asm("__ksymtab_" #ns NS_SEPARATOR #sym)
will go away.
Masahiro
Quoted 14 lines
Lucas De Marchi
Quoted 8 lines
scripts/depmod.sh +2
-1+ +set -- -ae -F System.map.no_namespaces if test -n "$INSTALL_MOD_PATH"; then set -- "$@" -b "$INSTALL_MOD_PATH" fi --2.23.0.581.g78d2f28ef7-goog
--
Lucas De Marchi
Signature · 2 lines
Best Regards Masahiro Yamada
Re: [PATCH] depmod: create and use System.map.no_namespaces
Hi!
Quoted 77 lines · Masahiro Yamada
Quoted 75 lines · Lucas De Marchi
Quoted 23 lines · Matthias Maennich
depmod in its current version is not aware of symbol namespace in ksymtab entries introduced with
8651ec01daed("module: add support for symbol namespaces."). They have the form__ksymtab_NAMESPACE.symbol_name
A fix for kmod's depmod has been proposed [1]. In order to support older versions of depmod as well, create a System.map.no_namespaces during
scripts/depmod.shthat has the pre-namespaces format. That way users do not immediately upgrade the userspace tool.[1] https://lore.kernel.org/linux-modules/[email protected]/
Reported-by Stefan Wahren <[email protected]>Fixes 8651ec01daed ("module: add support for symbol namespaces.")Cc Masahiro Yamada <[email protected]>Cc Lucas De Marchi <[email protected]>Cc Jessica Yu <[email protected]>Cc Martijn Coenen <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Matthias Maennich <[email protected]>Quoted 4 lines
---
Please note this depends on the new ksymtab entry format proposed in
https://lore.kernel.org/lkml/[email protected]/I don't really agree with that thought, more below.
Quoted 28 lines
That is likely to be merged soon as well as it fixes problems in 5.4-rc*, hence this patch depends on it.
Cheers,
Matthias.gitignore | 1 + scripts/depmod.sh | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-).gitignore +1
-0@@ -59,6 +59,7 @@ modules.order /vmlinux-gdb.py /vmlinuz /System.map +/System.map.no_namespaces /Module.markers /modules.builtin.modinfoscripts/depmod.sh +0
-0scripts/depmod.sh if $depmod_hack_needed; then · line 46
Quoted 9 lines
scripts/depmod.sh +5
-1@@ -39,7 +39,13 @@ if $depmod_hack_needed; then KERNELRELEASE=99.98.$KERNELRELEASE fi -set -- -ae -F System.map +# Older versions of depmod do not support symbol namespaces in ksymtab entries, +# hence create an alternative System.map with namespace patched out to use for +# depmod. I.e. transform entries as follows: +# __ksymtab_NAMESPACE.symbol_name -> __ksymtab_symbol_name +sed 's/__ksymtab_.*\./__ksymtab_/' System.map > System.map.no_namespacesSo people with old kmod will have to know they need to pass System.map.no_namespaces rather than the usual
System.map. Also, distros will need to be update to also copy the new file to the kernel package (or upgrade/patch kmod).
Quoted 7 lines
Quoted 3 lines
I'd rather maintain the current format and fix the bug that patch is fixing. The namespace
in the end IMO is just a small annoyance with a reason to exist.I agree, this fix is bad.
We should not bother kmod or any tools.
And System.map.no_namespaces is a cheesy workaround.
Thanks for the feedback!
Based on the discussion from last year about changing kmod/depmod for this change to the ksymtab entries,
(https://lore.kernel.org/lkml/CAKi4VA+wvVxPxVSP6ruSR++TYvavKPNAQ5XhREF_9ZxeOKQirg@mail.gmail.com/),
I assumed this approach would be acceptable. The workaround (yeah, it is a hack) is a way to mitigate the issue for people that can't update depmod so easily. System.map.no_namespaces was not intended to be part of any distribution, but rather used locally in depmod.sh. I could have made this more clear.
Quoted 15 lines
BTW, I expressed my negative opinion in the review process for the patch set. I am still not convinced with the namespace feature, but anyway it was merged
(with poor review and test).Get back on track, probably the right fix would be to stop using __ksymtab_<namespace>.<symbol>.
It is not used for any purposes but passing
<namespace> / <symbol> pairs to modpost.
Quoted 6 lines
For example, __kstrtabns_##sym points to
the namespace string, so it would be possible
to parse it from modpost?Then,
asm("__ksymtab_" #ns NS_SEPARATOR #sym)
will go away.
I will give this a try.
Cheers,
Matthias
Quoted 27 lines
Masahiro
Quoted 14 lines
Lucas De Marchi
Quoted 8 lines
scripts/depmod.sh +2
-1+ +set -- -ae -F System.map.no_namespaces if test -n "$INSTALL_MOD_PATH"; then set -- "$@" -b "$INSTALL_MOD_PATH" fi --2.23.0.581.g78d2f28ef7-goog
--
Lucas De MarchiSignature · 2 lines
Best Regards Masahiro Yamada
Re: [PATCH] depmod: create and use System.map.no_namespaces
+++ Matthias Maennich [07/10/19 07:46 +0100]:
Quoted 114 lines
Hi!
Quoted 77 lines · Masahiro Yamada
Quoted 75 lines · Lucas De Marchi
Quoted 23 lines · Matthias Maennich
depmod in its current version is not aware of symbol namespace in ksymtab entries introduced with
8651ec01daed("module: add support for symbol namespaces."). They have the form__ksymtab_NAMESPACE.symbol_name
A fix for kmod's depmod has been proposed [1]. In order to support older versions of depmod as well, create a System.map.no_namespaces during
scripts/depmod.shthat has the pre-namespaces format. That way users do not immediately upgrade the userspace tool.[1] https://lore.kernel.org/linux-modules/[email protected]/
Reported-by Stefan Wahren <[email protected]>Fixes 8651ec01daed ("module: add support for symbol namespaces.")Cc Masahiro Yamada <[email protected]>Cc Lucas De Marchi <[email protected]>Cc Jessica Yu <[email protected]>Cc Martijn Coenen <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Matthias Maennich <[email protected]>Quoted 4 lines
---
Please note this depends on the new ksymtab entry format proposed in
https://lore.kernel.org/lkml/[email protected]/I don't really agree with that thought, more below.
Quoted 28 lines
That is likely to be merged soon as well as it fixes problems in 5.4-rc*, hence this patch depends on it.
Cheers,
Matthias.gitignore | 1 + scripts/depmod.sh | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-).gitignore +1
-0@@ -59,6 +59,7 @@ modules.order /vmlinux-gdb.py /vmlinuz /System.map +/System.map.no_namespaces /Module.markers /modules.builtin.modinfoscripts/depmod.sh +0
-0scripts/depmod.sh if $depmod_hack_needed; then · line 46
Quoted 9 lines
scripts/depmod.sh +5
-1@@ -39,7 +39,13 @@ if $depmod_hack_needed; then KERNELRELEASE=99.98.$KERNELRELEASE fi -set -- -ae -F System.map +# Older versions of depmod do not support symbol namespaces in ksymtab entries, +# hence create an alternative System.map with namespace patched out to use for +# depmod. I.e. transform entries as follows: +# __ksymtab_NAMESPACE.symbol_name -> __ksymtab_symbol_name +sed 's/__ksymtab_.*\./__ksymtab_/' System.map > System.map.no_namespacesSo people with old kmod will have to know they need to pass System.map.no_namespaces rather than the usual
System.map. Also, distros will need to be update to also copy the new file to the kernel package (or upgrade/patch kmod).Quoted 7 lines
Quoted 3 lines
I'd rather maintain the current format and fix the bug that patch is fixing. The namespace
in the end IMO is just a small annoyance with a reason to exist.I agree, this fix is bad.
We should not bother kmod or any tools.
And System.map.no_namespaces is a cheesy workaround.Thanks for the feedback!
Based on the discussion from last year about changing kmod/depmod for this change to the ksymtab entries,
(https://lore.kernel.org/lkml/CAKi4VA+wvVxPxVSP6ruSR++TYvavKPNAQ5XhREF_9ZxeOKQirg@mail.gmail.com/),
I assumed this approach would be acceptable. The workaround (yeah, it is a hack) is a way to mitigate the issue for people that can't update depmod so easily. System.map.no_namespaces was not intended to be part of any distribution, but rather used locally indepmod.sh. I could have made this more clear.Quoted 15 lines
BTW, I expressed my negative opinion in the review process for the patch set. I am still not convinced with the namespace feature, but anyway it was merged
(with poor review and test).Get back on track, probably the right fix would be to stop using __ksymtab_<namespace>.<symbol>.
It is not used for any purposes but passing
<namespace> / <symbol> pairs to modpost.
Quoted 8 lines
Quoted 6 lines
For example, __kstrtabns_##sym points to
the namespace string, so it would be possible
to parse it from modpost?Then,
asm("__ksymtab_" #ns NS_SEPARATOR #sym)
will go away.I will give this a try.
That sounds like a good idea. Maybe one way of going about it is to take the symbol value of __kstrtabns_##sym, subtract the section address (the section referred to by the st_shndx) from it to obtain the offset into __ksymtab_strings, and read in the namespace string from that offset.