Index: sys/compat/linuxkpi/common/include/linux/device.h =================================================================== --- sys/compat/linuxkpi/common/include/linux/device.h +++ sys/compat/linuxkpi/common/include/linux/device.h @@ -49,6 +49,8 @@ enum irqreturn { IRQ_NONE = 0, IRQ_HANDLED, IRQ_WAKE_THREAD, }; typedef enum irqreturn irqreturn_t; +struct device; + struct class { const char *name; struct module *owner; Index: sys/contrib/ncsw/user/env/xx.c =================================================================== --- sys/contrib/ncsw/user/env/xx.c +++ sys/contrib/ncsw/user/env/xx.c @@ -406,7 +406,7 @@ t_Error XX_SetIntr(int irq, t_Isr *f_Isr, t_Handle handle) { - struct device *dev; + device_t dev; struct resource *r; unsigned int flags; int err; @@ -455,7 +455,7 @@ t_Error XX_FreeIntr(int irq) { - struct device *dev; + device_t dev; struct resource *r; r = (struct resource *)irq; Index: sys/contrib/octeon-sdk/cvmx-twsi.c =================================================================== --- sys/contrib/octeon-sdk/cvmx-twsi.c +++ sys/contrib/octeon-sdk/cvmx-twsi.c @@ -85,7 +85,7 @@ resource_size_t twsi_phys; void __iomem *twsi_base; resource_size_t regsize; - struct device *dev; + device_t dev; int broken_irq_mode; }; struct i2c_adapter *adapter; Index: sys/dev/auxio/auxio.c =================================================================== --- sys/dev/auxio/auxio.c +++ sys/dev/auxio/auxio.c @@ -98,7 +98,7 @@ #define AUXIO_PCIO_NREG 5 struct auxio_softc { - struct device *sc_dev; + device_t sc_dev; int sc_nauxio; struct resource *sc_res[AUXIO_PCIO_NREG]; Index: sys/dev/bktr/bktr_os.c =================================================================== --- sys/dev/bktr/bktr_os.c +++ sys/dev/bktr/bktr_os.c @@ -890,9 +890,9 @@ #if defined(__OpenBSD__) static int bktr_probe(struct device *, void *, void *); #else -static int bktr_probe(struct device *, struct cfdata *, void *); +static int bktr_probe(device_t, struct cfdata *, void *); #endif -static void bktr_attach(struct device *, struct device *, void *); +static void bktr_attach(device_t, struct device *, void *); struct cfattach bktr_ca = { sizeof(struct bktr_softc), bktr_probe, bktr_attach @@ -908,7 +908,7 @@ int bktr_probe(parent, match, aux) - struct device *parent; + device_t parent; #if defined(__OpenBSD__) void *match; #else @@ -933,7 +933,7 @@ * the attach routine. */ static void -bktr_attach(struct device *parent, struct device *self, void *aux) +bktr_attach(device_t parent, device_t self, void *aux) { bktr_ptr_t bktr; u_long latency; Index: sys/dev/bktr/bktr_reg.h =================================================================== --- sys/dev/bktr/bktr_reg.h +++ sys/dev/bktr/bktr_reg.h @@ -35,7 +35,7 @@ */ #ifdef __NetBSD__ -#include /* struct device */ +#include /* device_t */ #include #include /* struct selinfo */ # ifdef DEBUG Index: sys/dev/cxgb/common/cxgb_ctl_defs.h =================================================================== --- sys/dev/cxgb/common/cxgb_ctl_defs.h +++ sys/dev/cxgb/common/cxgb_ctl_defs.h @@ -124,7 +124,7 @@ unsigned int udbell_len; /* user doorbell region length */ unsigned long udbell_physbase; /* user doorbell physical start addr */ void *kdb_addr; /* kernel doorbell register address */ - struct device *pdev; /* associated PCI device */ + device_t pdev; /* associated PCI device */ }; /* Index: sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c =================================================================== --- sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c +++ sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c @@ -1094,7 +1094,10 @@ memcpy(dev->ibdev.node_desc, IWCH_NODE_DESC, sizeof(IWCH_NODE_DESC)); dev->ibdev.phys_port_cnt = sc->params.nports; dev->ibdev.num_comp_vectors = 1; +#ifdef __notyet__ + /* confuses linux struct device with the freebsd device_t */ dev->ibdev.dma_device = dev->rdev.adap->dev; +#endif dev->ibdev.query_device = iwch_query_device; dev->ibdev.query_port = iwch_query_port; dev->ibdev.modify_port = iwch_modify_port; Index: sys/dev/cxgbe/iw_cxgbe/provider.c =================================================================== --- sys/dev/cxgbe/iw_cxgbe/provider.c +++ sys/dev/cxgbe/iw_cxgbe/provider.c @@ -429,7 +429,10 @@ strlcpy(ibdev->node_desc, C4IW_NODE_DESC, sizeof(ibdev->node_desc)); ibdev->phys_port_cnt = sc->params.nports; ibdev->num_comp_vectors = 1; +#ifdef __notyet__ + /* The Linux and FreeBSD struct device are not interchangeable */ ibdev->dma_device = sc->dev; +#endif ibdev->query_device = c4iw_query_device; ibdev->query_port = c4iw_query_port; ibdev->modify_port = c4iw_modify_port; Index: sys/dev/e1000/e1000_osdep.h =================================================================== --- sys/dev/e1000/e1000_osdep.h +++ sys/dev/e1000/e1000_osdep.h @@ -134,7 +134,7 @@ bus_space_handle_t io_bus_space_handle; bus_space_tag_t flash_bus_space_tag; bus_space_handle_t flash_bus_space_handle; - struct device *dev; + device_t dev; }; #define E1000_REGISTER(hw, reg) (((hw)->mac.type >= e1000_82543) \ Index: sys/dev/e1000/if_em.h =================================================================== --- sys/dev/e1000/if_em.h +++ sys/dev/e1000/if_em.h @@ -394,7 +394,7 @@ /* FreeBSD operating-system-specific structures. */ struct e1000_osdep osdep; - struct device *dev; + device_t dev; struct cdev *led_dev; struct resource *memory; Index: sys/dev/e1000/if_igb.h =================================================================== --- sys/dev/e1000/if_igb.h +++ sys/dev/e1000/if_igb.h @@ -429,7 +429,7 @@ struct e1000_hw hw; struct e1000_osdep osdep; - struct device *dev; + device_t dev; struct cdev *led_dev; struct resource *pci_mem; Index: sys/dev/e1000/if_lem.h =================================================================== --- sys/dev/e1000/if_lem.h +++ sys/dev/e1000/if_lem.h @@ -298,7 +298,7 @@ /* FreeBSD operating-system-specific structures. */ struct e1000_osdep osdep; - struct device *dev; + device_t dev; struct cdev *led_dev; struct resource *memory; Index: sys/dev/ixgb/if_ixgb.h =================================================================== --- sys/dev/ixgb/if_ixgb.h +++ sys/dev/ixgb/if_ixgb.h @@ -277,7 +277,7 @@ /* FreeBSD operating-system-specific structures */ struct ixgb_osdep osdep; - struct device *dev; + device_t dev; struct resource *res_memory; struct resource *res_ioport; struct resource *res_interrupt; Index: sys/dev/ixgb/if_ixgb_osdep.h =================================================================== --- sys/dev/ixgb/if_ixgb_osdep.h +++ sys/dev/ixgb/if_ixgb_osdep.h @@ -90,7 +90,7 @@ { bus_space_tag_t mem_bus_space_tag; bus_space_handle_t mem_bus_space_handle; - struct device *dev; + device_t dev; }; #define IXGB_WRITE_FLUSH(a) IXGB_READ_REG(a, STATUS) Index: sys/dev/ixgbe/ixgbe.h =================================================================== --- sys/dev/ixgbe/ixgbe.h +++ sys/dev/ixgbe/ixgbe.h @@ -458,7 +458,7 @@ struct ixgbe_hw hw; struct ixgbe_osdep osdep; - struct device *dev; + device_t dev; struct ifnet *ifp; struct resource *pci_mem; Index: sys/dev/ixl/i40e_osdep.h =================================================================== --- sys/dev/ixl/i40e_osdep.h +++ sys/dev/ixl/i40e_osdep.h @@ -153,7 +153,7 @@ bus_space_handle_t mem_bus_space_handle; bus_size_t mem_bus_space_size; uint32_t flush_reg; - struct device *dev; + device_t dev; }; struct i40e_dma_mem { Index: sys/dev/ixl/ixl.h =================================================================== --- sys/dev/ixl/ixl.h +++ sys/dev/ixl/ixl.h @@ -494,7 +494,7 @@ struct ixl_vsi { void *back; struct ifnet *ifp; - struct device *dev; + device_t dev; struct i40e_hw *hw; struct ifmedia media; enum i40e_vsi_type type; Index: sys/dev/ixl/ixl_pf.h =================================================================== --- sys/dev/ixl/ixl_pf.h +++ sys/dev/ixl/ixl_pf.h @@ -59,7 +59,7 @@ struct ixl_pf { struct i40e_hw hw; struct i40e_osdep osdep; - struct device *dev; + device_t dev; struct resource *pci_mem; struct resource *msix_mem; Index: sys/dev/ixl/ixlv.h =================================================================== --- sys/dev/ixl/ixlv.h +++ sys/dev/ixl/ixlv.h @@ -101,7 +101,7 @@ struct ixlv_sc { struct i40e_hw hw; struct i40e_osdep osdep; - struct device *dev; + device_t dev; struct resource *pci_mem; struct resource *msix_mem; Index: sys/dev/netmap/netmap_mem2.c =================================================================== --- sys/dev/netmap/netmap_mem2.c +++ sys/dev/netmap/netmap_mem2.c @@ -201,7 +201,7 @@ static int netmap_mem_map(struct netmap_obj_pool *, struct netmap_adapter *); static int netmap_mem_unmap(struct netmap_obj_pool *, struct netmap_adapter *); -static int nm_mem_assign_group(struct netmap_mem_d *, struct device *); +static int nm_mem_assign_group(struct netmap_mem_d *, device_t); #define NMA_LOCK_INIT(n) NM_MTX_INIT((n)->nm_mtx) #define NMA_LOCK_DESTROY(n) NM_MTX_DESTROY((n)->nm_mtx) @@ -456,7 +456,7 @@ } static int -nm_mem_assign_group(struct netmap_mem_d *nmd, struct device *dev) +nm_mem_assign_group(struct netmap_mem_d *nmd, device_t dev) { int err = 0, id; id = nm_iommu_group_id(dev); Index: sys/dev/pci/pcivar.h =================================================================== --- sys/dev/pci/pcivar.h +++ sys/dev/pci/pcivar.h @@ -174,7 +174,7 @@ /* config header information common to all header types */ typedef struct pcicfg { - struct device *dev; /* device which owns this */ + device_t dev; /* device which owns this */ STAILQ_HEAD(, pci_map) maps; /* BARs */ Index: sys/dev/pms/freebsd/driver/common/lxencrypt.h =================================================================== --- sys/dev/pms/freebsd/driver/common/lxencrypt.h +++ sys/dev/pms/freebsd/driver/common/lxencrypt.h @@ -81,14 +81,14 @@ #ifdef ENCRYPT_ENHANCE -ssize_t set_dek_table_entry0(struct device *dev, struct device_attribute *attr, const char *buf, size_t len); -ssize_t show_dek_table_entry0(struct device *dev, struct device_attribute *attr, char *buf); -ssize_t set_dek_table_entry1(struct device *dev, struct device_attribute *attr, const char *buf, size_t len); -ssize_t show_dek_table_entry1(struct device *dev, struct device_attribute *attr, char *buf); -ssize_t show_kek_table(struct device *dev, struct device_attribute *attr, char *buf); -ssize_t show_dek_kek_map0(struct device *dev, struct device_attribute *attr, char *buf); -ssize_t show_dek_kek_map1(struct device *dev, struct device_attribute *attr, char *buf); -ssize_t show_target_dek_map(struct device *dev, struct device_attribute *attr, char *buf); +ssize_t set_dek_table_entry0(device_t dev, struct device_attribute *attr, const char *buf, size_t len); +ssize_t show_dek_table_entry0(device_t dev, struct device_attribute *attr, char *buf); +ssize_t set_dek_table_entry1(device_t dev, struct device_attribute *attr, const char *buf, size_t len); +ssize_t show_dek_table_entry1(device_t dev, struct device_attribute *attr, char *buf); +ssize_t show_kek_table(device_t dev, struct device_attribute *attr, char *buf); +ssize_t show_dek_kek_map0(device_t dev, struct device_attribute *attr, char *buf); +ssize_t show_dek_kek_map1(device_t dev, struct device_attribute *attr, char *buf); +ssize_t show_target_dek_map(device_t dev, struct device_attribute *attr, char *buf); #endif int agtiapi_SetupEncryption(struct agtiapi_softc *pCard); Index: sys/dev/sound/sbus/cs4231.c =================================================================== --- sys/dev/sound/sbus/cs4231.c +++ sys/dev/sound/sbus/cs4231.c @@ -113,7 +113,7 @@ #define CS4231_RES_MEM_MAX 4 #define CS4231_RES_IRQ_MAX 2 struct cs4231_softc { - struct device *sc_dev; + device_t sc_dev; int sc_rid[CS4231_RES_MEM_MAX]; struct resource *sc_res[CS4231_RES_MEM_MAX]; bus_space_handle_t sc_regh[CS4231_RES_MEM_MAX]; Index: sys/dev/tpm/tpm.c =================================================================== --- sys/dev/tpm/tpm.c +++ sys/dev/tpm/tpm.c @@ -175,8 +175,8 @@ NULL, "tpm", DV_DULL }; -int tpm_match(struct device *, void *, void *); -void tpm_attach(struct device *, struct device *, void *); +int tpm_match(device_t , void *, void *); +void tpm_attach(device_t , device_t , void *); struct cfattach tpm_ca = { sizeof(struct tpm_softc), tpm_match, tpm_attach @@ -337,7 +337,7 @@ * OpenBSD specific code for probing and attaching TPM to device tree. */ int -tpm_match(struct device *parent, void *match, void *aux) +tpm_match(device_t parent, void *match, void *aux) { struct isa_attach_args *ia = aux; struct cfdata *cf = match; @@ -370,7 +370,7 @@ } void -tpm_attach(struct device *parent, struct device *self, void *aux) +tpm_attach(device_t parent, device_t self, void *aux) { struct tpm_softc *sc = (struct tpm_softc *)self; struct isa_attach_args *ia = aux; Index: sys/kern/subr_bus.c =================================================================== --- sys/kern/subr_bus.c +++ sys/kern/subr_bus.c @@ -84,7 +84,7 @@ */ typedef TAILQ_HEAD(devclass_list, devclass) devclass_list_t; typedef TAILQ_HEAD(driver_list, driverlink) driver_list_t; -typedef TAILQ_HEAD(device_list, device) device_list_t; +typedef TAILQ_HEAD(device_list, device_) device_list_t; struct devclass { TAILQ_ENTRY(devclass) link; @@ -103,7 +103,7 @@ /** * @brief Implementation of device. */ -struct device { +struct device_ { /* * A device is a kernel object. The first field must be the * current ops table for the object. @@ -113,8 +113,8 @@ /* * Device hierarchy. */ - TAILQ_ENTRY(device) link; /**< list of devices in parent */ - TAILQ_ENTRY(device) devlink; /**< global device list membership */ + TAILQ_ENTRY(device_) link; /**< list of devices in parent */ + TAILQ_ENTRY(device_) devlink; /**< global device list membership */ device_t parent; /**< parent of this device */ device_list_t children; /**< list of child devices */ @@ -875,7 +875,7 @@ /* End of /dev/devctl code */ -static TAILQ_HEAD(,device) bus_data_devices; +static TAILQ_HEAD(,device_) bus_data_devices; static int bus_data_generation = 1; static kobj_method_t null_methods[] = { @@ -1794,7 +1794,7 @@ dc = NULL; } - dev = malloc(sizeof(struct device), M_BUS, M_NOWAIT|M_ZERO); + dev = malloc(sizeof(struct device_), M_BUS, M_NOWAIT|M_ZERO); if (!dev) return (NULL); @@ -5278,7 +5278,7 @@ int *name = (int *)arg1; u_int namelen = arg2; int index; - struct device *dev; + device_t dev; struct u_device udev; /* XXX this is a bit big */ int error; Index: sys/mips/nlm/dev/net/xlpge.c =================================================================== --- sys/mips/nlm/dev/net/xlpge.c +++ sys/mips/nlm/dev/net/xlpge.c @@ -175,8 +175,8 @@ static int nlm_xlpge_shutdown(device_t); /* mii override functions */ -static int nlm_xlpge_mii_read(struct device *, int, int); -static int nlm_xlpge_mii_write(struct device *, int, int, int); +static int nlm_xlpge_mii_read(device_t , int, int); +static int nlm_xlpge_mii_write(device_t , int, int, int); static void nlm_xlpge_mii_statchg(device_t); static device_method_t nlm_xlpge_methods[] = { @@ -1290,7 +1290,7 @@ * miibus function with custom implementation */ static int -nlm_xlpge_mii_read(struct device *dev, int phyaddr, int regidx) +nlm_xlpge_mii_read(device_t dev, int phyaddr, int regidx) { struct nlm_xlpge_softc *sc; int val; @@ -1306,7 +1306,7 @@ } static int -nlm_xlpge_mii_write(struct device *dev, int phyaddr, int regidx, int val) +nlm_xlpge_mii_write(device_t dev, int phyaddr, int regidx, int val) { struct nlm_xlpge_softc *sc; Index: sys/mips/rmi/dev/nlge/if_nlge.c =================================================================== --- sys/mips/rmi/dev/nlge/if_nlge.c +++ sys/mips/rmi/dev/nlge/if_nlge.c @@ -140,8 +140,8 @@ static int nlge_tx(struct ifnet *ifp, struct mbuf *m); static void nlge_rx(struct nlge_softc *sc, vm_paddr_t paddr, int len); -static int nlge_mii_write(struct device *, int, int, int); -static int nlge_mii_read(struct device *, int, int); +static int nlge_mii_write(device_t , int, int, int); +static int nlge_mii_read(device_t , int, int); static void nlge_mac_mii_statchg(device_t); static int nlge_mediachange(struct ifnet *ifp); static void nlge_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr); @@ -831,7 +831,7 @@ } static int -nlge_mii_write(struct device *dev, int phyaddr, int regidx, int regval) +nlge_mii_write(device_t dev, int phyaddr, int regidx, int regval) { struct nlge_softc *sc; @@ -843,7 +843,7 @@ } static int -nlge_mii_read(struct device *dev, int phyaddr, int regidx) +nlge_mii_read(device_t dev, int phyaddr, int regidx) { struct nlge_softc *sc; int val; Index: sys/ofed/include/rdma/peer_mem.h =================================================================== --- sys/ofed/include/rdma/peer_mem.h +++ sys/ofed/include/rdma/peer_mem.h @@ -43,6 +43,7 @@ #define IB_PEER_MEMORY_NAME_MAX 64 #define IB_PEER_MEMORY_VER_MAX 16 +struct device; struct peer_memory_client { char name[IB_PEER_MEMORY_NAME_MAX]; char version[IB_PEER_MEMORY_VER_MAX]; Index: sys/sys/pcpu.h =================================================================== --- sys/sys/pcpu.h +++ sys/sys/pcpu.h @@ -160,7 +160,7 @@ struct lock_list_entry *pc_spinlocks; struct vmmeter pc_cnt; /* VM stats counters */ long pc_cp_time[CPUSTATES]; /* statclock ticks */ - struct device *pc_device; + struct device_ *pc_device; void *pc_netisr; /* netisr SWI cookie */ int pc_unused1; /* unused field */ int pc_domain; /* Memory domain. */ Index: sys/sys/rman.h =================================================================== --- sys/sys/rman.h +++ sys/sys/rman.h @@ -127,7 +127,7 @@ bus_space_handle_t rman_get_bushandle(struct resource *); bus_space_tag_t rman_get_bustag(struct resource *); rman_res_t rman_get_end(struct resource *); -struct device *rman_get_device(struct resource *); +device_t rman_get_device(struct resource *); u_int rman_get_flags(struct resource *); void rman_get_mapping(struct resource *, struct resource_map *); int rman_get_rid(struct resource *); @@ -145,13 +145,13 @@ int rman_release_resource(struct resource *r); struct resource *rman_reserve_resource(struct rman *rm, rman_res_t start, rman_res_t end, rman_res_t count, - u_int flags, struct device *dev); + u_int flags, device_t dev); struct resource *rman_reserve_resource_bound(struct rman *rm, rman_res_t start, rman_res_t end, rman_res_t count, rman_res_t bound, - u_int flags, struct device *dev); + u_int flags, device_t dev); void rman_set_bushandle(struct resource *_r, bus_space_handle_t _h); void rman_set_bustag(struct resource *_r, bus_space_tag_t _t); -void rman_set_device(struct resource *_r, struct device *_dev); +void rman_set_device(struct resource *_r, device_t _dev); void rman_set_end(struct resource *_r, rman_res_t _end); void rman_set_mapping(struct resource *, struct resource_map *); void rman_set_rid(struct resource *_r, int _rid); Index: sys/sys/types.h =================================================================== --- sys/sys/types.h +++ sys/sys/types.h @@ -259,7 +259,7 @@ #ifdef _KERNEL typedef int boolean_t; -typedef struct device *device_t; +typedef struct device_ *device_t; typedef __intfptr_t intfptr_t; /*