From: Claudiu Manoil <claudiu.manoil@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 7/9][v2] net: tsec: Use portable types and accessors for BDs
Date: Fri, 4 Oct 2013 11:27:22 +0300 [thread overview]
Message-ID: <524E7BEA.2070103@freescale.com> (raw)
In-Reply-To: <1380825428.12932.154.camel@snotra.buserror.net>
On 10/3/2013 9:37 PM, Scott Wood wrote:
> On Thu, 2013-10-03 at 14:48 +0300, Claudiu Manoil wrote:
>> +static inline u16 read_txbd_stat(uint idx)
>> +{
>> + return in_be16((u16 __iomem *)&txbd[idx].status);
>> +}
>> +
>> +static inline void write_txbd_stat(uint idx, u16 status)
>> +{
>> + out_be16((u16 __iomem *)&txbd[idx].status, status);
>> +}
>> +
>> +static inline u16 read_rxbd_stat(uint idx)
>> +{
>> + return in_be16((u16 __iomem *)&rxbd[idx].status);
>> +}
>> +
>> +static inline void write_rxbd_stat(uint idx, u16 status)
>> +{
>> + out_be16((u16 __iomem *)&rxbd[idx].status, status);
>> +}
>
> Do you need __force on these to make sparse happy?
>
No, we don't need __force in this case, in_be/out_be are less
restrictive and take plain unsigned pointers (not __beNN pointers).
On the other hand, they require the __iomem address space marker, to
make sparse happy.
> I'd rather see these declared as __iomem than use casts (at which point,
> you probably don't need per-field accessor functions).
>
Me too, but I wasn't sure how to do that. I thought __iomem works with
pointer declarations only. But it turns out it works this way too:
-static struct txbd8 txbd[TX_BUF_CNT] __aligned(8);
-static struct rxbd8 rxbd[PKTBUFSRX] __aligned(8);
[...]
+static struct txbd8 __iomem txbd[TX_BUF_CNT] __aligned(8);
+static struct rxbd8 __iomem rxbd[PKTBUFSRX] __aligned(8);
[...]
- for (i = 0; read_txbd_stat(tx_idx) & TXBD_READY; i++) {
+ for (i = 0; in_be16(&txbd[tx_idx].status) & TXBD_READY; i++) {
[...]
And sparse doesn't complain about it. In this case I'll drop the
read_txbd_stat() and friends. Is this acceptable?
Thanks.
Claudiu
next prev parent reply other threads:[~2013-10-04 8:27 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-30 9:44 [U-Boot] [PATCH 0/9] net: tsec: Driver portability fixes and cleanup Claudiu Manoil
2013-09-30 9:44 ` [U-Boot] [PATCH 1/9] net: Fix mcast function pointer prototype Claudiu Manoil
2013-09-30 9:44 ` [U-Boot] [PATCH 2/9] net: tsec: Fix and cleanup tsec_mcast_addr() Claudiu Manoil
2013-09-30 9:44 ` [U-Boot] [PATCH 3/9] net: tsec: Fix priv pointer in tsec_mcast_addr() Claudiu Manoil
2013-09-30 9:44 ` [U-Boot] [PATCH 4/9] net: tsec: Cleanup tsec regs init and fix __iomem warns Claudiu Manoil
2013-09-30 9:44 ` [U-Boot] [PATCH 5/9] net: fsl_mdio: Fix warnings for __iomem pointers Claudiu Manoil
2013-09-30 9:44 ` [U-Boot] [PATCH 6/9] net: tsec: Fix CamelCase issues around BD code Claudiu Manoil
2013-09-30 9:44 ` [U-Boot] [PATCH 7/9] net: tsec: Use portable types and accessors for BDs Claudiu Manoil
2013-09-30 23:22 ` Scott Wood
2013-10-01 11:38 ` Claudiu Manoil
2013-10-01 18:50 ` Scott Wood
2013-10-02 14:16 ` Claudiu Manoil
2013-10-02 22:15 ` Scott Wood
2013-10-03 11:48 ` [U-Boot] [PATCH 7/9][v2] " Claudiu Manoil
2013-10-03 18:37 ` Scott Wood
2013-10-04 8:27 ` Claudiu Manoil [this message]
2013-10-04 15:50 ` Scott Wood
2013-10-04 16:13 ` [U-Boot] [PATCH 7/9][v3] " Claudiu Manoil
2013-10-04 16:25 ` [U-Boot] [PATCH 7/9][v2] " Claudiu Manoil
2013-10-05 14:31 ` Timur Tabi
2013-10-05 14:49 ` Timur Tabi
2013-10-07 9:53 ` Claudiu Manoil
2013-10-07 10:16 ` Claudiu Manoil
2013-10-07 12:05 ` Timur Tabi
2013-10-07 16:42 ` Scott Wood
2013-10-03 13:36 ` [U-Boot] [PATCH 7/9] " Claudiu Manoil
2013-10-04 3:12 ` Timur Tabi
2013-10-04 8:35 ` Claudiu Manoil
2013-09-30 9:44 ` [U-Boot] [PATCH 8/9] net: tsec: Use portable regs type (uint->u32) Claudiu Manoil
2013-09-30 9:44 ` [U-Boot] [PATCH 9/9] net: tsec: Fix mac addr setup portability, cleanup Claudiu Manoil
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=524E7BEA.2070103@freescale.com \
--to=claudiu.manoil@freescale.com \
--cc=u-boot@lists.denx.de \
/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