Re: clean up kernel_{read,write} & friends v2

2020-06-05 Thread Nicolas Pitre
On Fri, 5 Jun 2020, Philippe Mathieu-Daudé wrote:

> Unfortunately refreshable braille displays have that "hardware
> limitations". 80 cells displays are very expensive.
> Visual impairments is rarely a "choice".
> Relaxing the 80-char limit make it harder for blind developers
> to contribute.

Well, not really.

It is true that 80-cells displays are awfully expensive. IMHO they are 
also unwieldy due to their size: they are hardly portable, and they 
require your hands to move twice as far which may sometimes impair 
reading efficiency. So I never liked them.

My braille display has 40 cells only. So even with a 80-cells limit I 
always had to pan the display to see the whole line anyway.

My text console is set to 160x128. The trick here is to have the number 
of columns be a multiple of the braille display's width to avoid dead 
areas when panning to the right.

So if you ask me, I'm not against relaxing the 80 columns limit for 
code. What really matters to me is that I can stay clear of any GUI.


Nicolas

Re: clean up kernel_{read,write} & friends v2

2020-06-04 Thread Philippe Mathieu-Daudé
Hi Linus,

On 5/29/20 9:19 PM, Linus Torvalds wrote:
> On Fri, May 29, 2020 at 6:08 AM David Laight  wrote:
>>
>> A wide monitor is for looking at lots of files.
> 
> Not necessarily.
> 
> Excessive line breaks are BAD. They cause real and every-day problems.
> 
> They cause problems for things like "grep" both in the patterns and in
> the output, since grep (and a lot of other very basic unix utilities)
> is fundamentally line-based.
> 
> So the fact is, many of us have long long since skipped the whole
> "80-column terminal" model, for the same reason that we have many more
> lines than 25 lines visible at a time.
> 
> And honestly, I don't want to see patches that make the kernel reading
> experience worse for me and likely for the vast majority of people,
> based on the argument that some odd people have small terminal
> windows.
> 
> If you or Christoph have 80 character lines, you'll get possibly ugly
> wrapped output. Tough. That's _your_ choice. Your hardware limitations
> shouldn't be a pain for the rest of us.

Unfortunately refreshable braille displays have that "hardware
limitations". 80 cells displays are very expensive.
Visual impairments is rarely a "choice".
Relaxing the 80-char limit make it harder for blind developers
to contribute.

> Longer lines are fundamentally useful. My monitor is not only a lot
> wider than it is tall, my fonts are universally narrower than they are
> tall. Long lines are natural.
> 
> When I tile my terminal windows on my display, I can have 6 terminals
> visible at one time, and that's because I have them three wide. And I
> could still fit 80% of a fourth one side-by-side.
> 
> And guess what? That's with my default "100x50" terminal window (go to
> your gnome terminal settings, you'll find that the 80x25 thing is just
> an initial default that you can change), not with some 80x25 one. And
> that's with a font that has anti-aliasing and isn't some pixelated
> mess.
> 
> And most of my terminals actually end up being dragged wider and
> taller than that. I checked, and my main one is 142x76 characters
> right now, because it turns out that wider (and taller) terminals are
> useful not just for source code.
> 
> Have you looked at "ps ax" output lately? Or used "top"? Or done "git
> diff --stat" or any number of things where it turns out that 80x25 is
> really really limiting, and is simply NO LONGER RELEVANT to most of
> us.
> 
> So no. I do not care about somebody with a 80x25 terminal window
> getting line wrapping.
> 
> For exactly the same reason I find it completely irrelevant if
> somebody says that their kernel compile takes 10 hours because they
> are doing kernel development on a Raspberry PI with 4GB of RAM.
> 
> People with restrictive hardware shouldn't make it more inconvenient
> for people who have better resources. Yes, we'll accommodate things to
> within reasonable limits. But no, 80-column terminals in 2020 isn't
> "reasonable" any more as far as I'm concerned. People commonly used
> 132-column terminals even back in the 80's, for chrissake, don't try
> to make 80 columns some immovable standard.
> 
> If you choose to use a 80-column terminal, you can live with the line
> wrapping. It's just that simple.
> 
> And longer lines are simply useful. Part of that is that we aren't
> programming in the 80's any more, and our source code is fundamentally
> wider as a result.
> 
> Yes, local iteration variables are still called 'i', because more
> context just isn't helpful for some anonymous counter. Being concise
> is still a good thing, and overly verbose names are not inherently
> better.
> 
> But still - it's entirely reasonable to have variable names that are
> 10-15 characters and it makes the code more legible. Writing things
> out instead of using abbreviations etc.
> 
> And yes, we do use wide tabs, because that makes indentation something
> you can visually see in the structure at a glance and on a
> whole-function basis, rather than something you have to try to
> visually "line up" things for or count spaces.
> 
> So we have lots of fairly fundamental issues that fairly easily make
> for longer lines in many circumstances.
> 
> And yes, we do line breaks at some point. But there really isn't any
> reason to make that point be 80 columns any more.
> 
>   Linus

