staging: bcm2835-audio: bcm2835.h: fix block comment warning
Subsystems (3)
PATCH 1/5 staging: bcm2835-audio: bcm2835.h: fix block comment warning
Fix checkpatch.pl warning: "Block comments use * on subsequent lines."
--- drivers/staging/bcm2835-audio/bcm2835.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/bcm2835-audio/bcm2835.h +2 -2
@@ -27,8 +27,8 @@#include <linux/workqueue.h> /* -#define AUDIO_DEBUG_ENABLE -#define AUDIO_VERBOSE_DEBUG_ENABLE +* #define AUDIO_DEBUG_ENABLE +* #define AUDIO_VERBOSE_DEBUG_ENABLE */ /* Debug macros */
Signature · 1 line
2.7.4
PATCH 2/5 staging: bcm2835-audio: bcm2835.h: fix printk coding style issue
Fix checkpatch.pl warning of the form "WARNING: Prefer subsystem eg: netdev]_info([subsystem]dev, ...
then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ..."
--- drivers/staging/bcm2835-audio/bcm2835.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/bcm2835-audio/bcm2835.h +5 -5
@@ -37,10 +37,10 @@#ifdef AUDIO_VERBOSE_DEBUG_ENABLE #define audio_debug(fmt, arg...) \ - printk(KERN_INFO"%s:%d " fmt, __func__, __LINE__, ##arg) + pr_info("%s:%d " fmt, __func__, __LINE__, ##arg) #define audio_info(fmt, arg...) \ - printk(KERN_INFO"%s:%d " fmt, __func__, __LINE__, ##arg) + pr_info("%s:%d " fmt, __func__, __LINE__, ##arg)#else
@@ -59,13 +59,13 @@#endif /* AUDIO_DEBUG_ENABLE */ #define audio_error(fmt, arg...) \ - printk(KERN_ERR"%s:%d " fmt, __func__, __LINE__, ##arg) + pr_err("%s:%d " fmt, __func__, __LINE__, ##arg) #define audio_warning(fmt, arg...) \ - printk(KERN_WARNING"%s:%d " fmt, __func__, __LINE__, ##arg) + pr_warn("%s:%d " fmt, __func__, __LINE__, ##arg) #define audio_alert(fmt, arg...) \ - printk(KERN_ALERT"%s:%d " fmt, __func__, __LINE__, ##arg) + pr_alert("%s:%d " fmt, __func__, __LINE__, ##arg)#define MAX_SUBSTREAMS (8)#define AVAIL_SUBSTREAMS_MASK (0xff)
Signature · 1 line
2.7.4
PATCH 3/5 staging: bcm2835-audio: bcm2835.h: fix macro coding style issue
In reply to Nathan HowardFix checkpatch.pl warning of the form "CHECK: Macro argument 'vol' may be better as '(vol)' to avoid precedence issues."
--- drivers/staging/bcm2835-audio/bcm2835.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/staging/bcm2835-audio/bcm2835.h +5 -2
@@ -77,8 +77,11 @@ enum {/* macros for alsa2chip and chip2alsa, instead of functions */ -#define alsa2chip (vol) (uint)(-((vol << 8) / 100))/* convert alsa to chip volume (defined as macro rather than function call) */ -#define chip2alsa (vol) -((vol * 100) >> 8)/* convert chip to alsa volume */ +// convert alsa to chip volume (defined as macro rather than function call) +#define alsa2chip (vol) (uint)(-(((vol) << 8) / 100)) + +// convert chip to alsa volume +#define chip2alsa (vol) -(((vol) * 100) >> 8)/* Some constants for values .. */ enum snd_bcm2835_route {
Signature · 1 line
2.7.4
PATCH 4/5 staging: bcm2835-audio: bcm2835.h: fix volatile coding style issue
In reply to Nathan HowardFix checkpatch.pl warning of the form "WARNING: Use of volatile is usually wrong: see Documentation/process/volatile-considered-harmful.rst."
--- drivers/staging/bcm2835-audio/bcm2835.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/bcm2835-audio/bcm2835.h +2 -2
@@ -125,8 +125,8 @@ struct bcm2835_alsa_stream {struct semaphore buffers_update_sem;struct semaphore control_sem;spinlock_t lock; -volatile unsigned int control; -volatile unsigned int status; +unsigned int control; +unsigned int status;int open;int running;
Signature · 1 line
2.7.4
PATCH 5/5 staging: bcm2835-audio: bcm2835.h: fix line length coding style issue
In reply to Nathan HowardFix checkpatch.pl warning of the form "WARNING: line over 80 characters."
--- drivers/staging/bcm2835-audio/bcm2835.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/bcm2835-audio/bcm2835.h +4 -2
@@ -163,8 +163,10 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream,unsigned int count, void *src);void bcm2835_playback_fifo (struct bcm2835_alsa_stream *alsa_stream); -unsigned int bcm2835_audio_retrieve_buffers (struct bcm2835_alsa_stream *alsa_stream); +unsigned int bcm2835_audio_retrieve_buffers ( +struct bcm2835_alsa_stream *alsa_stream);void bcm2835_audio_flush_buffers (struct bcm2835_alsa_stream *alsa_stream); -void bcm2835_audio_flush_playback_buffers (struct bcm2835_alsa_stream *alsa_stream); +void bcm2835_audio_flush_playback_buffers ( +struct bcm2835_alsa_stream *alsa_stream);#endif /* __SOUND_ARM_BCM2835_H */
Signature · 1 line
2.7.4
Re: [PATCH 4/5] staging: bcm2835-audio: bcm2835.h: fix volatile coding style issue
In reply to Nathan HowardQuoted 2 lines · Nathan Howard
Fix checkpatch.pl warning of the form "WARNING: Use of volatile is usually wrong: see
Documentation/process/volatile-considered-harmful.rst."
Why are you sure the volatile use is not necessary?
Quoted 20 lines
Signed-off-by Nathan Howard <[email protected]>--- drivers/staging/bcm2835-audio/bcm2835.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/bcm2835-audio/bcm2835.h +2
-2@@ -125,8 +125,8 @@ struct bcm2835_alsa_stream {struct semaphore buffers_update_sem;struct semaphore control_sem;spinlock_t lock; -volatile unsigned int control; -volatile unsigned int status; +unsigned int control; +unsigned int status;int open;int running;
Re: [PATCH 4/5] staging: bcm2835-audio: bcm2835.h: fix volatile coding style issue
Thank you, Joe.
Please remove this patch at this time; it was sent in error.
Quoted 26 lines · Joe Perches
Quoted 2 lines · Nathan Howard
Fix checkpatch.pl warning of the form "WARNING: Use of volatile is usually wrong: see
Documentation/process/volatile-considered-harmful.rst."Why are you sure the volatile use is not necessary?
Quoted 20 lines
Signed-off-by Nathan Howard <[email protected]>--- drivers/staging/bcm2835-audio/bcm2835.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/bcm2835-audio/bcm2835.h +2
-2@@ -125,8 +125,8 @@ struct bcm2835_alsa_stream {struct semaphore buffers_update_sem;struct semaphore control_sem;spinlock_t lock; -volatile unsigned int control; -volatile unsigned int status; +unsigned int control; +unsigned int status;int open;int running;
Re: [PATCH 5/5] staging: bcm2835-audio: bcm2835.h: fix line length coding style issue
In reply to Nathan HowardQuoted 1 line · Nathan Howard
Fix checkpatch.pl warning of the form "WARNING: line over 80 characters."
[]
drivers/staging/bcm2835-audio/bcm2835.h
Quoted 1 line
drivers/staging/bcm2835-audio/bcm2835.h +0
-0
[]
drivers/staging/bcm2835-audio/bcm2835.h int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream, · line 167
Quoted 7 lines
drivers/staging/bcm2835-audio/bcm2835.h +2
-1@@ -163,8 +163,10 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream,unsigned int count, void *src);void bcm2835_playback_fifo (struct bcm2835_alsa_stream *alsa_stream); -unsigned int bcm2835_audio_retrieve_buffers (struct bcm2835_alsa_stream *alsa_stream); +unsigned int bcm2835_audio_retrieve_buffers ( +struct bcm2835_alsa_stream *alsa_stream);
This is not a good change.
This line exceeds 80 columns only because it uses very long identifiers (30+ chars).
Anything that uses these very long names is going to be silly looking when forced to use 80 column line length maximums.
Basically, it's OK as it is and if you really want to change it for any reason the other style to use is to have the return value on a separate line like:
unsigned intbcm2836_audio_retrieve_buffers(struct bcm2835_also_stream *alsa_stream);
Even so, that's not a good change either.
Re: [PATCH 5/5] staging: bcm2835-audio: bcm2835.h: fix line length coding style issue
Thanks, Joe.
Is this to say that scripts/checkpatch.pl should be updated to some higher column limit? I have made these cleanup changes before in a like manner.
Quoted 31 lines · Joe Perches
Quoted 1 line · Nathan Howard
Fix checkpatch.pl warning of the form "WARNING: line over 80 characters."
[]
drivers/staging/bcm2835-audio/bcm2835.h
Quoted 1 line
drivers/staging/bcm2835-audio/bcm2835.h +0
-0[]
drivers/staging/bcm2835-audio/bcm2835.h int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream, · line 167
Quoted 7 lines
drivers/staging/bcm2835-audio/bcm2835.h +2
-1@@ -163,8 +163,10 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream,unsigned int count, void *src);void bcm2835_playback_fifo (struct bcm2835_alsa_stream *alsa_stream); -unsigned int bcm2835_audio_retrieve_buffers (struct bcm2835_alsa_stream *alsa_stream); +unsigned int bcm2835_audio_retrieve_buffers ( +struct bcm2835_alsa_stream *alsa_stream);This is not a good change.
This line exceeds 80 columns only because it uses very long identifiers (30+ chars).
Anything that uses these very long names is going to be silly looking when forced to use 80 column line length maximums.
Basically, it's OK as it is and if you really want to change it for any reason the other style to use is to have the return value on a separate line like:
unsigned int
bcm2836_audio_retrieve_buffers(struct bcm2835_also_stream *alsa_stream);Even so, that's not a good change either.
Re: [PATCH 5/5] staging: bcm2835-audio: bcm2835.h: fix line length coding style issue
Quoted 5 lines · Adan Hawthorn
Thanks, Joe.
Is this to say that
scripts/checkpatch.plshould be updated to some higher column limit? I have made these cleanup changes before in a like manner.
Hard to say.
There could be some sensitivity to long identifier name lengths added to checkpatch, but < 80 column line length is still currently "strongly preferred".
I don't care much one way or another if it's 80 or 100 or something else as long as it's context appropriate.
Awhile ago, Linus Torvalds wrote:
Quoted 33 lines · Linus Torvalds
Quoted 6 lines · Joe Perches
Quoted 2 lines
In fact, I thought we already upped the check-patch limit to 100?
Nope, CodingStyle neither.
Last time I tried was awhile ago.
Ok, it must have been just talked about, and with the exceptions for strings etc I may not have seen as many of the really annoying line breaks lately.
I don't mind a 80-column "soft limit" per se: if some code consistently goes over 80 columns, there really is something seriously wrong there. So 80 columns may well be the right limit for that kind of check (or even less).
But if we have just a couple of lines that are longer (in a file that is 3k+ lines), I'd rather not break those.
I tend use "git grep" a lot, and it's much easier to see function argument use if it's all on one line.
Of course, some function calls really are *so* long that they have to be broken up, but that's where the "if it's a couple of lines that go a bit over the 80 column limit..." exception basically comes in.
Put another way: long lines definitely aren't good. But breaking long lines has some downsides too, so there should be a balance between the two, rather than some black-and-white limit.
In fact, we've seldom had cases where black-and-white limits work well.
Re: [PATCH 5/5] staging: bcm2835-audio: bcm2835.h: fix line length coding style issue
Ok, I personally like that better anyhow. Also, there was mention of the line limit even exceeding 100 characters (130ish?) and that was being tossed around at one point (if I remember correctly).
Quoted 53 lines · Joe Perches
Quoted 5 lines · Adan Hawthorn
Thanks, Joe.
Is this to say that
scripts/checkpatch.plshould be updated to some higher column limit? I have made these cleanup changes before in a like manner.Hard to say.
There could be some sensitivity to long identifier name lengths added to checkpatch, but < 80 column line length is still currently "strongly preferred".
I don't care much one way or another if it's 80 or 100 or something else as long as it's context appropriate.
Awhile ago, Linus Torvalds wrote:
Quoted 33 lines · Linus Torvalds
Quoted 6 lines · Joe Perches
Quoted 2 lines
In fact, I thought we already upped the check-patch limit to 100?
Nope, CodingStyle neither.
Last time I tried was awhile ago.
Ok, it must have been just talked about, and with the exceptions for strings etc I may not have seen as many of the really annoying line breaks lately.
I don't mind a 80-column "soft limit" per se: if some code consistently goes over 80 columns, there really is something seriously wrong there. So 80 columns may well be the right limit for that kind of check (or even less).
But if we have just a couple of lines that are longer (in a file that is 3k+ lines), I'd rather not break those.
I tend use "git grep" a lot, and it's much easier to see function argument use if it's all on one line.
Of course, some function calls really are *so* long that they have to be broken up, but that's where the "if it's a couple of lines that go a bit over the 80 column limit..." exception basically comes in.
Put another way: long lines definitely aren't good. But breaking long lines has some downsides too, so there should be a balance between the two, rather than some black-and-white limit.
In fact, we've seldom had cases where black-and-white limits work well.