Skip to contentSkip to conversation

staging: bcm2835-audio: fix multiple checkpatch issues in bcm2835-vchiq.c

PATCH New Aishwarya Pant 1 participant 6 messages Mar 3, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover staging: bcm2835-audio: fix multiple checkpatch issues in bcm2835-vchiq.c

Fix multiple code styling warnings issued by checkpatch on file bcm2835-vchiq.c in bcm2835-audio driver

Aishwarya Pant (5):

staging-audio: remove spaces after cast
staging: bcm2835-audio: use braces on all arms of statement
staging: bcm2835-audio: fix typo in word
staging: bcm2835-audio: match alignment with open parenthesis
staging: bcm2835-audio: use min_t() macro instead of min()

 .../vc04_services/bcm2835-audio/bcm2835-vchiq.c    | 34 ++++++++++++----------
 1 file changed, 18 insertions(+), 16 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/5 staging: bcm2835-audio: remove spaces after cast

Remove instances of unnecessary blank space after cast in bcm2835-vchiq.c

---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +2 -2
index df1f3dd..3cc75b3 100644
@@ -125,7 +125,7 @@ static void my_wq_function(struct work_struct *work)
 		LOG_ERR(" Unexpected work: %p:%d\n", w->alsa_stream, w->cmd);
 		break;
 	}
-	kfree((void *) work);
+	kfree((void *)work);
 	LOG_DBG(" .. OUT %d\n", ret);
 }
 
@@ -854,7 +854,7 @@ static int bcm2835_audio_write_worker(struct bcm2835_alsa_stream *alsa_stream,
 				NULL);
 		} else {
 			while (count > 0) {
-				int bytes = min((int) m.u.write.max_packet, (int) count);
+				int bytes = min((int)m.u.write.max_packet, (int)count);
 
 				status = bcm2835_vchi_msg_queue(instance->vchi_handle[0],
 								src, bytes);
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/5 staging: bcm2835-audio: use braces on all arms of statement

In reply to Aishwarya Pant

Add braces on all arms of the if-else statements in bcm2835-vchiq.c to comply with kernel coding style.

---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +6 -3
index 3cc75b3..07f7c34 100644
@@ -145,8 +145,9 @@ int bcm2835_audio_start(struct bcm2835_alsa_stream *alsa_stream)
 			work->cmd = BCM2835_AUDIO_START;
 			if (queue_work(alsa_stream->my_wq, &work->my_work))
 				ret = 0;
-		} else
+		} else {
 			LOG_ERR(" .. Error: NULL work kmalloc\n");
+		}
 	}
 	LOG_DBG(" .. OUT %d\n", ret);
 	return ret;
@@ -168,8 +169,9 @@ int bcm2835_audio_stop(struct bcm2835_alsa_stream *alsa_stream)
 			work->cmd = BCM2835_AUDIO_STOP;
 			if (queue_work(alsa_stream->my_wq, &work->my_work))
 				ret = 0;
-		} else
+		} else {
 			LOG_ERR(" .. Error: NULL work kmalloc\n");
+		}
 	}
 	LOG_DBG(" .. OUT %d\n", ret);
 	return ret;
@@ -194,8 +196,9 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream,
 			work->count = count;
 			if (queue_work(alsa_stream->my_wq, &work->my_work))
 				ret = 0;
-		} else
+		} else {
 			LOG_ERR(" .. Error: NULL work kmalloc\n");
+		}
 	}
 	LOG_DBG(" .. OUT %d\n", ret);
 	return ret;
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/5 staging: bcm2835-audio: fix typo in word

In reply to Aishwarya Pant

fix typo in word receives

---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +1 -1
index 07f7c34..f55c396 100644
@@ -309,7 +309,7 @@ vc_vchi_audio_init(VCHI_INSTANCE_T vchi_instance,
 			0, // tx fifo size (unused)
 			audio_vchi_callback, // service callback
 			instance, // service callback parameter
-			1, //TODO: remove VCOS_FALSE,   // unaligned bulk recieves
+			1, //TODO: remove VCOS_FALSE,   // unaligned bulk receives
 			1, //TODO: remove VCOS_FALSE,   // unaligned bulk transmits
 			0 // want crc check on bulk transfers
 		};
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/5 staging: bcm2835-audio: match alignment with open parenthesis

In reply to Aishwarya Pant

Fix the following checkpatch warning issued on bcm2835-vchiq.c:
CHECK: Alignment should match open parenthesis

---
 .../vc04_services/bcm2835-audio/bcm2835-vchiq.c       | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +9 -10
index f55c396..09168e7 100644
@@ -316,7 +316,8 @@ vc_vchi_audio_init(VCHI_INSTANCE_T vchi_instance,
 
 		LOG_DBG("%s: about to open %i\n", __func__, i);
 		status = vchi_service_open(vchi_instance, &params,
-			&instance->vchi_handle[i]);
+					   &instance->vchi_handle[i]);
+
 		LOG_DBG("%s: opened %i: %p=%d\n", __func__, i, instance->vchi_handle[i], status);
 		if (status) {
 			LOG_ERR("%s: failed to open VCHI service connection (status=%d)\n",
@@ -598,7 +599,7 @@ int bcm2835_audio_set_params(struct bcm2835_alsa_stream *alsa_stream,
 	LOG_DBG(" .. IN\n");
 
 	LOG_INFO(" Setting ALSA channels(%d), samplerate(%d), bits-per-sample(%d)\n",
-		channels, samplerate, bps);
+		 channels, samplerate, bps);
 
 	/* resend ctls - alsa_stream may not have been open when first send */
 	ret = bcm2835_audio_set_ctls_chan(alsa_stream, alsa_stream->chip);
@@ -822,7 +823,7 @@ static int bcm2835_audio_write_worker(struct bcm2835_alsa_stream *alsa_stream,
 	vchi_service_use(instance->vchi_handle[0]);
 
 	if (instance->peer_version == 0 &&
-			vchi_get_peer_version(instance->vchi_handle[0], &instance->peer_version) == 0)
+	    vchi_get_peer_version(instance->vchi_handle[0], &instance->peer_version) == 0)
 		LOG_DBG("%s: client version %d connected\n", __func__, instance->peer_version);
 
 	m.type = VC_AUDIO_MSG_TYPE_WRITE;
@@ -848,13 +849,11 @@ static int bcm2835_audio_write_worker(struct bcm2835_alsa_stream *alsa_stream,
 		if (!m.u.write.max_packet) {
 			/* Send the message to the videocore */
 			status = vchi_bulk_queue_transmit(instance->vchi_handle[0],
-				src, count,
-				0 *
-				VCHI_FLAGS_BLOCK_UNTIL_QUEUED
-				+
-				1 *
-				VCHI_FLAGS_BLOCK_UNTIL_DATA_READ,
-				NULL);
+							  src, count,
+							  0 * VCHI_FLAGS_BLOCK_UNTIL_QUEUED
+							  +
+							  1 * VCHI_FLAGS_BLOCK_UNTIL_DATA_READ,
+							  NULL);
 		} else {
 			while (count > 0) {
 				int bytes = min((int)m.u.write.max_packet, (int)count);
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/5 staging: bcm2835-audio: use min_t() macro instead of min()

In reply to Aishwarya Pant

use min_t() macro in place of min() to replace the two typecasts of min. Change suggested by checkpatch script.

---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +1 -1
index 09168e7..c54bef3 100644
@@ -856,7 +856,7 @@ static int bcm2835_audio_write_worker(struct bcm2835_alsa_stream *alsa_stream,
 							  NULL);
 		} else {
 			while (count > 0) {
-				int bytes = min((int)m.u.write.max_packet, (int)count);
+				int bytes = min_t(int, m.u.write.max_packet, count);
 
 				status = bcm2835_vchi_msg_queue(instance->vchi_handle[0],
 								src, bytes);
Signature · 1 line
2.7.4