linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* staging: Thunderbolt: ctl.c style coding issues
@ 2022-06-25  8:49 Gabriel Viso Carrera
  2022-06-25  8:49 ` [PATCH 1/3] staging: Thunderbolt: ctl.c: Fixed 2 literal " Gabriel Viso Carrera
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Gabriel Viso Carrera @ 2022-06-25  8:49 UTC (permalink / raw)
  To: andreas.noever; +Cc: linux-usb, linux-kernel

This patch set solves all coding style issues found in ctl.c, as per
checkpatch.pl

[PATCH 1/3] staging: Thunderbolt: ctl.c: Fixed 2 literal style coding
[PATCH 2/3] staging: Thunderbolt: ctl.c: Fixed blank line coding
[PATCH 3/3] staging: Thunderbolt: ctl.c: Fixed comment coding style


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] staging: Thunderbolt: ctl.c: Fixed 2 literal style coding issues
  2022-06-25  8:49 staging: Thunderbolt: ctl.c style coding issues Gabriel Viso Carrera
@ 2022-06-25  8:49 ` Gabriel Viso Carrera
  2022-06-25  8:49 ` [PATCH 2/3] staging: Thunderbolt: ctl.c: Fixed blank line coding style issues Gabriel Viso Carrera
  2022-06-25  8:49 ` [PATCH 3/3] staging: Thunderbolt: ctl.c: Fixed comment " Gabriel Viso Carrera
  2 siblings, 0 replies; 8+ messages in thread
From: Gabriel Viso Carrera @ 2022-06-25  8:49 UTC (permalink / raw)
  To: andreas.noever; +Cc: linux-usb, linux-kernel, Gabriel Viso Carrera

In lines 1028 and 1054, there were WARN calls with hardcoded literal
function name. Replaced with the recommended %s and __func__.

Signed-off-by: Gabriel Viso Carrera <gabriel@gvisoc.com>
---
 drivers/thunderbolt/ctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c
index e92c658dba1c..4b841fbb3628 100644
--- a/drivers/thunderbolt/ctl.c
+++ b/drivers/thunderbolt/ctl.c
@@ -1025,7 +1025,7 @@ int tb_cfg_read(struct tb_ctl *ctl, void *buffer, u64 route, u32 port,
 		break;
 
 	default:
-		WARN(1, "tb_cfg_read: %d\n", res.err);
+		WARN(1, "%s: %d\n", __func__, res.err);
 		break;
 	}
 	return res.err;
