src: Get rid of device_t

Use of device_t is deprecated.

Change-Id: Ie05869901ac33d7089e21110f46c1241f7ee731f
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/30047
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Elyes HAOUAS 2018-12-05 11:03:36 +01:00 committed by Kyösti Mälkki
commit f9e47cc4c2
9 changed files with 65 additions and 40 deletions

View file

@ -14,14 +14,9 @@
#include <rules.h>
#include <device/resource.h>
#include <device/path.h>
struct device;
#ifndef __SIMPLE_DEVICE__
typedef struct device *device_t;
#endif
#include <arch/io.h>
struct device;
struct pci_operations;
struct pci_bus_operations;
struct i2c_bus_operations;

View file

@ -15,33 +15,49 @@ void pci_write_config32(struct device *dev, unsigned int where, u32 val);
#endif
/*
* Use device_t here as the functions are to be used with either
* __SIMPLE_DEVICE__ defined or undefined.
*/
#ifdef __SIMPLE_DEVICE__
static __always_inline
void pci_or_config8(device_t dev, unsigned int where, u8 ormask)
void pci_or_config8(pci_devfn_t dev, unsigned int where, u8 ormask)
#else
static __always_inline
void pci_or_config8(struct device *dev, unsigned int where, u8 ormask)
#endif
{
u8 value = pci_read_config8(dev, where);
pci_write_config8(dev, where, value | ormask);
}
#ifdef __SIMPLE_DEVICE__
static __always_inline
void pci_or_config16(device_t dev, unsigned int where, u16 ormask)
void pci_or_config16(pci_devfn_t dev, unsigned int where, u16 ormask)
#else
static __always_inline
void pci_or_config16(struct device *dev, unsigned int where, u16 ormask)
#endif
{
u16 value = pci_read_config16(dev, where);
pci_write_config16(dev, where, value | ormask);
}
#ifdef __SIMPLE_DEVICE__
static __always_inline
void pci_or_config32(device_t dev, unsigned int where, u32 ormask)
void pci_or_config32(pci_devfn_t dev, unsigned int where, u32 ormask)
#else
static __always_inline
void pci_or_config32(struct device *dev, unsigned int where, u32 ormask)
#endif
{
u32 value = pci_read_config32(dev, where);
pci_write_config32(dev, where, value | ormask);
}
#ifdef __SIMPLE_DEVICE__
static __always_inline
void pci_update_config8(device_t dev, int reg, u8 mask, u8 or)
void pci_update_config8(pci_devfn_t dev, int reg, u8 mask, u8 or)
#else
static __always_inline
void pci_update_config8(struct device *dev, int reg, u8 mask, u8 or)
#endif
{
u8 reg8;
@ -51,8 +67,13 @@ void pci_update_config8(device_t dev, int reg, u8 mask, u8 or)
pci_write_config8(dev, reg, reg8);
}
#ifdef __SIMPLE_DEVICE__
static __always_inline
void pci_update_config16(device_t dev, int reg, u16 mask, u16 or)
void pci_update_config16(pci_devfn_t dev, int reg, u16 mask, u16 or)
#else
static __always_inline
void pci_update_config16(struct device *dev, int reg, u16 mask, u16 or)
#endif
{
u16 reg16;
@ -62,8 +83,13 @@ void pci_update_config16(device_t dev, int reg, u16 mask, u16 or)
pci_write_config16(dev, reg, reg16);
}
#ifdef __SIMPLE_DEVICE__
static __always_inline
void pci_update_config32(device_t dev, int reg, u32 mask, u32 or)
void pci_update_config32(pci_devfn_t dev, int reg, u32 mask, u32 or)
#else
static __always_inline
void pci_update_config32(struct device *dev, int reg, u32 mask, u32 or)
#endif
{
u32 reg32;

View file

@ -51,8 +51,8 @@ static inline int smbus_write_byte(struct device *const dev, u8 addr, u8 val)
return i2c_dev_writeb_at(dev, addr, val);
}
int smbus_block_read(device_t dev, u8 cmd, u8 bytes, u8 *buffer);
int smbus_block_write(device_t dev, u8 cmd, u8 bytes, const u8 *buffer);
int smbus_block_read(struct device *dev, u8 cmd, u8 bytes, u8 *buffer);
int smbus_block_write(struct device *dev, u8 cmd, u8 bytes, const u8 *buffer);
#if IS_ENABLED(CONFIG_SMBUS_HAS_AUX_CHANNELS)
void smbus_switch_to_channel(uint8_t channel_number);