* [PATCH] staging: bcm2835-audio: bcm2835.h: fix various coding style issues
@ 2017-02-16 23:12 Nathan Howard
2017-02-17 0:57 ` Greg Kroah-Hartman
0 siblings, 1 reply; 5+ messages in thread
From: Nathan Howard @ 2017-02-16 23:12 UTC (permalink / raw)
To: linux-arm-kernel
Fix various coding style issues as per checkpatch.pl.
Signed-off-by: Nathan Howard <adanhawthorn@gmail.com>
---
drivers/staging/bcm2835-audio/bcm2835.h | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/bcm2835-audio/bcm2835.h b/drivers/staging/bcm2835-audio/bcm2835.h
index 36e3ef8..16d7006 100644
--- a/drivers/staging/bcm2835-audio/bcm2835.h
+++ b/drivers/staging/bcm2835-audio/bcm2835.h
@@ -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 */
@@ -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)
@@ -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 {
@@ -122,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;
@@ -160,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 */
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH] staging: bcm2835-audio: bcm2835.h: fix various coding style issues
@ 2017-02-17 18:39 Nathan Howard
2017-02-17 18:43 ` Greg Kroah-Hartman
2017-02-17 19:52 ` Joe Perches
0 siblings, 2 replies; 5+ messages in thread
From: Nathan Howard @ 2017-02-17 18:39 UTC (permalink / raw)
To: linux-arm-kernel
The following coding style issues (as per checkpatch.pl) were resolved.
WARNING: Block comments use * on subsequent lines
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ...
WARNING: Missing a blank line after declarations
WARNING: Use of volatile is usually wrong:...
WARNING: line over 80 characters
CHECK: Concatenated strings should use spaces between elements
CHECK: Macro argument 'vol' may be better as '(vol)' to avoid precedence issues
Signed-off-by: Nathan Howard <adanhawthorn@gmail.com>
---
drivers/staging/bcm2835-audio/bcm2835.h | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/bcm2835-audio/bcm2835.h b/drivers/staging/bcm2835-audio/bcm2835.h
index 36e3ef8..16d7006 100644
--- a/drivers/staging/bcm2835-audio/bcm2835.h
+++ b/drivers/staging/bcm2835-audio/bcm2835.h
@@ -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 */
@@ -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)
@@ -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 {
@@ -122,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;
@@ -160,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 */
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH] staging: bcm2835-audio: bcm2835.h: fix various coding style issues
2017-02-17 18:39 Nathan Howard
@ 2017-02-17 18:43 ` Greg Kroah-Hartman
2017-02-17 19:52 ` Joe Perches
1 sibling, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2017-02-17 18:43 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Feb 17, 2017 at 01:39:07PM -0500, Nathan Howard wrote:
> The following coding style issues (as per checkpatch.pl) were resolved.
>
> WARNING: Block comments use * on subsequent lines
> WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ...
> WARNING: Missing a blank line after declarations
> WARNING: Use of volatile is usually wrong:...
> WARNING: line over 80 characters
> CHECK: Concatenated strings should use spaces between elements
> CHECK: Macro argument 'vol' may be better as '(vol)' to avoid precedence issues
Please only do one thing per patch, and no, "fix style issues" is not
one thing :(
This should be a patch series, one per type of thing done.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] staging: bcm2835-audio: bcm2835.h: fix various coding style issues
2017-02-17 18:39 Nathan Howard
2017-02-17 18:43 ` Greg Kroah-Hartman
@ 2017-02-17 19:52 ` Joe Perches
1 sibling, 0 replies; 5+ messages in thread
From: Joe Perches @ 2017-02-17 19:52 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, 2017-02-17 at 13:39 -0500, Nathan Howard wrote:
> The following coding style issues (as per checkpatch.pl) were resolved.
What Greg said is true, and the volatile conversion
especially needs to be verified.
> diff --git a/drivers/staging/bcm2835-audio/bcm2835.h b/drivers/staging/bcm2835-audio/bcm2835.h
[]
> @@ -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
> */
Using #define DEBUG would be more common.
> /* Debug macros */
> @@ -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)
These might as well be removed and converted to
the direct pr_<level> equivalents and have
#define pr_fmt(fmt) "%s:%d: " fmt, __func__, __LINE__
added before any include, but honestly the
__func__ and __LINE__ aren't particularly useful.
> @@ -122,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;
Unless you can absolutely verify that that
doesn't change hardware access, you should
leave this alone.
'
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-02-17 19:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-16 23:12 [PATCH] staging: bcm2835-audio: bcm2835.h: fix various coding style issues Nathan Howard
2017-02-17 0:57 ` Greg Kroah-Hartman
-- strict thread matches above, loose matches on Subject: below --
2017-02-17 18:39 Nathan Howard
2017-02-17 18:43 ` Greg Kroah-Hartman
2017-02-17 19:52 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox