mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-20 10:44:23 +08:00
0ce34bc8f7
Instead of passing our own custom 32-bit addresses around and translating them, this patch makes all our register address constants absolute and removes the translation. There are two ugly parts: - fw_reg_addr() is needed to compute addresses of firmware registers, as this is dynamic based upon firmware - inc_addr() needs a small hack to handle byte vs word addressing However, both of those are only small, and we don't use fw_regs a whole lot anyway. The bonuses here include simplicity and improved driver readability. Also, the fact that registers are now referenced by 16-bit absolute addresses (as opposed to 32-bit pseudo addresses) means that over 2kb compiled code size has been shaved off. Includes some touchups and sparse fixes from Ulrich Kunitz. Signed-off-by: Daniel Drake <dsd@gentoo.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
58 lines
1.6 KiB
C
58 lines
1.6 KiB
C
/* zd_def.h
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
|
|
#ifndef _ZD_DEF_H
|
|
#define _ZD_DEF_H
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/stringify.h>
|
|
#include <linux/device.h>
|
|
#include <linux/kernel.h>
|
|
|
|
typedef u16 __nocast zd_addr_t;
|
|
|
|
#define dev_printk_f(level, dev, fmt, args...) \
|
|
dev_printk(level, dev, "%s() " fmt, __func__, ##args)
|
|
|
|
#ifdef DEBUG
|
|
# define dev_dbg_f(dev, fmt, args...) \
|
|
dev_printk_f(KERN_DEBUG, dev, fmt, ## args)
|
|
#else
|
|
# define dev_dbg_f(dev, fmt, args...) do { (void)(dev); } while (0)
|
|
#endif /* DEBUG */
|
|
|
|
#ifdef DEBUG
|
|
# define ZD_ASSERT(x) \
|
|
do { \
|
|
if (!(x)) { \
|
|
pr_debug("%s:%d ASSERT %s VIOLATED!\n", \
|
|
__FILE__, __LINE__, __stringify(x)); \
|
|
dump_stack(); \
|
|
} \
|
|
} while (0)
|
|
#else
|
|
# define ZD_ASSERT(x) do { } while (0)
|
|
#endif
|
|
|
|
#ifdef DEBUG
|
|
# define ZD_MEMCLEAR(pointer, size) memset((pointer), 0xff, (size))
|
|
#else
|
|
# define ZD_MEMCLEAR(pointer, size) do { } while (0)
|
|
#endif
|
|
|
|
#endif /* _ZD_DEF_H */
|