Regards,

Phil.


Re: clean up kernel_{read,write} & friends v2

2020-05-29 Thread Casey Schaufler
On 5/29/2020 12:19 PM, Linus Torvalds wrote:
> On Fri, May 29, 2020 at 6:08 AM David Laight  wrote:
>> A wide monitor is for looking at lots of files.
> Not necessarily.
>
> Excessive line breaks are BAD. They cause real and every-day problems.
>
> They cause problems for things like "grep" both in the patterns and in
> the output, since grep (and a lot of other very basic unix utilities)
> is fundamentally line-based.
>
> So the fact is, many of us have long long since skipped the whole
> "80-column terminal" model, for the same reason that we have many more
> lines than 25 lines visible at a time.
>
> And honestly, I don't want to see patches that make the kernel reading
> experience worse for me and likely for the vast majority of people,
> based on the argument that some odd people have small terminal
> windows.
>
> If you or Christoph have 80 character lines, you'll get possibly ugly
> wrapped output. Tough. That's _your_ choice. Your hardware limitations
> shouldn't be a pain for the rest of us.
>
> Longer lines are fundamentally useful. My monitor is not only a lot
> wider than it is tall, my fonts are universally narrower than they are
> tall. Long lines are natural.
>
> When I tile my terminal windows on my display, I can have 6 terminals
> visible at one time, and that's because I have them three wide. And I
> could still fit 80% of a fourth one side-by-side.
>
> And guess what? That's with my default "100x50" terminal window (go to
> your gnome terminal settings, you'll find that the 80x25 thing is just
> an initial default that you can change), not with some 80x25 one. And
> that's with a font that has anti-aliasing and isn't some pixelated
> mess.
>
> And most of my terminals actually end up being dragged wider and
> taller than that. I checked, and my main one is 142x76 characters
> right now, because it turns out that wider (and taller) terminals are
> useful not just for source code.
>
> Have you looked at "ps ax" output lately? Or used "top"? Or done "git
> diff --stat" or any number of things where it turns out that 80x25 is
> really really limiting, and is simply NO LONGER RELEVANT to most of
> us.
>
> So no. I do not care about somebody with a 80x25 terminal window
> getting line wrapping.

The first law of good C programming is:
"Thou shalt adhere to the One True Brace Style"

It extrapolates into indentation, line width, and a number of
other things. Since Linux is a trademark of Linus Torvalds,
you get to define what the "One Truth" is. Time to resize my
terminals.

>
> For exactly the same reason I find it completely irrelevant if
> somebody says that their kernel compile takes 10 hours because they
> are doing kernel development on a Raspberry PI with 4GB of RAM.
>
> People with restrictive hardware shouldn't make it more inconvenient
> for people who have better resources. Yes, we'll accommodate things to
> within reasonable limits. But no, 80-column terminals in 2020 isn't
> "reasonable" any more as far as I'm concerned. People commonly used
> 132-column terminals even back in the 80's, for chrissake, don't try
> to make 80 columns some immovable standard.
>
> If you choose to use a 80-column terminal, you can live with the line
> wrapping. It's just that simple.
>
> And longer lines are simply useful. Part of that is that we aren't
> programming in the 80's any more, and our source code is fundamentally
> wider as a result.
>
> Yes, local iteration variables are still called 'i', because more
> context just isn't helpful for some anonymous counter. Being concise
> is still a good thing, and overly verbose names are not inherently
> better.
>
> But still - it's entirely reasonable to have variable names that are
> 10-15 characters and it makes the code more legible. Writing things
> out instead of using abbreviations etc.
>
> And yes, we do use wide tabs, because that makes indentation something
> you can visually see in the structure at a glance and on a
> whole-function basis, rather than something you have to try to
> visually "line up" things for or count spaces.
>
> So we have lots of fairly fundamental issues that fairly easily make
> for longer lines in many circumstances.
>
> And yes, we do line breaks at some point. But there really isn't any
> reason to make that point be 80 columns any more.
>
>   Linus



Re: clean up kernel_{read,write} & friends v2

2020-05-29 Thread Linus Torvalds
On Fri, May 29, 2020 at 6:08 AM David Laight  wrote:
>
> A wide monitor is for looking at lots of files.

Not necessarily.

Excessive line breaks are BAD. They cause real and every-day problems.

They cause problems for things like "grep" both in the patterns and in
the output, since grep (and a lot of other very basic unix utilities)
is fundamentally line-based.

So the fact is, many of us have long long since skipped the whole
"80-column terminal" model, for the same reason that we have many more
lines than 25 lines visible at a time.

And honestly, I don't want to see patches that make the kernel reading
experience worse for me and likely for the vast majority of people,
based on the argument that some odd people have small terminal
windows.

If you or Christoph have 80 character lines, you'll get possibly ugly
wrapped output. Tough. That's _your_ choice. Your hardware limitations
shouldn't be a pain for the rest of us.

Longer lines are fundamentally useful. My monitor is not only a lot
wider than it is tall, my fonts are universally narrower than they are
tall. Long lines are natural.

When I tile my terminal windows on my display, I can have 6 terminals
visible at one time, and that's because I have them three wide. And I
could still fit 80% of a fourth one side-by-side.

And guess what? That's with my default "100x50" terminal window (go to
your gnome terminal settings, you'll find that the 80x25 thing is just
an initial default that you can change), not with some 80x25 one. And
that's with a font that has anti-aliasing and isn't some pixelated
mess.

And most of my terminals actually end up being dragged wider and
taller than that. I checked, and my main one is 142x76 characters
right now, because it turns out that wider (and taller) terminals are
useful not just for source code.

Have you looked at "ps ax" output lately? Or used "top"? Or done "git
diff --stat" or any number of things where it turns out that 80x25 is
really really limiting, and is simply NO LONGER RELEVANT to most of
us.

So no. I do not care about somebody with a 80x25 terminal window
getting line wrapping.

For exactly the same reason I find it completely irrelevant if
somebody says that their kernel compile takes 10 hours because they
are doing kernel development on a Raspberry PI with 4GB of RAM.

People with restrictive hardware shouldn't make it more inconvenient
for people who have better resources. Yes, we'll accommodate things to
within reasonable limits. But no, 80-column terminals in 2020 isn't
"reasonable" any more as far as I'm concerned. People commonly used
132-column terminals even back in the 80's, for chrissake, don't try
to make 80 columns some immovable standard.

If you choose to use a 80-column terminal, you can live with the line
wrapping. It's just that simple.

And longer lines are simply useful. Part of that is that we aren't
programming in the 80's any more, and our source code is fundamentally
wider as a result.

Yes, local iteration variables are still called 'i', because more
context just isn't helpful for some anonymous counter. Being concise
is still a good thing, and overly verbose names are not inherently
better.

But still - it's entirely reasonable to have variable names that are
10-15 characters and it makes the code more legible. Writing things
out instead of using abbreviations etc.

And yes, we do use wide tabs, because that makes indentation something
you can visually see in the structure at a glance and on a
whole-function basis, rather than something you have to try to
visually "line up" things for or count spaces.

So we have lots of fairly fundamental issues that fairly easily make
for longer lines in many circumstances.

And yes, we do line breaks at some point. But there really isn't any
reason to make that point be 80 columns any more.

  Linus


RE: clean up kernel_{read,write} & friends v2

2020-05-29 Thread David Laight
From: Casey Schaufler
> Sent: 28 May 2020 22:21
> It's true, nobody uses a TTY33 anymore. Those of us who have done so
> understand how "{" is preferable to "BEGIN" and why tabs are better than
> multiple spaces. A narrow "terminal" requires less neck and mouse movement.
> Any width limit is arbitrary, so to the extent anyone might care, I advocate
> 80 forever.

A wide monitor is for looking at lots of files.
Not dead space because of deep intents and very long variable names.

Although i don't understand the 'indent continuations under "("' rule.
It hides some indents and makes other excessive.
A simple 'double indent' (or half indent) makes code more readable.

