Fix C++ kernel in include/linux/mtd/mtd.h

Message ID 20170923201314.GA14742@amd
State New
Delegated to: Richard Weinberger
Headers show
Series
  • Fix C++ kernel in include/linux/mtd/mtd.h
Related show

Commit Message

Pavel Machek Sept. 23, 2017, 8:13 p.m.
C++ comments look wrong in kernel tree. Fix one.

Signed-off-by: Pavel Machek <pavel@ucw.cz>

Comments

Marek Vasut Sept. 23, 2017, 9:10 p.m. | #1
On 09/23/2017 10:13 PM, Pavel Machek wrote:
> C++ comments look wrong in kernel tree. Fix one.

AFAIR they are now (sadly) accepted, but this patch works for me.
Would be nice if trivial could pick it.

> Signed-off-by: Pavel Machek <pavel@ucw.cz>
> 
> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
> index 6cd0f6b..849543f1 100644
> --- a/include/linux/mtd/mtd.h
> +++ b/include/linux/mtd/mtd.h
> @@ -267,7 +267,7 @@ struct mtd_info {
>  	 */
>  	unsigned int bitflip_threshold;
>  
> -	// Kernel-only stuff starts here.
> +	/* Kernel-only stuff starts here. */
>  	const char *name;
>  	int index;
>  
>
Boris Brezillon Sept. 24, 2017, 8:20 a.m. | #2
On Sat, 23 Sep 2017 23:10:26 +0200
Marek Vasut <marek.vasut@gmail.com> wrote:

> On 09/23/2017 10:13 PM, Pavel Machek wrote:
> > C++ comments look wrong in kernel tree. Fix one.  
> 
> AFAIR they are now (sadly) accepted, but this patch works for me.

Works for me too. Here is my

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> Would be nice if trivial could pick it.

Hm, I'd recommend not doing that, otherwise we might end up with a
conflict if a patch modify something in this area.

> 
> > Signed-off-by: Pavel Machek <pavel@ucw.cz>
> > 
> > diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
> > index 6cd0f6b..849543f1 100644
> > --- a/include/linux/mtd/mtd.h
> > +++ b/include/linux/mtd/mtd.h
> > @@ -267,7 +267,7 @@ struct mtd_info {
> >  	 */
> >  	unsigned int bitflip_threshold;
> >  
> > -	// Kernel-only stuff starts here.
> > +	/* Kernel-only stuff starts here. */
> >  	const char *name;
> >  	int index;
> >  
> >   
> 
>
Richard Weinberger Sept. 24, 2017, 8:23 a.m. | #3
Am Sonntag, 24. September 2017, 10:20:06 CEST schrieb Boris Brezillon:
> On Sat, 23 Sep 2017 23:10:26 +0200
> 
> Marek Vasut <marek.vasut@gmail.com> wrote:
> > On 09/23/2017 10:13 PM, Pavel Machek wrote:
> > > C++ comments look wrong in kernel tree. Fix one.
> > 
> > AFAIR they are now (sadly) accepted, but this patch works for me.
> 
> Works for me too. Here is my
> 
> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> 
> > Would be nice if trivial could pick it.
> 
> Hm, I'd recommend not doing that, otherwise we might end up with a
> conflict if a patch modify something in this area.

Let's carry it via MTD.
BTW: Shouldn't it be s/kernel/comment/ in the subject line?

Thanks,
//richard
Pavel Machek Oct. 6, 2017, 11:55 a.m. | #4
On Sun 2017-09-24 10:23:25, Richard Weinberger wrote:
> Am Sonntag, 24. September 2017, 10:20:06 CEST schrieb Boris Brezillon:
> > On Sat, 23 Sep 2017 23:10:26 +0200
> > 
> > Marek Vasut <marek.vasut@gmail.com> wrote:
> > > On 09/23/2017 10:13 PM, Pavel Machek wrote:
> > > > C++ comments look wrong in kernel tree. Fix one.
> > > 
> > > AFAIR they are now (sadly) accepted, but this patch works for me.
> > 
> > Works for me too. Here is my
> > 
> > Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > 
> > > Would be nice if trivial could pick it.
> > 
> > Hm, I'd recommend not doing that, otherwise we might end up with a
> > conflict if a patch modify something in this area.
> 
> Let's carry it via MTD.
> BTW: Shouldn't it be s/kernel/comment/ in the subject line?

Yes, it should. Can it be fixed while applying?
									Pavel
Richard Weinberger Oct. 6, 2017, noon | #5
Am Freitag, 6. Oktober 2017, 13:55:14 CEST schrieb Pavel Machek:
> > Let's carry it via MTD.
> > BTW: Shouldn't it be s/kernel/comment/ in the subject line?
> 
> Yes, it should. Can it be fixed while applying?

Sure. :)

Thanks,
//richard
David Woodhouse Oct. 6, 2017, 12:01 p.m. | #6
On Fri, 2017-10-06 at 14:00 +0200, Richard Weinberger wrote:
> Am Freitag, 6. Oktober 2017, 13:55:14 CEST schrieb Pavel Machek:
> > 
> > > 
> > > Let's carry it via MTD.
> > > BTW: Shouldn't it be s/kernel/comment/ in the subject line?
> > Yes, it should. Can it be fixed while applying?
> Sure. :)

