aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Farrugia <mark.farrugia@fiberdyne.com.au>2018-09-05 16:38:25 +1000
committerMark Farrugia <mark.farrugia@fiberdyne.com.au>2018-10-26 17:27:32 +1100
commit93db730a4d435e835d144e3393088968e1645c87 (patch)
tree79ced019a01a3602a0d5425477e42348d2b2cd5c
parent91c57bc05904d2f87af864ad9d5f686428ce827f (diff)
Fix warnings generated by checkpatch.pl
Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
-rw-r--r--alsa-pcm.c37
-rwxr-xr-xalsa.c13
-rwxr-xr-xalsa.h41
-rw-r--r--core.c13
-rw-r--r--core.h10
5 files changed, 57 insertions, 57 deletions
diff --git a/alsa-pcm.c b/alsa-pcm.c
index 17255df..9e3471b 100644
--- a/alsa-pcm.c
+++ b/alsa-pcm.c
@@ -17,7 +17,7 @@
ap = avirt_get_current_audiopath(); \
CHK_NULL_V(ap, "Cannot find Audio Path!"); \
if (ap->pcm_ops->callback) { \
- return ap->pcm_ops->callback(substream, \
+ return ap->pcm_ops->callback((substream), \
##__VA_ARGS__); \
} \
} while (0)
@@ -33,7 +33,7 @@ static int configure_pcm(struct snd_pcm_substream *substream)
struct avirt_audiopath *audiopath;
struct avirt_alsa_group *group;
struct snd_pcm_hardware *hw;
- unsigned bytes_per_sample = 0, blocksize = 0;
+ unsigned int bytes_per_sample = 0, blocksize = 0;
audiopath = avirt_get_current_audiopath();
CHK_NULL_V(audiopath, "Cannot find Audio Path!");
@@ -45,9 +45,9 @@ static int configure_pcm(struct snd_pcm_substream *substream)
memcpy(hw, audiopath->hw, sizeof(struct snd_pcm_hardware));
pr_info("%s %d %d", __func__, blocksize, hw->periods_max);
- if (hw->formats == SNDRV_PCM_FMTBIT_S16_LE)
+ if (hw->formats == SNDRV_PCM_FMTBIT_S16_LE) {
bytes_per_sample = 2;
- else {
+ } else {
pr_err("[%s] PCM only supports SNDRV_PCM_FMTBIT_S16_LE",
__func__);
return -EINVAL;
@@ -187,11 +187,11 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)
/**
* pcm_prepare - Implements 'prepare' callback for PCM middle layer
* @substream: pointer to ALSA PCM substream
- *
+ *
* The format rate, sample rate, etc., can be set here. This callback can be
* called many times at each setup. This function is also used to handle overrun
* and underrun conditions when we try and resync the DMA (if we're using DMA).
- *
+ *
* Returns 0 on success or error code otherwise.
*/
static int pcm_prepare(struct snd_pcm_substream *substream)
@@ -206,10 +206,10 @@ static int pcm_prepare(struct snd_pcm_substream *substream)
* pcm_trigger - Implements 'trigger' callback for PCM middle layer
* @substream: pointer to ALSA PCM substream
* @cmd: action to be performed (start or stop)
- *
+ *
* This is called when the PCM is started, stopped or paused. The action
* indicated action is specified in the second argument, SNDRV_PCM_TRIGGER_XXX
- *
+ *
* Returns 0 on success or error code otherwise.
*/
static int pcm_trigger(struct snd_pcm_substream *substream, int cmd)
@@ -234,11 +234,11 @@ static int pcm_trigger(struct snd_pcm_substream *substream, int cmd)
/**
* pcm_pointer - Implements 'pointer' callback for PCM middle layer
* @substream: pointer to ALSA PCM substream
- *
+ *
* This gets called when the user space needs a DMA buffer index. IO errors will
* be generated if the index does not increment, or drives beyond the frame
* threshold of the buffer itself.
- *
+ *
* Returns the current hardware buffer frame index.
*/
static snd_pcm_uframes_t pcm_pointer(struct snd_pcm_substream *substream)
@@ -256,9 +256,9 @@ static snd_pcm_uframes_t pcm_pointer(struct snd_pcm_substream *substream)
* @audio_ts
* @audio_tstamp_config
* @audio_tstamp_report
- *
+ *
* Generic way to get system timestamp and audio timestamp info
- *
+ *
* Returns 0 on success or error code otherwise
*/
static int pcm_get_time_info(
@@ -285,9 +285,9 @@ static int pcm_get_time_info(
* @pos: The offset in the DMA
* @src: Audio PCM data from the user space
* @count:
- *
+ *
* This is where we need to copy user audio PCM data into the sound driver
- *
+ *
* Returns 0 on success or error code otherwise.
*
*/
@@ -315,9 +315,9 @@ static int pcm_copy_user(struct snd_pcm_substream *substream, int channel,
* @pos: The offset in the DMA
* @src: Audio PCM data from the user space
* @count:
- *
+ *
* This is where we need to copy kernel audio PCM data into the sound driver
- *
+ *
* Returns 0 on success or error code otherwise.
*
*/
@@ -332,9 +332,9 @@ static int pcm_copy_kernel(struct snd_pcm_substream *substream, int channel,
/**
* pcm_ack - Implements 'ack' callback for PCM middle layer
* @substream: pointer to ALSA PCM substream
- *
+ *
* This is where we need to ack
- *
+ *
* Returns 0 on success or error code otherwise.
*
*/
@@ -368,5 +368,4 @@ struct snd_pcm_ops pcm_ops = {
.copy_kernel = pcm_copy_kernel,
.page = snd_pcm_lib_get_vmalloc_page,
.ack = pcm_ack,
-
};
diff --git a/alsa.c b/alsa.c
index dd00ddb..a8609b4 100755
--- a/alsa.c
+++ b/alsa.c
@@ -13,10 +13,7 @@
#include "alsa.h"
-extern struct avirt_coreinfo coreinfo;
-
-static struct snd_card *card = NULL;
-extern struct snd_pcm_ops pcm_ops;
+static struct snd_card *card;
/**
* pcm_constructor - Constructs the ALSA PCM middle devices for this driver
@@ -63,12 +60,12 @@ static int pcm_constructor(struct snd_card *card)
*/
static int alloc_dev_config(struct avirt_alsa_devconfig **devconfig,
struct avirt_alsa_devconfig *userconfig,
- unsigned numdevices)
+ unsigned int numdevices)
{
if (numdevices == 0)
return 0;
- *devconfig = kzalloc(sizeof(struct avirt_alsa_devconfig) * numdevices,
+ *devconfig = kzalloc(sizeof(*devconfig) * numdevices,
GFP_KERNEL);
if (!(*devconfig))
return -ENOMEM;
@@ -101,7 +98,7 @@ struct avirt_alsa_group *avirt_alsa_get_group(int direction)
* @return: 0 on success or error code otherwise
*/
int avirt_alsa_configure_pcm(struct avirt_alsa_devconfig *config, int direction,
- unsigned numdevices)
+ unsigned int numdevices)
{
struct avirt_alsa_group *group;
@@ -167,7 +164,7 @@ int avirt_alsa_deregister(void)
* pcm_buff_complete_cb - PCM buffer complete callback
* @substreamid: pointer to ALSA PCM substream
* @return 0 on success or error code otherwise
- *
+ *
* This should be called from a child Audio Path once it has finished processing
* the pcm buffer
*/
diff --git a/alsa.h b/alsa.h
index 815dd65..12148b9 100755
--- a/alsa.h
+++ b/alsa.h
@@ -18,34 +18,37 @@
#define PRINT_ERR(errno, errmsg, ...) \
pr_err("[%s()] %s [ERRNO:%d]", __func__, errmsg, ##__VA_ARGS__, errno);
-#define CHK_ERR(errno) \
- do { \
- if (errno < 0) \
- return errno; \
+#define CHK_ERR(errno) \
+ do { \
+ if ((errno) < 0) \
+ return (errno); \
} while (0)
-#define CHK_ERR_V(errno, errmsg, ...) \
- do { \
- if (errno < 0) { \
- PRINT_ERR(errno, errmsg, ##__VA_ARGS__) \
- return errno; \
- } \
+#define CHK_ERR_V(errno, errmsg, ...) \
+ do { \
+ if ((errno) < 0) { \
+ PRINT_ERR((errno), (errmsg), ##__VA_ARGS__) \
+ return (errno); \
+ } \
} while (0)
#define CHK_NULL(x) \
do { \
- if (!x) \
+ if (!(x)) \
return -EFAULT; \
} while (0)
-#define CHK_NULL_V(x, errmsg, ...) \
- do { \
- if (!x) { \
- PRINT_ERR(EFAULT, errmsg, ##__VA_ARGS__) \
- return -EFAULT; \
- } \
+#define CHK_NULL_V(x, errmsg, ...) \
+ do { \
+ if (!(x)) { \
+ PRINT_ERR(EFAULT, (errmsg), ##__VA_ARGS__) \
+ return -EFAULT; \
+ } \
} while (0)
+extern struct avirt_coreinfo coreinfo;
+extern struct snd_pcm_ops pcm_ops;
+
/**
* avirt_alsa_configure_pcm- Configure the PCM device
* @config: Device configuration structure array
@@ -54,7 +57,7 @@
* @return: 0 on success or error code otherwise
*/
int avirt_alsa_configure_pcm(struct avirt_alsa_devconfig *config, int direction,
- unsigned numdevices);
+ unsigned int numdevices);
/**
* avirt_alsa_register - Registers the ALSA driver
@@ -82,7 +85,7 @@ struct avirt_alsa_group *avirt_alsa_get_group(int direction);
* pcm_buff_complete_cb - PCM buffer complete callback
* @substream: pointer to ALSA PCM substream
* @return 0 on success or error code otherwise
- *
+ *
* This should be called from a child Audio Path once it has finished processing
* the PCM buffer
*/
diff --git a/core.c b/core.c
index 9fe7dba..e77dfb9 100644
--- a/core.c
+++ b/core.c
@@ -31,17 +31,17 @@ MODULE_LICENSE("GPL v2");
#define DEFAULT_FILE_PERMS 0644
/* Number of playback devices to create (max = MAX_PCM_DEVS) */
-static unsigned playback_num = 0;
+static unsigned int playback_num;
/* Number of capture devices to create (max = MAX_PCM_DEVS) */
-static unsigned capture_num = 0;
+static unsigned int capture_num;
/* Names per playback device */
static char *playback_names[MAX_PCM_DEVS];
/* Names per capture device */
static char *capture_names[MAX_PCM_DEVS];
/* Channels per playback device */
-static unsigned playback_chans[MAX_PCM_DEVS];
+static unsigned int playback_chans[MAX_PCM_DEVS];
/* Channels per capture device */
-static unsigned capture_chans[MAX_PCM_DEVS];
+static unsigned int capture_chans[MAX_PCM_DEVS];
module_param(playback_num, int, DEFAULT_FILE_PERMS);
MODULE_PARM_DESC(playback_num,
@@ -91,7 +91,7 @@ static int avirt_probe(struct platform_device *devptr)
// Set up playback
for (i = 0; i < playback_num; i++) {
if (!playback_names[i]) {
- pr_err("Playback config devicename is NULL for idx=%d\n",
+ pr_err("Playback config dev name is NULL for idx=%d\n",
i);
return -EINVAL;
}
@@ -255,6 +255,7 @@ static ssize_t audiopath_version_show(struct avirt_audiopath_obj *audiopath_obj,
char *buf)
{
struct avirt_audiopath *audiopath = audiopath_obj->path;
+
return sprintf(buf, "%d.%d.%d\n", audiopath->version[0],
audiopath->version[1], audiopath->version[2]);
}
@@ -316,7 +317,7 @@ static void destroy_avirt_audiopath_obj(struct avirt_audiopath_obj *p)
* avirt_get_current_audiopath - retrieves the current Audio Path
* @return: Current Audio Path
*/
-struct avirt_audiopath *avirt_get_current_audiopath()
+struct avirt_audiopath *avirt_get_current_audiopath(void)
{
struct avirt_audiopath_obj *ap_obj = list_entry(
audiopath_list.next, struct avirt_audiopath_obj, list);
diff --git a/core.h b/core.h
index de428c2..fb64030 100644
--- a/core.h
+++ b/core.h
@@ -16,8 +16,8 @@
/**
* PCM buffer complete callback
- *
- * These are called from the audiopath when a PCM buffer has completed, and
+ *
+ * These are called from the audiopath when a PCM buffer has completed, and
* new data can be submitted/retrieved
*/
typedef int (*avirt_buff_complete)(struct snd_pcm_substream *substream);
@@ -27,10 +27,10 @@ typedef int (*avirt_buff_complete)(struct snd_pcm_substream *substream);
*/
struct avirt_audiopath {
const char *name;
- unsigned version[3];
+ unsigned int version[3];
struct snd_pcm_hardware *hw;
struct snd_pcm_ops *pcm_ops;
- unsigned blocksize;
+ unsigned int blocksize;
void *context;
};
@@ -55,7 +55,7 @@ struct avirt_alsa_group {
* AVIRT core info
*/
struct avirt_coreinfo {
- unsigned version[3];
+ unsigned int version[3];
struct avirt_alsa_group playback;
struct avirt_alsa_group capture;