A different rule for function definitions would make real sense.
They only need a single indent - the '{' marks the end.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, 
UK
Registration No: 1397386 (Wales)


Re: clean up kernel_{read,write} & friends v2

2020-05-28 Thread Casey Schaufler
On 5/28/2020 1:17 PM, David Howells wrote:
> Linus Torvalds  wrote:
>
>> Or maybe make it check for something more reasonable, like 100 characters.
> Yes please!

No, thank you!

C is a symbolic language, not a text language. Encouraging newbies to declare

int iterator;

instead of

int i;

does the language a disservice.

It's true, nobody uses a TTY33 anymore. Those of us who have done so
understand how "{" is preferable to "BEGIN" and why tabs are better than
multiple spaces. A narrow "terminal" requires less neck and mouse movement.
Any width limit is arbitrary, so to the extent anyone might care, I advocate
80 forever.

> David
>



Re: clean up kernel_{read,write} & friends v2

2020-05-28 Thread Joe Perches
On Thu, 2020-05-28 at 12:22 -0700, Joe Perches wrote:
> On Thu, 2020-05-28 at 11:51 -0700, Linus Torvalds wrote:
> > On Wed, May 27, 2020 at 10:40 PM Christoph Hellwig  wrote:
> > > this series fixes a few issues and cleans up the helpers that read from
> > > or write to kernel space buffers, and ensures that we don't change the
> > > address limit if we are using the ->read_iter and ->write_iter methods
> > > that don't need the changed address limit.
> > 
> > Apart from the "please don't mix irrelevant whitespace changes with
> > other changes" comment, this looks fine to me.
> > 
> > And a rant related to that change: I'm really inclined to remove the
> > checkpatch check for 80 columns entirely, but it shouldn't have been
> > triggering for old lines even now.
> > 
> > Or maybe make it check for something more reasonable, like 100 characters.
> > 
> > I find it ironic and annoying how "checkpatch" warns about that silly
> > legacy limit, when checkpatch itself then on the very next few lines
> > has a line that is 124 columns wide

