2016-11-25 01:02:51

by Jongman Heo

[permalink] [raw]
Subject: mptbase: fix printk output using pr_cont


With current linus git, Fusion MPT driver prints out unnecessary new lines.

[ 2.090255] Fusion MPT base driver 3.04.20
[ 2.090257] Copyright (c) 1999-2008 LSI Corporation
[ 2.090262] Fusion MPT SPI Host driver 3.04.20
[ 2.090979] mptbase: ioc0: Initiating bringup
[ 2.196306] ioc0:
[ 2.196310] LSI53C1030 B0:
[ 2.196312] Capabilities={
[ 2.196313] Initiator
[ 2.196314] }


I modified set of printk()s to pr_cont to fix the problem.
Not sure if it's correct, but now I can see the message as previous.

[ 2.404271] Fusion MPT base driver 3.04.20
[ 2.404274] Copyright (c) 1999-2008 LSI Corporation
[ 2.404279] Fusion MPT SPI Host driver 3.04.20
[ 2.405037] mptbase: ioc0: Initiating bringup
[ 2.509568] ioc0: LSI53C1030 B0: Capabilities={Initiator}


diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 89c7ed1..0d434de 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -2866,23 +2866,23 @@ MptDisplayIocCapabilities(MPT_ADAPTER *ioc)
{
int i = 0;

- printk(KERN_INFO "%s: ", ioc->name);
+ pr_cont(KERN_INFO "%s: ", ioc->name);
if (ioc->prod_name)
- printk("%s: ", ioc->prod_name);
- printk("Capabilities={");
+ pr_cont("%s: ", ioc->prod_name);
+ pr_cont("Capabilities={");

if (ioc->pfacts[0].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_INITIATOR) {
- printk("Initiator");
+ pr_cont("Initiator");
i++;
}

if (ioc->pfacts[0].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_TARGET) {
- printk("%sTarget", i ? "," : "");
+ pr_cont("%sTarget", i ? "," : "");
i++;
}

if (ioc->pfacts[0].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) {
- printk("%sLAN", i ? "," : "");
+ pr_cont("%sLAN", i ? "," : "");
i++;
}

@@ -2891,12 +2891,11 @@ MptDisplayIocCapabilities(MPT_ADAPTER *ioc)
* This would probably evoke more questions than it's worth
*/
if (ioc->pfacts[0].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_TARGET) {
- printk("%sLogBusAddr", i ? "," : "");
+ pr_cont("%sLogBusAddr", i ? "," : "");
i++;
}
#endif
-
- printk("}\n");
+ pr_cont("}\n");
}

/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/


2016-11-25 11:34:36

by Joe Perches

[permalink] [raw]
Subject: Re: mptbase: fix printk output using pr_cont

On Fri, 2016-11-25 at 01:02 +0000, Jongman Heo wrote:
> With current linus git, Fusion MPT driver prints out unnecessary new lines.
>
> [ 2.090255] Fusion MPT base driver 3.04.20
> [ 2.090257] Copyright (c) 1999-2008 LSI Corporation
> [ 2.090262] Fusion MPT SPI Host driver 3.04.20
> [ 2.090979] mptbase: ioc0: Initiating bringup
> [ 2.196306] ioc0:
> [ 2.196310] LSI53C1030 B0:
> [ 2.196312] Capabilities={
> [ 2.196313] Initiator
> [ 2.196314] }
>
>
> I modified set of printk()s to pr_cont to fix the problem.
> Not sure if it's correct, but now I can see the message as previous.
[]
> diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
[]
> @@ -2866,23 +2866,23 @@ MptDisplayIocCapabilities(MPT_ADAPTER *ioc)
> {
> int i = 0;
>
> - printk(KERN_INFO "%s: ", ioc->name);
> + pr_cont(KERN_INFO "%s: ", ioc->name);

This is not s correct conversion.
This can either stay as printk(KERN_INFO
or be converted to pr_info

pr_info("%s: ", ioc->name);