From: David Miller <davem@davemloft.net>
To: Alexander.Loktionov@aquantia.com
Cc: netdev@vger.kernel.org, vomlehn@texas.net,
Simon.Edelhaus@aquantia.com, Dmitrii.Tarakanov@aquantia.com,
Pavel.Belous@aquantia.com, Dmitry.Bezrukov@aquantia.com
Subject: Re: [PATCH v5 02/13] net: ethernet: aquantia: Common functions and definitions
Date: Fri, 13 Jan 2017 20:32:02 -0500 (EST) [thread overview]
Message-ID: <20170113.203202.1959215027883107709.davem@davemloft.net> (raw)
In-Reply-To: <2c056fd544958594f6356a17892c251ea26ea8c8.1484283610.git.vomlehn@texas.net>
From: Alexander Loktionov <Alexander.Loktionov@aquantia.com>
Date: Thu, 12 Jan 2017 21:02:18 -0800
> +#define AQ_OBJ_HEADER spinlock_t lock; atomic_t flags; atomic_t busy_count
> +
> +struct aq_obj_s {
> + AQ_OBJ_HEADER;
> +};
Please don't hide multiple declarations and types inside of a macro,
that makes the code harder to understand.
Use a sub-structure or similar, and pass that sub-structure to the
handlers.
> +#define AQ_OBJ_TST(_OBJ_, _FLAG_) ((_FLAG_) & atomic_read(&(_OBJ_)->flags))
> +
> +#define AQ_OBJ_SET(_OBJ_, _F_) \
...
> +#define AQ_OBJ_CLR(_OBJ_, _F_) \
Please don't reinvent the wheel.
Use test_bit, set_bit, clear_bit, test_and_set_bit, and
test_and_clear_bit. Using an atomic_t for flag bits is completely
inappropriate, that type is primarily meant for atomic counters.
The appropriate type for *_bit() operations is "unsigned long".
next prev parent reply other threads:[~2017-01-14 1:32 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-13 5:02 [PATCH v5 00/13] net: ethernet: aquantia: Add AQtion 2.5/5 GB NIC driver Alexander Loktionov
2017-01-13 5:02 ` [PATCH v5 01/13] net: ethernet: aquantia: Make and configuration files Alexander Loktionov
2017-01-13 5:02 ` [PATCH v5 02/13] net: ethernet: aquantia: Common functions and definitions Alexander Loktionov
2017-01-13 5:02 ` [PATCH v5 03/13] net: ethernet: aquantia: Add ring support code Alexander Loktionov
2017-01-13 5:02 ` [PATCH v5 04/13] net: ethernet: aquantia: Low-level hardware interfaces Alexander Loktionov
2017-01-13 5:02 ` [PATCH v5 05/13] net: ethernet: aquantia: Support for NIC-specific code Alexander Loktionov
2017-01-13 5:02 ` [PATCH v5 06/13] net: ethernet: aquantia: Atlantic A0 and B0 specific functions Alexander Loktionov
2017-01-13 5:02 ` [PATCH v5 07/13] net: ethernet: aquantia: Vector operations Alexander Loktionov
2017-01-13 5:02 ` [PATCH v5 08/13] net: ethernet: aquantia: PCI operations Alexander Loktionov
2017-01-13 5:02 ` [PATCH v5 09/13] net: ethernet: aquantia: Atlantic hardware abstraction layer Alexander Loktionov
2017-01-13 5:02 ` [PATCH v5 10/13] net: ethernet: aquantia: Hardware interface and utility functions Alexander Loktionov
2017-01-13 5:02 ` [PATCH v5 11/13] net: ethernet: aquantia: Ethtool support Alexander Loktionov
2017-01-13 5:02 ` [PATCH v5 12/13] net: ethernet: aquantia: Receive side scaling Alexander Loktionov
2017-01-13 5:02 ` [PATCH v5 13/13] net: ethernet: aquantia: Integrate AQtion 2.5/5 GB NIC driver Alexander Loktionov
2017-01-14 1:47 ` [PATCH v5 11/13] net: ethernet: aquantia: Ethtool support Florian Fainelli
2017-01-14 1:48 ` [PATCH v5 08/13] net: ethernet: aquantia: PCI operations Florian Fainelli
2017-01-14 2:00 ` [PATCH v5 05/13] net: ethernet: aquantia: Support for NIC-specific code Florian Fainelli
2017-01-14 22:55 ` Rami Rosen
2017-01-15 1:15 ` Andrew Lunn
2017-01-14 1:32 ` David Miller [this message]
2017-01-13 5:06 ` [PATCH v5 01/13] net: ethernet: aquantia: Make and configuration files Joe Perches
2017-01-13 5:24 ` David VomLehn
2017-01-13 5:59 ` Joe Perches
2017-01-13 6:57 ` David VomLehn
2017-01-13 7:28 ` Joe Perches
2017-01-14 2:01 ` Florian Fainelli
2017-01-14 18:39 ` Florian Fainelli
2017-01-14 18:42 ` David VomLehn
2017-01-14 18:48 ` Florian Fainelli
2017-01-14 19:04 ` David VomLehn
2017-01-14 1:38 ` [PATCH v5 00/13] net: ethernet: aquantia: Add AQtion 2.5/5 GB NIC driver Florian Fainelli
2017-01-14 3:41 ` David VomLehn
2017-01-14 2:05 ` Florian Fainelli
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=20170113.203202.1959215027883107709.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=Alexander.Loktionov@aquantia.com \
--cc=Dmitrii.Tarakanov@aquantia.com \
--cc=Dmitry.Bezrukov@aquantia.com \
--cc=Pavel.Belous@aquantia.com \
--cc=Simon.Edelhaus@aquantia.com \
--cc=netdev@vger.kernel.org \
--cc=vomlehn@texas.net \
/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;
as well as URLs for NNTP newsgroup(s).