Another option is to only warn by default when a line in a
patch but not a file exceeds the line length maximum.
---
 scripts/checkpatch.pl | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index dd750241958b..78f5b7f97e42 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3282,8 +3282,10 @@ sub process {
 
if ($msg_type ne "" &&
(show_type("LONG_LINE") || show_type($msg_type))) {
-   WARN($msg_type,
-"line over $max_line_length characters\n" 
. $herecurr);
+   my $msg_level = \&WARN;
+   $msg_level = \&CHK if ($file);
+   &{$msg_level}($msg_type,
+ "line over $max_line_length 
characters\n" . $herecurr);
}
}
 



Re: clean up kernel_{read,write} & friends v2

2020-05-28 Thread Dave Airlie
On Fri, 29 May 2020 at 05:35, Al Viro  wrote:
>
> On Thu, May 28, 2020 at 12:22:08PM -0700, Joe Perches wrote:
>
> > Hard limits at 80 really don't work well, especially with
> > some of the 25+ character length identifiers used today.
>
> IMO any such identifier is a good reason for a warning.
>
> The litmus test is actually very simple: how unpleasant would it be
> to mention the identifiers while discussing the code over the phone?

That doesn't make sense though,

if you write the full english words out for something it'll be long
but easier to say over the phone,
if you use shortened kernel abbreviations it will be short but you'd
have to read out every letter.

To take an example:
this would read pretty well on the phone, maybe params could be parameters
amdgpu_atombios_get_leakage_vddc_based_on_leakage_params

vddc would be a stumbler.

try saying O_CREAT over the phone to someone not steeped in UNIX folklore.

Dave.


Re: clean up kernel_{read,write} & friends v2

2020-05-28 Thread Joe Perches
On Thu, 2020-05-28 at 12:44 -0700, Matthew Wilcox wrote:
> On Thu, May 28, 2020 at 08:33:40PM +0100, Al Viro wrote:
> > On Thu, May 28, 2020 at 12:22:08PM -0700, Joe Perches wrote:
> > 
> > > Hard limits at 80 really don't work well, especially with
> > > some of the 25+ character length identifiers used today.
> > 
> > IMO any such identifier is a good reason for a warning.
> > 
> > The litmus test is actually very simple: how unpleasant would it be
> > to mention the identifiers while discussing the code over the phone?
> 
> Here's a good example of a function which should be taken out and shot:
> 
> int amdgpu_atombios_get_leakage_vddc_based_on_leakage_params(struct 
> amdgpu_devic
> e *adev,

Ick.

Seems simple enough as it doesn't appear to be used...

$ git grep amdgpu_atombios_get_leakage_vddc_based_on_leakage_params
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c:int 
amdgpu_atombios_get_leakage_vddc_based_on_leakage_params(struct amdgpu_device 
*adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h:int 
amdgpu_atombios_get_leakage_vddc_based_on_leakage_params(struct amdgpu_device 
*adev,




Re: clean up kernel_{read,write} & friends v2

2020-05-28 Thread David Howells
Linus Torvalds  wrote:

> Or maybe make it check for something more reasonable, like 100 characters.

Yes please!

David



RE: clean up kernel_{read,write} & friends v2

2020-05-28 Thread Deucher, Alexander
[AMD Official Use Only - Internal Distribution Only]

> -Original Message-
> From: Al Viro  On Behalf Of Al Viro
> Sent: Thursday, May 28, 2020 4:06 PM
> To: Matthew Wilcox 
> Cc: Joe Perches ; Linus Torvalds  foundation.org>; Christoph Hellwig ; Ian Kent
> ; David Howells ; Linux
> Kernel Mailing List ; linux-fsdevel  fsde...@vger.kernel.org>; LSM List  mod...@vger.kernel.org>; NetFilter ;
> Deucher, Alexander ; David Airlie
> 
> Subject: Re: clean up kernel_{read,write} & friends v2
> 
> On Thu, May 28, 2020 at 12:44:41PM -0700, Matthew Wilcox wrote:
> > On Thu, May 28, 2020 at 08:33:40PM +0100, Al Viro wrote:
> > > On Thu, May 28, 2020 at 12:22:08PM -0700, Joe Perches wrote:
> > >
> > > > Hard limits at 80 really don't work well, especially with some of
> > > > the 25+ character length identifiers used today.
> > >
> > > IMO any such identifier is a good reason for a warning.
> > >
> > > The litmus test is actually very simple: how unpleasant would it be
> > > to mention the identifiers while discussing the code over the phone?
> >
> > Here's a good example of a function which should be taken out and shot:
> >
> > int
> amdgpu_atombios_get_leakage_vddc_based_on_leakage_params(struct
> > amdgpu_devic e *adev, ...
> > switch (frev) {
> > case 2:
> > switch (crev) {
> > ...
> > if (profile->ucElbVDDC_Num > 0) {
> > for (i = 0; i < profile->ucElbVDDC_Num; 
> > i++) {
> > if (vddc_id_buf[i] == 
> > virtual_voltage_id) {
> > for (j = 0; j < 
> > profile->ucLeakageBinNum; j++) {
> > if 
> > (vbios_voltage_id <= leakage_bin[j]) {
> > *vddc
> > = vddc_buf[j * profile->ucElbVDDC_Num + i];
> >
> > I mean, I get it that AMD want to show off just how studly a monitor
> > they support, but good grief ...
> 
> I must respectfully disagree.  It clearly needs to be hanged, drawn and
> quartered...

You found it necessary to add me to a random thread with no context to complain 
about the coding style?  How about sending a patch to clean it up if you find 
it that unsavory.

Alex


Re: clean up kernel_{read,write} & friends v2

2020-05-28 Thread Al Viro
On Thu, May 28, 2020 at 12:44:41PM -0700, Matthew Wilcox wrote:
> On Thu, May 28, 2020 at 08:33:40PM +0100, Al Viro wrote:
> > On Thu, May 28, 2020 at 12:22:08PM -0700, Joe Perches wrote:
> > 
> > > Hard limits at 80 really don't work well, especially with
> > > some of the 25+ character length identifiers used today.
> > 
> > IMO any such identifier is a good reason for a warning.
> > 
> > The litmus test is actually very simple: how unpleasant would it be
> > to mention the identifiers while discussing the code over the phone?
> 
> Here's a good example of a function which should be taken out and shot:
> 
> int amdgpu_atombios_get_leakage_vddc_based_on_leakage_params(struct 
> amdgpu_devic
> e *adev,
> ...
> switch (frev) {
> case 2:
> switch (crev) {
> ...
> if (profile->ucElbVDDC_Num > 0) {
> for (i = 0; i < profile->ucElbVDDC_Num; i++) {
> if (vddc_id_buf[i] == 
> virtual_voltage_id) {
> for (j = 0; j < 
> profile->ucLeakageBinNum; j++) {
> if (vbios_voltage_id 
> <= leakage_bin[j]) {
> *vddc = 
> vddc_buf[j * profile->ucElbVDDC_Num + i];
> 
> I mean, I get it that AMD want to show off just how studly a monitor they
> support, but good grief ...

I must respectfully disagree.  It clearly needs to be hanged, drawn and
quartered...


Re: clean up kernel_{read,write} & friends v2

2020-05-28 Thread Matthew Wilcox
On Thu, May 28, 2020 at 08:33:40PM +0100, Al Viro wrote:
> On Thu, May 28, 2020 at 12:22:08PM -0700, Joe Perches wrote:
> 
> > Hard limits at 80 really don't work well, especially with
> > some of the 25+ character length identifiers used today.
> 
> IMO any such identifier is a good reason for a warning.
> 
> The litmus test is actually very simple: how unpleasant would it be
> to mention the identifiers while discussing the code over the phone?

Here's a good example of a function which should be taken out and shot:

int amdgpu_atombios_get_leakage_vddc_based_on_leakage_params(struct amdgpu_devic
e *adev,
...
switch (frev) {
case 2:
switch (crev) {
...
if (profile->ucElbVDDC_Num > 0) {
for (i = 0; i < profile->ucElbVDDC_Num; i++) {
if (vddc_id_buf[i] == 
virtual_voltage_id) {
for (j = 0; j < 
profile->ucLeakageBinNum; j++) {
if (vbios_voltage_id <= 
leakage_bin[j]) {
*vddc = 
vddc_buf[j * profile->ucElbVDDC_Num + i];

I mean, I get it that AMD want to show off just how studly a monitor they
support, but good grief ...


Re: clean up kernel_{read,write} & friends v2

2020-05-28 Thread Al Viro
On Thu, May 28, 2020 at 12:22:08PM -0700, Joe Perches wrote:

> Hard limits at 80 really don't work well, especially with
> some of the 25+ character length identifiers used today.

IMO any such identifier is a good reason for a warning.

The litmus test is actually very simple: how unpleasant would it be
to mention the identifiers while discussing the code over the phone?


Re: clean up kernel_{read,write} & friends v2

2020-05-28 Thread Joe Perches
On Thu, 2020-05-28 at 11:51 -0700, Linus Torvalds wrote:
> On Wed, May 27, 2020 at 10:40 PM Christoph Hellwig  wrote:
> > this series fixes a few issues and cleans up the helpers that read from
> > or write to kernel space buffers, and ensures that we don't change the
> > address limit if we are using the ->read_iter and ->write_iter methods
> > that don't need the changed address limit.
> 
> Apart from the "please don't mix irrelevant whitespace changes with
> other changes" comment, this looks fine to me.
> 
> And a rant related to that change: I'm really inclined to remove the
> checkpatch check for 80 columns entirely, but it shouldn't have been
> triggering for old lines even now.
> 
> Or maybe make it check for something more reasonable, like 100 characters.
> 
> I find it ironic and annoying how "checkpatch" warns about that silly
> legacy limit, when checkpatch itself then on the very next few lines
> has a line that is 124 columns wide

Yeah.  perl ain't c.

And this discussion has been had many times.

Here's one from 2009
https://lkml.org/lkml/2009/12/15/490

Another from 2012
https://lkml.org/lkml/2012/2/5/141

Line lengths checks are normally pretty silly.

Hard limits at 80 really don't work well, especially with
some of the 25+ character length identifiers used today.

I think a line length warning at 132 is generally reasonable
but it could depend on complexity and identifier lengths.

> And yes, that 124 character line has a good reason for it. But that's
> kind of the point. There are lots of perfectly fine reasons for longer
> lines.
> 
> I'd much rather check for "no deep indentation" or "no unnecessarily
> complex conditionals" or other issues that are more likely to be
> _real_ problems.

That deep indentation test already exists at 6 tabs.
Maybe it should be 5 instead.  Or maybe even 4, but
that's a pretty easy to need and common use case.

Tab depth use in the kernel is more or less

$ git grep -Poh '^\t+(if|do|while|for|switch)\b' | \
  sed -r 's/\w+//g' | \
  awk '{print length($0);}' | \
  sort | uniq -c | sort -rn
 903993 1
 339059 2
  89334 3
  18216 4
   3282 5
605 6
148 7
 36 8
  4 9
  1 10

> But do we really have 80x25 terminals any more that
> we'd care about?

trivial btw: VT100s were 80x24 or 132x24, PCs were 80x25




Re: clean up kernel_{read,write} & friends v2

2020-05-28 Thread Sedat Dilek
On Thu, May 28, 2020 at 8:53 PM Linus Torvalds
 wrote:
>
> On Wed, May 27, 2020 at 10:40 PM Christoph Hellwig  wrote:
> >
> > this series fixes a few issues and cleans up the helpers that read from
> > or write to kernel space buffers, and ensures that we don't change the
> > address limit if we are using the ->read_iter and ->write_iter methods
> > that don't need the changed address limit.
>
> Apart from the "please don't mix irrelevant whitespace changes with
> other changes" comment, this looks fine to me.
>
> And a rant related to that change: I'm really inclined to remove the
> checkpatch check for 80 columns entirely, but it shouldn't have been
> triggering for old lines even now.
>
> Or maybe make it check for something more reasonable, like 100 characters.
>
> I find it ironic and annoying how "checkpatch" warns about that silly
> legacy limit, when checkpatch itself then on the very next few lines
> has a line that is 124 columns wide
>
> And yes, that 124 character line has a good reason for it. But that's
> kind of the point. There are lots of perfectly fine reasons for longer
> lines.
>
> I'd much rather check for "no deep indentation" or "no unnecessarily
> complex conditionals" or other issues that are more likely to be
> _real_ problems.  But do we really have 80x25 terminals any more that
> we'd care about?
>

Please kill that 80-columns-checkpatch-rule for more human-readability of code.

- Sedat -


Re: clean up kernel_{read,write} & friends v2

2020-05-28 Thread Linus Torvalds
On Wed, May 27, 2020 at 10:40 PM Christoph Hellwig  wrote:
>
> this series fixes a few issues and cleans up the helpers that read from
> or write to kernel space buffers, and ensures that we don't change the
> address limit if we are using the ->read_iter and ->write_iter methods
> that don't need the changed address limit.

Apart from the "please don't mix irrelevant whitespace changes with
other changes" comment, this looks fine to me.

And a rant related to that change: I'm really inclined to remove the
checkpatch check for 80 columns entirely, but it shouldn't have been
triggering for old lines even now.

Or maybe make it check for something more reasonable, like 100 characters.

I find it ironic and annoying how "checkpatch" warns about that silly
legacy limit, when checkpatch itself then on the very next few lines
has a line that is 124 columns wide

And yes, that 124 character line has a good reason for it. But that's
kind of the point. There are lots of perfectly fine reasons for longer
lines.

I'd much rather check for "no deep indentation" or "no unnecessarily
complex conditionals" or other issues that are more likely to be
_real_ problems.  But do we really have 80x25 terminals any more that
we'd care about?

   Linus


clean up kernel_{read,write} & friends v2

2020-05-27 Thread Christoph Hellwig
Hi Al,

this series fixes a few issues and cleans up the helpers that read from
or write to kernel space buffers, and ensures that we don't change the
address limit if we are using the ->read_iter and ->write_iter methods
that don't need the changed address limit.

Changes since v2:
 - picked up a few ACKs

Changes since v1:
 - __kernel_write must not take sb_writers
 - unexport __kernel_write


Re: clean up kernel_{read,write} & friends v2

2020-05-20 Thread Christoph Hellwig
ping?

On Wed, May 13, 2020 at 08:56:42AM +0200, Christoph Hellwig wrote:
> Hi Al,
> 
> this series fixes a few issues and cleans up the helpers that read from
> or write to kernel space buffers, and ensures that we don't change the
> address limit if we are using the ->read_iter and ->write_iter methods
> that don't need the changed address limit.
> 
> Changes since v1:
>  - __kernel_write must not take sb_writers
>  - unexported __kernel_write
---end quoted text---


clean up kernel_{read,write} & friends v2

2020-05-12 Thread Christoph Hellwig
Hi Al,

this series fixes a few issues and cleans up the helpers that read from
or write to kernel space buffers, and ensures that we don't change the
address limit if we are using the ->read_iter and ->write_iter methods
that don't need the changed address limit.

Changes since v1:
 - __kernel_write must not take sb_writers
 - unexported __kernel_write