diff options
author | Soumya Negi <soumya.negi97@gmail.com> | 2023-10-13 02:29:05 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-10-15 19:20:35 +0300 |
commit | 5b91f876f9e31c106177ee9341412d64e51f5ebf (patch) | |
tree | d5a4fb7e6f41309321326dafd5a7b6365ead524c /drivers | |
parent | 697455ce411075c37729fbdd1dff4052cf770800 (diff) | |
download | linux-5b91f876f9e31c106177ee9341412d64e51f5ebf.tar.xz |
staging: rts5208: Refactor macros to static inline functions
Driver rts5208 uses macros to read/write data & to perform generic PCI
functions. Rewrite these macros as static inline functions in the header
file.
Suggested-by: Dan Carpenter <dan.carpenter@linaro.org>
Suggested-by: Julia Lawall <julia.lawall@inria.fr>
Signed-off-by: Soumya Negi <soumya.negi97@gmail.com>
Link: https://lore.kernel.org/r/c7431fe4d7f72138d8dc86269794f87c30d21a38.1697152251.git.soumya.negi97@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/rts5208/rtsx.h | 59 |
1 files changed, 40 insertions, 19 deletions
diff --git a/drivers/staging/rts5208/rtsx.h b/drivers/staging/rts5208/rtsx.h index 2e101da83220..ea29646b8c38 100644 --- a/drivers/staging/rts5208/rtsx.h +++ b/drivers/staging/rts5208/rtsx.h @@ -39,25 +39,6 @@ /* * macros for easy use */ -#define rtsx_writel(chip, reg, value) \ - iowrite32(value, (chip)->rtsx->remap_addr + reg) -#define rtsx_readl(chip, reg) \ - ioread32((chip)->rtsx->remap_addr + reg) -#define rtsx_writew(chip, reg, value) \ - iowrite16(value, (chip)->rtsx->remap_addr + reg) -#define rtsx_readw(chip, reg) \ - ioread16((chip)->rtsx->remap_addr + reg) -#define rtsx_writeb(chip, reg, value) \ - iowrite8(value, (chip)->rtsx->remap_addr + reg) -#define rtsx_readb(chip, reg) \ - ioread8((chip)->rtsx->remap_addr + reg) - -#define rtsx_read_config_byte(chip, where, val) \ - pci_read_config_byte((chip)->rtsx->pci, where, val) - -#define rtsx_write_config_byte(chip, where, val) \ - pci_write_config_byte((chip)->rtsx->pci, where, val) - #define wait_timeout_x(task_state, msecs) \ do { \ set_current_state((task_state)); \ @@ -147,4 +128,44 @@ enum xfer_buf_dir {TO_XFER_BUF, FROM_XFER_BUF}; #include "rtsx_sys.h" #include "general.h" +static inline void rtsx_writel(struct rtsx_chip *chip, u32 reg, u32 value) +{ + iowrite32(value, chip->rtsx->remap_addr + reg); +} + +static inline u32 rtsx_readl(struct rtsx_chip *chip, u32 reg) +{ + return ioread32(chip->rtsx->remap_addr + reg); +} + +static inline void rtsx_writew(struct rtsx_chip *chip, u32 reg, u16 value) +{ + iowrite16(value, chip->rtsx->remap_addr + reg); +} + +static inline u16 rtsx_readw(struct rtsx_chip *chip, u32 reg) +{ + return ioread16(chip->rtsx->remap_addr + reg); +} + +static inline void rtsx_writeb(struct rtsx_chip *chip, u32 reg, u8 value) +{ + iowrite8(value, chip->rtsx->remap_addr + reg); +} + +static inline u8 rtsx_readb(struct rtsx_chip *chip, u32 reg) +{ + return ioread8((chip)->rtsx->remap_addr + reg); +} + +static inline int rtsx_read_config_byte(struct rtsx_chip *chip, int where, u8 *val) +{ + return pci_read_config_byte(chip->rtsx->pci, where, val); +} + +static inline int rtsx_write_config_byte(struct rtsx_chip *chip, int where, u8 val) +{ + return pci_write_config_byte(chip->rtsx->pci, where, val); +} + #endif /* __REALTEK_RTSX_H */ |