diff mbox

[RFC,v2,7/7] checkpatch: add pF/pf deprecation warning

Message ID 1505929138.12311.5.camel@perches.com (mailing list archive)
State Awaiting Upstream, archived
Headers show

Commit Message

Joe Perches Sept. 20, 2017, 5:38 p.m. UTC
On Thu, 2017-09-21 at 01:29 +0900, Sergey Senozhatsky wrote:
> We deprecated '%pF/%pf' printk specifiers, since '%pS/%ps' is now smart
> enough to handle function pointer dereference on platforms where such
> dereference is required.
> 
> checkpatch warning example:
> 
> WARNING: Use '%pS/%ps' instead. This pointer extension was deprecated: '%pF'

If this series is accepted,  I think this message
is unclear and would prefer something like:
---
scripts/checkpatch.pl | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

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

Comments

Helge Deller Sept. 20, 2017, 5:53 p.m. UTC | #1
On 20.09.2017 19:38, Joe Perches wrote:
> On Thu, 2017-09-21 at 01:29 +0900, Sergey Senozhatsky wrote:
>> We deprecated '%pF/%pf' printk specifiers, since '%pS/%ps' is now smart
>> enough to handle function pointer dereference on platforms where such
>> dereference is required.
>>
>> checkpatch warning example:
>>
>> WARNING: Use '%pS/%ps' instead. This pointer extension was deprecated: '%pF'
> 
> If this series is accepted,  I think this message
> is unclear and would prefer something like:

Is it worth to mention, that it's still needed in older kernels?
Just in case some patch get's backported.

Helge
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Joe Perches Sept. 20, 2017, 6:24 p.m. UTC | #2
On Wed, 2017-09-20 at 19:53 +0200, Helge Deller wrote:
> On 20.09.2017 19:38, Joe Perches wrote:
> > On Thu, 2017-09-21 at 01:29 +0900, Sergey Senozhatsky wrote:
> > > We deprecated '%pF/%pf' printk specifiers, since '%pS/%ps' is now smart
> > > enough to handle function pointer dereference on platforms where such
> > > dereference is required.
> > > 
> > > checkpatch warning example:
> > > 
> > > WARNING: Use '%pS/%ps' instead. This pointer extension was deprecated: '%pF'
> > 
> > If this series is accepted,  I think this message
> > is unclear and would prefer something like:
> 
> Is it worth to mention, that it's still needed in older kernels?
> Just in case some patch get's backported.

I think probably not.

There are relatively few references and
modifications are unlikely to be backported.

--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergey Senozhatsky Sept. 21, 2017, 12:27 a.m. UTC | #3
On (09/20/17 10:38), Joe Perches wrote:
> On Thu, 2017-09-21 at 01:29 +0900, Sergey Senozhatsky wrote:
> > We deprecated '%pF/%pf' printk specifiers, since '%pS/%ps' is now smart
> > enough to handle function pointer dereference on platforms where such
> > dereference is required.
> > 
> > checkpatch warning example:
> > 
> > WARNING: Use '%pS/%ps' instead. This pointer extension was deprecated: '%pF'
> 
> If this series is accepted,  I think this message
> is unclear and would prefer something like:

sure, can tweak the patch.

[..]
>  			if ($bad_extension ne "") {
>  				my $stat_real = raw_line($linenr, 0);
> +				my $ext_type = "Invalid";
> +				my $use = "";
>  				for (my $count = $linenr + 1; $count <= $lc; $count++) {
>  					$stat_real = $stat_real . "\n" . raw_line($count, 0);
>  				}
> +				if ($bad_extension =~ /p[Ff]/i) {
						I think /i is not necessary here

> +					$ext_type = "Deprecated";
> +					$use = " - use %pS instead";
> +					$use =~ s/pS/ps/ if ($bad_extension =~ /pf/);
							ok, handy :)

	-ss
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Joe Perches Sept. 21, 2017, 2:28 a.m. UTC | #4
On Thu, 2017-09-21 at 09:27 +0900, Sergey Senozhatsky wrote:
> On (09/20/17 10:38), Joe Perches wrote:
> > On Thu, 2017-09-21 at 01:29 +0900, Sergey Senozhatsky wrote:
> > > We deprecated '%pF/%pf' printk specifiers, since '%pS/%ps' is now smart
> > > enough to handle function pointer dereference on platforms where such
> > > dereference is required.
> > > 
> > > checkpatch warning example:
> > > 
> > > WARNING: Use '%pS/%ps' instead. This pointer extension was deprecated: '%pF'
> > 
> > If this series is accepted,  I think this message
> > is unclear and would prefer something like:
> 
> sure, can tweak the patch.
> 
> [..]
> >  			if ($bad_extension ne "") {
> >  				my $stat_real = raw_line($linenr, 0);
> > +				my $ext_type = "Invalid";
> > +				my $use = "";
> >  				for (my $count = $linenr + 1; $count <= $lc; $count++) {
> >  					$stat_real = $stat_real . "\n" . raw_line($count, 0);
> >  				}
> > +				if ($bad_extension =~ /p[Ff]/i) {
> 
> 						I think /i is not necessary here

You are right, it's not.

--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergey Senozhatsky Sept. 21, 2017, 7:43 a.m. UTC | #5
On (09/20/17 11:24), Joe Perches wrote:
> On Wed, 2017-09-20 at 19:53 +0200, Helge Deller wrote:
[..]
> > Is it worth to mention, that it's still needed in older kernels?
> > Just in case some patch get's backported.

good question.

> I think probably not.
> 
> There are relatively few references and
> modifications are unlikely to be backported.

I tend to agree.

unlikely anyone backports printk message updates. I have quickly glanced
through stable-4.9 and haven't seen such backports. well, may be there
are some.

can tweak the warning a bit, probably. e.g. "if you are planning to
backport your change to kernels older than 4.14 then ignore this
warning". but not sure if it's worth it.

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

Patch

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index dd2c262aebbf..71f3273d5913 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5762,18 +5762,25 @@  sub process {
 		        for (my $count = $linenr; $count <= $lc; $count++) {
 				my $fmt = get_quoted_string($lines[$count - 1], raw_line($count, 0));
 				$fmt =~ s/%%//g;
-				if ($fmt =~ /(\%[\*\d\.]*p(?![\WFfSsBKRraEhMmIiUDdgVCbGNO]).)/) {
+				if ($fmt =~ /(\%[\*\d\.]*p(?![\WSsBKRraEhMmIiUDdgVCbGNO]).)/) {
 					$bad_extension = $1;
 					last;
 				}
 			}
 			if ($bad_extension ne "") {
 				my $stat_real = raw_line($linenr, 0);
+				my $ext_type = "Invalid";
+				my $use = "";
 				for (my $count = $linenr + 1; $count <= $lc; $count++) {
 					$stat_real = $stat_real . "\n" . raw_line($count, 0);
 				}
+				if ($bad_extension =~ /p[Ff]/i) {
+					$ext_type = "Deprecated";
+					$use = " - use %pS instead";
+					$use =~ s/pS/ps/ if ($bad_extension =~ /pf/);
+				}
 				WARN("VSPRINTF_POINTER_EXTENSION",
-				     "Invalid vsprintf pointer extension '$bad_extension'\n" . "$here\n$stat_real\n");
+				     "$ext_type vsprintf pointer extension '$bad_extension'$use\n" . "$here\n$stat_real\n");
 			}
 		}