From: Pavel Machek <pavel@ucw.cz>
To: Luben Tuikov <luben_tuikov@adaptec.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH 2.6.13 10/20] aic94xx: aic94xx_reg.c Register access
Date: Sun, 11 Sep 2005 12:26:49 +0200 [thread overview]
Message-ID: <20050911102649.GA2742@elf.ucw.cz> (raw)
In-Reply-To: <4321E3CB.2060806@adaptec.com>
Hi!
> +/* We know that the register wanted is in the range
> + * of the sliding window.
> + */
> +#define ASD_READ_SW(ww, type, ord) \
> +static inline type asd_read_##ww##_##ord (struct asd_ha_struct *asd_ha,\
> + u32 reg) \
> +{ \
> + struct asd_ha_addrspace *io_handle = &asd_ha->io_handle[0]; \
> + u32 map_offs=(reg - io_handle-> ww##_base )+asd_mem_offs_##ww ();\
> + return asd_read_##ord (asd_ha, (unsigned long) map_offs); \
> +}
> +
> +#define ASD_WRITE_SW(ww, type, ord) \
> +static inline void asd_write_##ww##_##ord (struct asd_ha_struct *asd_ha,\
> + u32 reg, type val) \
> +{ \
> + struct asd_ha_addrspace *io_handle = &asd_ha->io_handle[0]; \
> + u32 map_offs=(reg - io_handle-> ww##_base )+asd_mem_offs_##ww ();\
> + asd_write_##ord (asd_ha, (unsigned long) map_offs, val); \
> +}
> +
> +ASD_READ_SW(swa, u8, byte);
> +ASD_READ_SW(swa, u16, word);
> +ASD_READ_SW(swa, u32, dword);
> +
> +ASD_READ_SW(swb, u8, byte);
> +ASD_READ_SW(swb, u16, word);
> +ASD_READ_SW(swb, u32, dword);
> +
> +ASD_READ_SW(swc, u8, byte);
> +ASD_READ_SW(swc, u16, word);
> +ASD_READ_SW(swc, u32, dword);
> +
> +ASD_WRITE_SW(swa, u8, byte);
> +ASD_WRITE_SW(swa, u16, word);
> +ASD_WRITE_SW(swa, u32, dword);
> +
> +ASD_WRITE_SW(swb, u8, byte);
> +ASD_WRITE_SW(swb, u16, word);
> +ASD_WRITE_SW(swb, u32, dword);
> +
> +ASD_WRITE_SW(swc, u8, byte);
> +ASD_WRITE_SW(swc, u16, word);
> +ASD_WRITE_SW(swc, u32, dword);
This is certainly nice entry into "best abuse of macros" contest. Do
you really need all those inline functions?
> +static void __asd_write_reg_byte(struct asd_ha_struct *asd_ha, u32 reg, u8 val)
> +{
> + struct asd_ha_addrspace *io_handle=&asd_ha->io_handle[0];
> + BUG_ON(reg >= 0xC0000000 || reg < ALL_BASE_ADDR);
Will this work correctly with 2GB/2GB split kernels?
Pavel
--
if you have sharp zaurus hardware you don't need... you know my address
next prev parent reply other threads:[~2005-09-11 10:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-09 19:34 Luben Tuikov
2005-09-11 10:26 ` Pavel Machek [this message]
2005-09-12 17:04 ` Luben Tuikov
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=20050911102649.GA2742@elf.ucw.cz \
--to=pavel@ucw.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=luben_tuikov@adaptec.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
all inboxes | Powered by JetHome®