@@ -1051,7 +1051,7 @@ int tb_cfg_write(struct tb_ctl *ctl, const void *buffer, u64 route, u32 port,
 		break;
 
 	default:
-		WARN(1, "tb_cfg_write: %d\n", res.err);
+		WARN(1, "%s: %d\n", __func__, res.err);
 		break;
 	}
 	return res.err;
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] staging: Thunderbolt: ctl.c: Fixed blank line coding style issues
  2022-06-25  8:49 staging: Thunderbolt: ctl.c style coding issues Gabriel Viso Carrera
  2022-06-25  8:49 ` [PATCH 1/3] staging: Thunderbolt: ctl.c: Fixed 2 literal " Gabriel Viso Carrera
@ 2022-06-25  8:49 ` Gabriel Viso Carrera
  2022-06-25  8:49 ` [PATCH 3/3] staging: Thunderbolt: ctl.c: Fixed comment " Gabriel Viso Carrera
  2 siblings, 0 replies; 8+ messages in thread
From: Gabriel Viso Carrera @ 2022-06-25  8:49 UTC (permalink / raw)
  To: andreas.noever; +Cc: linux-usb, linux-kernel, Gabriel Viso Carrera

Added blank lines after variable declarations as per checkpatch.pl
(all issues of that kind in the file).

Signed-off-by: Gabriel Viso Carrera <gabriel@gvisoc.com>
---
 drivers/thunderbolt/ctl.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c
index 4b841fbb3628..6c973fdf7b36 100644
--- a/drivers/thunderbolt/ctl.c
+++ b/drivers/thunderbolt/ctl.c
@@ -232,6 +232,7 @@ static struct tb_cfg_result decode_error(const struct ctl_pkg *response)
 	struct cfg_error_pkg *pkg = response->buffer;
 	struct tb_ctl *ctl = response->ctl;
 	struct tb_cfg_result res = { 0 };
+
 	res.response_route = tb_cfg_get_route(&pkg->header);
 	res.response_port = 0;
 	res.err = check_header(response, sizeof(*pkg), TB_CFG_PKG_ERROR,
@@ -327,6 +328,7 @@ static void tb_ctl_pkg_free(struct ctl_pkg *pkg)
 static struct ctl_pkg *tb_ctl_pkg_alloc(struct tb_ctl *ctl)
 {
 	struct ctl_pkg *pkg = kzalloc(sizeof(*pkg), GFP_KERNEL);
+
 	if (!pkg)
 		return NULL;
 	pkg->ctl = ctl;
@@ -346,6 +348,7 @@ static void tb_ctl_tx_callback(struct tb_ring *ring, struct ring_frame *frame,
 			       bool canceled)
 {
 	struct ctl_pkg *pkg = container_of(frame, typeof(*pkg), frame);
+
 	tb_ctl_pkg_free(pkg);
 }
 
@@ -361,6 +364,7 @@ static int tb_ctl_tx(struct tb_ctl *ctl, const void *data, size_t len,
 {
 	int res;
 	struct ctl_pkg *pkg;
+
 	if (len % 4 != 0) { /* required for le->be conversion */
 		tb_ctl_WARN(ctl, "TX: invalid size: %zu\n", len);
 		return -EINVAL;
@@ -627,6 +631,7 @@ struct tb_ctl *tb_ctl_alloc(struct tb_nhi *nhi, int timeout_msec, event_cb cb,
 {
 	int i;
 	struct tb_ctl *ctl = kzalloc(sizeof(*ctl), GFP_KERNEL);
+
 	if (!ctl)
 		return NULL;
 	ctl->nhi = nhi;
@@ -700,6 +705,7 @@ void tb_ctl_free(struct tb_ctl *ctl)
 void tb_ctl_start(struct tb_ctl *ctl)
 {
 	int i;
+
 	tb_ctl_dbg(ctl, "control channel starting...\n");
 	tb_ring_start(ctl->tx); /* is used to ack hotplug packets, start first */
 	tb_ring_start(ctl->rx);
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] staging: Thunderbolt: ctl.c: Fixed comment coding style issues
  2022-06-25  8:49 staging: Thunderbolt: ctl.c style coding issues Gabriel Viso Carrera
  2022-06-25  8:49 ` [PATCH 1/3] staging: Thunderbolt: ctl.c: Fixed 2 literal " Gabriel Viso Carrera
  2022-06-25  8:49 ` [PATCH 2/3] staging: Thunderbolt: ctl.c: Fixed blank line coding style issues Gabriel Viso Carrera
@ 2022-06-25  8:49 ` Gabriel Viso Carrera
  2022-06-25  9:37   ` Joe Perches
  2 siblings, 1 reply; 8+ messages in thread
From: Gabriel Viso Carrera @ 2022-06-25  8:49 UTC (permalink / raw)
  To: andreas.noever; +Cc: linux-usb, linux-kernel, Gabriel Viso Carrera

Fixed a couple of comment aligment & formatting coding style issues.

Signed-off-by: Gabriel Viso Carrera <gabriel@gvisoc.com>
---
 drivers/thunderbolt/ctl.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c
index 6c973fdf7b36..5c6c62867b9c 100644
--- a/drivers/thunderbolt/ctl.c
+++ b/drivers/thunderbolt/ctl.c
@@ -276,7 +276,8 @@ static void tb_cfg_print_error(struct tb_ctl *ctl,
 	switch (res->tb_error) {
 	case TB_CFG_ERROR_PORT_NOT_CONNECTED:
 		/* Port is not connected. This can happen during surprise
-		 * removal. Do not warn. */
+		 * removal. Do not warn.
+		 */
 		return;
 	case TB_CFG_ERROR_INVALID_CONFIG_SPACE:
 		/*
@@ -402,11 +403,11 @@ static bool tb_ctl_handle_event(struct tb_ctl *ctl, enum tb_cfg_pkg_type type,
 static void tb_ctl_rx_submit(struct ctl_pkg *pkg)
 {
 	tb_ring_rx(pkg->ctl->rx, &pkg->frame); /*
-					     * We ignore failures during stop.
-					     * All rx packets are referenced
-					     * from ctl->rx_packets, so we do
-					     * not loose them.
-					     */
+						* We ignore failures during stop.
+						* All rx packets are referenced
+						* from ctl->rx_packets, so we do
+						* not loose them.
+						*/
 }
 
 static int tb_async_error(const struct ctl_pkg *pkg)
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] staging: Thunderbolt: ctl.c: Fixed comment coding style issues
  2022-06-25  8:49 ` [PATCH 3/3] staging: Thunderbolt: ctl.c: Fixed comment " Gabriel Viso Carrera
@ 2022-06-25  9:37   ` Joe Perches
  2022-06-29  6:54     ` Gabriel Viso Carrera
  0 siblings, 1 reply; 8+ messages in thread
From: Joe Perches @ 2022-06-25  9:37 UTC (permalink / raw)
  To: Gabriel Viso Carrera, andreas.noever; +Cc: linux-usb, linux-kernel

On Sat, 2022-06-25 at 18:49 +1000, Gabriel Viso Carrera wrote:
> Fixed a couple of comment aligment & formatting coding style issues.

trivia:

> diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c
[]
> @@ -402,11 +403,11 @@ static bool tb_ctl_handle_event(struct tb_ctl *ctl, enum tb_cfg_pkg_type type,
>  static void tb_ctl_rx_submit(struct ctl_pkg *pkg)
>  {
>  	tb_ring_rx(pkg->ctl->rx, &pkg->frame); /*
> -					     * We ignore failures during stop.
> -					     * All rx packets are referenced
> -					     * from ctl->rx_packets, so we do
> -					     * not loose them.
> -					     */
> +						* We ignore failures during stop.
> +						* All rx packets are referenced
> +						* from ctl->rx_packets, so we do
> +						* not loose them.
> +						*/

I'd indent this only 1 level and put it before the call
(and fix the loose/lose typo)

{
	/* We ignore failures during stop.
	 * All rx packets are referenced from ctl->rx_packets,
	 * so we do not lose them.
	 */
	tb_ring_rx(pkg->ctl->rx, &pkg->frame);
}


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] staging: Thunderbolt: ctl.c: Fixed comment coding style issues
  2022-06-25  9:37   ` Joe Perches
@ 2022-06-29  6:54     ` Gabriel Viso Carrera
  2022-06-29  7:02       ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Gabriel Viso Carrera @ 2022-06-29  6:54 UTC (permalink / raw)
  To: Joe Perches; +Cc: andreas.noever, linux-usb, linux-kernel

On Sat, Jun 25, 2022 at 02:37:54AM -0700, Joe Perches wrote:
[]
> 
> I'd indent this only 1 level and put it before the call
> (and fix the loose/lose typo)
> 
> {
> 	/* We ignore failures during stop.
> 	 * All rx packets are referenced from ctl->rx_packets,
> 	 * so we do not lose them.
> 	 */
> 	tb_ring_rx(pkg->ctl->rx, &pkg->frame);
> }
> 

Fair enough. Not sure on how to proceed, as these were my 
first patches ever sent, and I don't want to make anyone 
work more than the strictly necessary. 

- Should I submit an additional patch intended to be applied 
on top of 3/3?
- Should I sumbit a whole new 3/3, addressing the whole comment
issues all at once?
- Should I just wait on the outcome and proceed from there?

Advice would be appreciated.

Anyway, I will be sending some patches over other files for 
the time being, paying more attention to the details.

Thanks,
~Gabriel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] staging: Thunderbolt: ctl.c: Fixed comment coding style issues
  2022-06-29  6:54     ` Gabriel Viso Carrera
@ 2022-06-29  7:02       ` Greg KH
  2022-06-29  7:47         ` Gabriel Viso Carrera
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2022-06-29  7:02 UTC (permalink / raw)
  To: Gabriel Viso Carrera; +Cc: Joe Perches, andreas.noever, linux-usb, linux-kernel

On Wed, Jun 29, 2022 at 04:54:53PM +1000, Gabriel Viso Carrera wrote:
> On Sat, Jun 25, 2022 at 02:37:54AM -0700, Joe Perches wrote:
> []
> > 
> > I'd indent this only 1 level and put it before the call
> > (and fix the loose/lose typo)
> > 
> > {
> > 	/* We ignore failures during stop.
> > 	 * All rx packets are referenced from ctl->rx_packets,
> > 	 * so we do not lose them.
> > 	 */
> > 	tb_ring_rx(pkg->ctl->rx, &pkg->frame);
> > }
> > 
> 
> Fair enough. Not sure on how to proceed, as these were my 
> first patches ever sent, and I don't want to make anyone 
> work more than the strictly necessary. 

If you are just learning how to do all of this, I strongly recommend you
stick to drivers/staging/* which is much more forgiving and welcoming
for basic coding style cleanups.  After you get some experience there,
then go out into other subsystems.  Many subsystems do not like coding
style fixes as it causes conflicts with other development that is
happening.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] staging: Thunderbolt: ctl.c: Fixed comment coding style issues
  2022-06-29  7:02       ` Greg KH
@ 2022-06-29  7:47         ` Gabriel Viso Carrera
  0 siblings, 0 replies; 8+ messages in thread
From: Gabriel Viso Carrera @ 2022-06-29  7:47 UTC (permalink / raw)
  To: Greg KH; +Cc: Joe Perches, andreas.noever, linux-usb, linux-kernel

On Wed, Jun 29, 2022 at 09:02:52AM +0200, Greg KH wrote:
> If you are just learning how to do all of this, I strongly recommend you
> stick to drivers/staging/* which is much more forgiving and welcoming
> for basic coding style cleanups.  After you get some experience there,
> then go out into other subsystems.  Many subsystems do not like coding
> style fixes as it causes conflicts with other development that is
> happening.
> 
> thanks,
> 
> greg k-h

I am doing these patches as my first step, yes.
Will do as suggested, thanks for that. 

~Gabriel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-06-29  7:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-25  8:49 staging: Thunderbolt: ctl.c style coding issues Gabriel Viso Carrera
2022-06-25  8:49 ` [PATCH 1/3] staging: Thunderbolt: ctl.c: Fixed 2 literal " Gabriel Viso Carrera
2022-06-25  8:49 ` [PATCH 2/3] staging: Thunderbolt: ctl.c: Fixed blank line coding style issues Gabriel Viso Carrera
2022-06-25  8:49 ` [PATCH 3/3] staging: Thunderbolt: ctl.c: Fixed comment " Gabriel Viso Carrera
2022-06-25  9:37   ` Joe Perches
2022-06-29  6:54     ` Gabriel Viso Carrera
2022-06-29  7:02       ` Greg KH
2022-06-29  7:47         ` Gabriel Viso Carrera

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).