You can change 'C++' to 'C99' too, while you're at it :)
Pavel Machek Oct. 6, 2017, 12:13 p.m. | #7
On Fri 2017-10-06 13:01:16, David Woodhouse wrote:
> On Fri, 2017-10-06 at 14:00 +0200, Richard Weinberger wrote:
> > Am Freitag, 6. Oktober 2017, 13:55:14 CEST schrieb Pavel Machek:
> > > 
> > > > 
> > > > Let's carry it via MTD.
> > > > BTW: Shouldn't it be s/kernel/comment/ in the subject line?
> > > Yes, it should. Can it be fixed while applying?
> > Sure. :)
> 
> You can change 'C++' to 'C99' too, while you're at it :)

No. They are C++ comments... as in... dangerous infection that came
from C++. Yes, C99 is infected, too, but still C++ is original source
of infection :-).

                                                                        Pavel
David Woodhouse Oct. 6, 2017, 12:25 p.m. | #8
On Fri, 2017-10-06 at 14:13 +0200, Pavel Machek wrote:
> > You can change 'C++' to 'C99' too, while you're at it :)
>
> No. They are C++ comments... as in... dangerous infection that came
> from C++. Yes, C99 is infected, too, but still C++ is original source
> of infection :-).

C++ is a different language, and irrelevant here. You could call them
Java comments if you want, but that would be equally silly. In the
kernel, they are C99 comments. Valid, but not our preferred style
(which is fair enough, unlike our idiotic refusal to use C99 integer
types).
Al Viro Oct. 6, 2017, 12:32 p.m. | #9
On Fri, Oct 06, 2017 at 02:13:59PM +0200, Pavel Machek wrote:
> On Fri 2017-10-06 13:01:16, David Woodhouse wrote:
> > On Fri, 2017-10-06 at 14:00 +0200, Richard Weinberger wrote:
> > > Am Freitag, 6. Oktober 2017, 13:55:14 CEST schrieb Pavel Machek:
> > > > 
> > > > > 
> > > > > Let's carry it via MTD.
> > > > > BTW: Shouldn't it be s/kernel/comment/ in the subject line?
> > > > Yes, it should. Can it be fixed while applying?
> > > Sure. :)
> > 
> > You can change 'C++' to 'C99' too, while you're at it :)
> 
> No. They are C++ comments... as in... dangerous infection that came
> from C++. Yes, C99 is infected, too, but still C++ is original source
> of infection :-).

No, it is not.  See https://www.bell-labs.com/usr/dmr/www/bcpl.html and
scans refered therein; let's keep snobbery historically accurate...

IOW, it's not C++ invention - it's BCPL one.
Geert Uytterhoeven Oct. 6, 2017, 1:04 p.m. | #10
On Fri, Oct 6, 2017 at 2:32 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> On Fri, Oct 06, 2017 at 02:13:59PM +0200, Pavel Machek wrote:
>> On Fri 2017-10-06 13:01:16, David Woodhouse wrote:
>> > On Fri, 2017-10-06 at 14:00 +0200, Richard Weinberger wrote:
>> > > Am Freitag, 6. Oktober 2017, 13:55:14 CEST schrieb Pavel Machek:
>> > > > > Let's carry it via MTD.
>> > > > > BTW: Shouldn't it be s/kernel/comment/ in the subject line?
>> > > > Yes, it should. Can it be fixed while applying?
>> > > Sure. :)
>> >
>> > You can change 'C++' to 'C99' too, while you're at it :)
>>
>> No. They are C++ comments... as in... dangerous infection that came
>> from C++. Yes, C99 is infected, too, but still C++ is original source
>> of infection :-).
>
> No, it is not.  See https://www.bell-labs.com/usr/dmr/www/bcpl.html and
> scans refered therein; let's keep snobbery historically accurate...
>
> IOW, it's not C++ invention - it's BCPL one.

Ah, longing for the return of BPTRs and BSTRs ;-)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Alan Cox Oct. 12, 2017, 10:31 a.m. | #11
On Fri, 06 Oct 2017 13:25:55 +0100
David Woodhouse <dwmw2@infradead.org> wrote:

> On Fri, 2017-10-06 at 14:13 +0200, Pavel Machek wrote:
> > > You can change 'C++' to 'C99' too, while you're at it :)  
> >
> > No. They are C++ comments... as in... dangerous infection that came
> > from C++. Yes, C99 is infected, too, but still C++ is original source
> > of infection :-).  
> 
> C++ is a different language, and irrelevant here. You could call them
> Java comments if you want, but that would be equally silly. In the
> kernel, they are C99 comments. Valid, but not our preferred style
> (which is fair enough, unlike our idiotic refusal to use C99 integer
> types).

We might as well allow them. We are using those compiler settings so the
cases where your compilation produces different results in C99 and more
classic C are no longer a risk 8)


int main(int argc, char *argv[])
{
	int x = 1//**/
	-1;

	if (x == 0)
		puts("Ewww C99");
	exit(0);
}

Patch

diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 6cd0f6b..849543f1 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -267,7 +267,7 @@  struct mtd_info {
 	 */
 	unsigned int bitflip_threshold;
 
-	// Kernel-only stuff starts here.
+	/* Kernel-only stuff starts here. */
 	const char *name;
 	int index;