The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Adithya K <linux.challenge1@gmail.com>
Cc: standby24x7@gmail.com, dan.carpenter@oracle.com,
	khoroshilov@ispras.ru, arnd@arndb.de, burzalodowa@gmail.com,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	gregkh@linuxfoundation.org
Subject: Re: [PATCH] Staging: gdm72xx Fix minor coding style problems
Date: Wed, 07 May 2014 23:40:50 -0700	[thread overview]
Message-ID: <1399531250.4146.12.camel@joe-AO725> (raw)
In-Reply-To: <1399530237-1788-1-git-send-email-user@akrishna-Latitude-E6430>

On Thu, 2014-05-08 at 11:53 +0530, Adithya K wrote:
> This is patch for fixing of minor coding style problems.
[]
> diff --git a/drivers/staging/gdm72xx/gdm_qos.c b/drivers/staging/gdm72xx/gdm_qos.c
[]
> @@ -229,6 +229,7 @@ static u32 extract_qos_list(struct nic *nic, struct list_head *head)
>  					entry = list_entry(
>  					qcb->qos_list[i].prev,
>  					struct qos_entry_s, list);
> +
>  					list_move_tail(&entry->list, head);

That one is a checkpatch defect.

The list_entry( use is really ugly too
with bad indentation on the following line.

Look at the entire function:

static u32 extract_qos_list(struct nic *nic, struct list_head *head)
{
	struct qos_cb_s *qcb = &nic->qos;
	struct qos_entry_s *entry;
	int i;

	INIT_LIST_HEAD(head);

	for (i = 0; i < QOS_MAX; i++) {
		if (qcb->csr[i].enabled) {
			if (qcb->csr[i].qos_buf_count < qcb->qos_limit_size) {
				if (!list_empty(&qcb->qos_list[i])) {
					entry = list_entry(
					qcb->qos_list[i].prev,
					struct qos_entry_s, list);
					list_move_tail(&entry->list, head);
					qcb->csr[i].qos_buf_count++;

					if (!list_empty(&qcb->qos_list[i]))
						netdev_warn(nic->netdev,
							    "Index(%d) is piled!!\n",
							    i);
				}
			}
		}
	}

	return 0;
}

Please consider rewriting the function
to reduce unnecessary indentation.

Something like:

static u32 extract_qos_list(struct nic *nic, struct list_head *head)
{
	struct qos_cb_s *qcb = &nic->qos;
	int i;

	INIT_LIST_HEAD(head);

	for (i = 0; i < QOS_MAX; i++) {
		if (!qcb->csr[i].enabled ||
		    qcb->csr[i].qos_buf_count >= qcb->qos_limit_size)
			continue;

		if (!list_empty(&qcb->qos_list[i])) {
			struct qos_entry_s *entry;

			entry = list_entry(qcb->qos_list[i].prev,
					   struct qos_entry_s, list);
			list_move_tail(&entry->list, head);
			qcb->csr[i].qos_buf_count++;

			if (!list_empty(&qcb->qos_list[i]))
				netdev_warn(nic->netdev, "Index(%d) is piled!!\n",
					    i);
		}
	}

	return 0;
}



  reply	other threads:[~2014-05-08  6:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-08  6:23 [PATCH] Staging: gdm72xx Fix minor coding style problems Adithya K
2014-05-08  6:40 ` Joe Perches [this message]
2014-05-08  8:01   ` Dan Carpenter
2014-05-08  7:59 ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1399531250.4146.12.camel@joe-AO725 \
    --to=joe@perches.com \
    --cc=arnd@arndb.de \
    --cc=burzalodowa@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=khoroshilov@ispras.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux.challenge1@gmail.com \
    --cc=standby24x7@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox