linuxkpi whitespace cleanup

Reviewed by:	hselasky, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D14807
This commit is contained in:
Ed Maste 2018-03-23 15:50:01 +00:00
parent 68478431e0
commit 8363051739
39 changed files with 243 additions and 247 deletions

View File

@ -87,7 +87,7 @@
static inline void
be16_add_cpu(uint16_t *var, uint16_t val)
{
{
*var = cpu_to_be16(be16_to_cpu(*var) + val);
}

View File

@ -54,7 +54,7 @@
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
#define GENMASK(h, l) (((~0UL) >> (BITS_PER_LONG - (h) - 1)) & ((~0UL) << (l)))
#define GENMASK_ULL(h, l) (((~0ULL) >> (BITS_PER_LONG_LONG - (h) - 1)) & ((~0ULL) << (l)))
#define BITS_PER_BYTE 8
#define BITS_PER_BYTE 8
#define hweight8(x) bitcount((uint8_t)(x))
#define hweight16(x) bitcount16(x)

View File

@ -112,7 +112,7 @@ cdev_add_ext(struct linux_cdev *cdev, dev_t dev, uid_t uid, gid_t gid, int mode)
int error;
cdev->dev = dev;
/* Setup arguments for make_dev_s() */
make_dev_args_init(&args);
args.mda_devsw = &linuxcdevsw;

View File

@ -84,7 +84,7 @@
#define __PASTE(a,b) ___PASTE(a,b)
#define ACCESS_ONCE(x) (*(volatile __typeof(x) *)&(x))
#define WRITE_ONCE(x,v) do { \
barrier(); \
ACCESS_ONCE(x) = (v); \

View File

@ -124,10 +124,10 @@ extern const struct kobj_type linux_dev_ktype;
extern const struct kobj_type linux_class_ktype;
struct class_attribute {
struct attribute attr;
ssize_t (*show)(struct class *, struct class_attribute *, char *);
ssize_t (*store)(struct class *, struct class_attribute *, const char *, size_t);
const void *(*namespace)(struct class *, const struct class_attribute *);
struct attribute attr;
ssize_t (*show)(struct class *, struct class_attribute *, char *);
ssize_t (*store)(struct class *, struct class_attribute *, const char *, size_t);
const void *(*namespace)(struct class *, const struct class_attribute *);
};
#define CLASS_ATTR(_name, _mode, _show, _store) \
@ -223,7 +223,7 @@ static inline char *
dev_name(const struct device *dev)
{
return kobject_name(&dev->kobj);
return kobject_name(&dev->kobj);
}
#define dev_set_name(_dev, _fmt, ...) \
@ -533,7 +533,7 @@ class_remove_file(struct class *class, const struct class_attribute *attr)
static inline int
dev_to_node(struct device *dev)
{
return -1;
return -1;
}
char *kvasprintf(gfp_t, const char *, va_list);

View File

@ -38,7 +38,7 @@ enum dma_attr { DMA_ATTR_WRITE_BARRIER, DMA_ATTR_WEAK_ORDERING, DMA_ATTR_MAX, };
struct dma_attrs {
unsigned long flags;
};
#define DEFINE_DMA_ATTRS(x) struct dma_attrs x = { }
static inline void

View File

@ -97,7 +97,7 @@ dma_supported(struct device *dev, u64 mask)
/* XXX busdma takes care of this elsewhere. */
return (1);
}
static inline int
dma_set_mask(struct device *dev, u64 dma_mask)
{
@ -150,7 +150,7 @@ dma_zalloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
return (dma_alloc_coherent(dev, size, dma_handle, flag | __GFP_ZERO));
}
static inline void
dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
dma_addr_t dma_handle)
@ -180,7 +180,7 @@ dma_map_sg_attrs(struct device *dev, struct scatterlist *sgl, int nents,
{
struct scatterlist *sg;
int i;
for_each_sg(sgl, sg, nents, i)
sg_dma_address(sg) = sg_phys(sg);
@ -192,7 +192,7 @@ dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg, int nents,
enum dma_data_direction dir, struct dma_attrs *attrs)
{
}
static inline dma_addr_t
dma_map_page(struct device *dev, struct page *page,
unsigned long offset, size_t size, enum dma_data_direction direction)
@ -258,9 +258,9 @@ dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
}
static inline unsigned int dma_set_max_seg_size(struct device *dev,
unsigned int size)
unsigned int size)
{
return (0);
return (0);
}

View File

@ -70,10 +70,10 @@ ERR_CAST(void *ptr)
static inline int
PTR_ERR_OR_ZERO(const void *ptr)
{
if (IS_ERR(ptr))
return PTR_ERR(ptr);
else
return 0;
if (IS_ERR(ptr))
return PTR_ERR(ptr);
else
return 0;
}
#define PTR_RET(p) PTR_ERR_OR_ZERO(p)

View File

@ -35,13 +35,13 @@
#define ECHRNG EDOM
#define ETIME ETIMEDOUT
#define ECOMM ESTALE
#define ENODATA ECONNREFUSED
#define ECOMM ESTALE
#define ENODATA ECONNREFUSED
#define ENOIOCTLCMD ENOIOCTL
/* Use same value as Linux, because BSD's ERESTART is negative */
#define ERESTARTSYS 512
#define ENOTSUPP EOPNOTSUPP
#define ENONET EHOSTDOWN
#define ENOTSUPP EOPNOTSUPP
#define ENONET EHOSTDOWN
#define ERESTARTNOINTR 513
#define ERESTARTNOHAND 514

View File

@ -51,31 +51,31 @@ struct ethtool_modinfo {
u32 eeprom_len;
};
static inline bool
static inline bool
is_zero_ether_addr(const u8 * addr)
{
return ((addr[0] + addr[1] + addr[2] + addr[3] + addr[4] + addr[5]) == 0x00);
}
static inline bool
static inline bool
is_multicast_ether_addr(const u8 * addr)
{
return (0x01 & addr[0]);
}
static inline bool
static inline bool
is_broadcast_ether_addr(const u8 * addr)
{
return ((addr[0] + addr[1] + addr[2] + addr[3] + addr[4] + addr[5]) == (6 * 0xff));
}
static inline bool
static inline bool
is_valid_ether_addr(const u8 * addr)
{
return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr);
}
static inline void
static inline void
ether_addr_copy(u8 * dst, const u8 * src)
{
memcpy(dst, src, 6);

View File

@ -82,7 +82,7 @@ struct linux_file_wait_queue {
struct linux_file {
struct file *_file;
const struct file_operations *f_op;
void *private_data;
void *private_data;
int f_flags;
int f_mode; /* Just starting mode. */
struct dentry *f_dentry;
@ -140,7 +140,7 @@ struct file_operations {
int (*fasync)(int, struct file *, int);
/* Although not supported in FreeBSD, to align with Linux code
* we are adding llseek() only when it is mapped to no_llseek which returns
* we are adding llseek() only when it is mapped to no_llseek which returns
* an illegal seek error
*/
loff_t (*llseek)(struct file *, loff_t, int);
@ -270,7 +270,7 @@ iput(struct inode *inode)
vrele(inode);
}
static inline loff_t
static inline loff_t
no_llseek(struct file *file, loff_t offset, int whence)
{

View File

@ -96,7 +96,7 @@ int idr_for_each(struct idr *idp, int (*fn)(int id, void *p, void *data), void *
#define IDA_CHUNK_SIZE 128 /* 128 bytes per chunk */
#define IDA_BITMAP_LONGS (IDA_CHUNK_SIZE / sizeof(long) - 1)
#define IDA_BITMAP_BITS (IDA_BITMAP_LONGS * sizeof(long) * 8)
#define IDA_BITMAP_BITS (IDA_BITMAP_LONGS * sizeof(long) * 8)
struct ida_bitmap {
long nr_busy;

View File

@ -35,17 +35,17 @@
#include <net/ethernet.h>
#define ETH_HLEN ETHER_HDR_LEN /* Total octets in header. */
#define ETH_HLEN ETHER_HDR_LEN /* Total octets in header. */
#ifndef ETH_ALEN
#define ETH_ALEN ETHER_ADDR_LEN
#define ETH_ALEN ETHER_ADDR_LEN
#endif
#define ETH_FCS_LEN 4 /* Octets in the FCS */
#define VLAN_HLEN 4 /* The additional bytes (on top of the Ethernet header)
* that VLAN requires. */
#define ETH_FCS_LEN 4 /* Octets in the FCS */
#define VLAN_HLEN 4 /* The additional bytes (on top of the Ethernet header)
* that VLAN requires. */
/*
* defined Ethernet Protocol ID's.
*/
#define ETH_P_IP ETHERTYPE_IP
#define ETH_P_IP ETHERTYPE_IP
#define ETH_P_IPV6 ETHERTYPE_IPV6
#define ETH_P_MPLS_UC ETHERTYPE_MPLS
#define ETH_P_MPLS_MC ETHERTYPE_MPLS_MCAST

View File

@ -39,7 +39,7 @@
#include <net/if_vlan_var.h>
#include <net/if_types.h>
#define VLAN_N_VID 4096
#define VLAN_N_VID 4096
static inline int
is_vlan_dev(struct ifnet *ifp)

View File

@ -71,7 +71,7 @@ __raw_writeq(uint64_t b, volatile void *addr)
static inline void
writel(uint32_t b, void *addr)
{
*(volatile uint32_t *)addr = b;
*(volatile uint32_t *)addr = b;
}
#undef writel_relaxed
@ -85,21 +85,21 @@ writel_relaxed(uint32_t b, void *addr)
static inline void
writeq(uint64_t b, void *addr)
{
*(volatile uint64_t *)addr = b;
*(volatile uint64_t *)addr = b;
}
#undef writeb
static inline void
writeb(uint8_t b, void *addr)
{
*(volatile uint8_t *)addr = b;
*(volatile uint8_t *)addr = b;
}
#undef writew
static inline void
writew(uint16_t b, void *addr)
{
*(volatile uint16_t *)addr = b;
*(volatile uint16_t *)addr = b;
}
#undef ioread8

View File

@ -38,7 +38,7 @@
#include <sys/kernel.h>
#include <sys/limits.h>
#define jiffies ticks
#define jiffies ticks
#define jiffies_64 ticks
#define jiffies_to_msecs(x) (((int64_t)(int)(x)) * 1000 / hz)

View File

@ -49,7 +49,7 @@
#include <linux/sched.h>
#include <linux/types.h>
#include <linux/jiffies.h>
#include <linux/log2.h>
#include <linux/log2.h>
#include <asm/byteorder.h>
#include <machine/stdarg.h>
@ -170,12 +170,12 @@ scnprintf(char *buf, size_t size, const char *fmt, ...)
*/
#ifdef DEBUG
#define pr_debug(fmt, ...) \
log(LOG_DEBUG, fmt, ##__VA_ARGS__)
log(LOG_DEBUG, fmt, ##__VA_ARGS__)
#define pr_devel(fmt, ...) \
log(LOG_DEBUG, pr_fmt(fmt), ##__VA_ARGS__)
#else
#define pr_debug(fmt, ...) \
({ if (0) log(LOG_DEBUG, fmt, ##__VA_ARGS__); 0; })
({ if (0) log(LOG_DEBUG, fmt, ##__VA_ARGS__); 0; })
#define pr_devel(fmt, ...) \
({ if (0) log(LOG_DEBUG, pr_fmt(fmt), ##__VA_ARGS__); 0; })
#endif
@ -238,19 +238,19 @@ scnprintf(char *buf, size_t size, const char *fmt, ...)
#ifndef WARN
#define WARN(condition, ...) ({ \
bool __ret_warn_on = (condition); \
if (unlikely(__ret_warn_on)) \
pr_warning(__VA_ARGS__); \
unlikely(__ret_warn_on); \
bool __ret_warn_on = (condition); \
if (unlikely(__ret_warn_on)) \
pr_warning(__VA_ARGS__); \
unlikely(__ret_warn_on); \
})
#endif
#ifndef WARN_ONCE
#define WARN_ONCE(condition, ...) ({ \
bool __ret_warn_on = (condition); \
if (unlikely(__ret_warn_on)) \
pr_warn_once(__VA_ARGS__); \
unlikely(__ret_warn_on); \
bool __ret_warn_on = (condition); \
if (unlikely(__ret_warn_on)) \
pr_warn_once(__VA_ARGS__); \
unlikely(__ret_warn_on); \
})
#endif
@ -259,7 +259,7 @@ scnprintf(char *buf, size_t size, const char *fmt, ...)
const __typeof(((type *)0)->member) *__p = (ptr); \
(type *)((uintptr_t)__p - offsetof(type, member)); \
})
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#define u64_to_user_ptr(val) ((void *)(uintptr_t)(val))
@ -412,7 +412,7 @@ extern bool linux_cpu_has_clflush;
#endif
typedef struct pm_message {
int event;
int event;
} pm_message_t;
/* Swap values of a and b */

View File

@ -41,7 +41,7 @@
#define request_module(...) \
({\
char modname[128]; \
int fileid; \
int fileid; \
snprintf(modname, sizeof(modname), __VA_ARGS__); \
kern_kldload(curthread, modname, &fileid); \
})

View File

@ -61,17 +61,17 @@ struct kobject {
extern struct kobject *mm_kobj;
struct attribute {
const char *name;
const char *name;
struct module *owner;
mode_t mode;
};
struct kobj_attribute {
struct attribute attr;
ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr,
char *buf);
ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr,
const char *buf, size_t count);
struct attribute attr;
ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr,
char *buf);
ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr,
const char *buf, size_t count);
};
static inline void

View File

@ -40,8 +40,8 @@
/* time values in nanoseconds */
typedef s64 ktime_t;
#define KTIME_MAX ((s64)~((u64)1 << 63))
#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC)
#define KTIME_MAX ((s64)~((u64)1 << 63))
#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC)
static inline int64_t
ktime_to_ns(ktime_t kt)

View File

@ -93,7 +93,7 @@ INIT_LIST_HEAD(struct list_head *list)
list->next = list->prev = list;
}
static inline int
list_empty(const struct list_head *head)
{
@ -159,7 +159,7 @@ linux_list_add(struct list_head *new, struct list_head *prev,
static inline void
list_del_init(struct list_head *entry)
{
{
list_del(entry);
INIT_LIST_HEAD(entry);
@ -167,8 +167,8 @@ list_del_init(struct list_head *entry)
#define list_entry(ptr, type, field) container_of(ptr, type, field)
#define list_first_entry(ptr, type, member) \
list_entry((ptr)->next, type, member)
#define list_first_entry(ptr, type, member) \
list_entry((ptr)->next, type, member)
#define list_last_entry(ptr, type, member) \
list_entry((ptr)->prev, type, member)
@ -196,7 +196,7 @@ list_del_init(struct list_head *entry)
p = list_entry((p)->field.next, typeof(*p), field))
#define list_for_each_entry_safe(p, n, h, field) \
for (p = list_entry((h)->next, typeof(*p), field), \
for (p = list_entry((h)->next, typeof(*p), field), \
n = list_entry((p)->field.next, typeof(*p), field); &(p)->field != (h);\
p = n, n = list_entry(n->field.next, typeof(*n), field))
@ -208,7 +208,7 @@ list_del_init(struct list_head *entry)
for (p = list_next_entry((p), field); &(p)->field != (h); \
p = list_next_entry((p), field))
#define list_for_each_entry_safe_from(pos, n, head, member) \
#define list_for_each_entry_safe_from(pos, n, head, member) \
for (n = list_entry((pos)->member.next, typeof(*pos), member); \
&(pos)->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
@ -218,7 +218,7 @@ list_del_init(struct list_head *entry)
p = list_entry((p)->field.prev, typeof(*p), field))
#define list_for_each_entry_safe_reverse(p, n, h, field) \
for (p = list_entry((h)->prev, typeof(*p), field), \
for (p = list_entry((h)->prev, typeof(*p), field), \
n = list_entry((p)->field.prev, typeof(*p), field); &(p)->field != (h); \
p = n, n = list_entry(n->field.prev, typeof(*n), field))
@ -259,7 +259,7 @@ list_move_tail(struct list_head *entry, struct list_head *head)
}
static inline void
linux_list_splice(const struct list_head *list, struct list_head *prev,
linux_list_splice(const struct list_head *list, struct list_head *prev,
struct list_head *next)
{
struct list_head *first;
@ -280,7 +280,7 @@ list_splice(const struct list_head *list, struct list_head *head)
{
linux_list_splice(list, head, head->next);
}
}
static inline void
list_splice_tail(struct list_head *list, struct list_head *head)
@ -288,15 +288,15 @@ list_splice_tail(struct list_head *list, struct list_head *head)
linux_list_splice(list, head->prev, head);
}
static inline void
list_splice_init(struct list_head *list, struct list_head *head)
{
linux_list_splice(list, head, head->next);
INIT_LIST_HEAD(list);
INIT_LIST_HEAD(list);
}
static inline void
list_splice_tail_init(struct list_head *list, struct list_head *head)
{
@ -344,9 +344,9 @@ static inline void
hlist_del(struct hlist_node *n)
{
if (n->next)
n->next->pprev = n->pprev;
*n->pprev = n->next;
if (n->next)
n->next->pprev = n->pprev;
*n->pprev = n->next;
}
static inline void
@ -379,7 +379,7 @@ hlist_add_before(struct hlist_node *n, struct hlist_node *next)
next->pprev = &n->next;
*(n->pprev) = n;
}
static inline void
hlist_add_after(struct hlist_node *n, struct hlist_node *next)
{
@ -390,7 +390,7 @@ hlist_add_after(struct hlist_node *n, struct hlist_node *next)
if (next->next)
next->next->pprev = &next->next;
}
static inline void
hlist_move_list(struct hlist_head *old, struct hlist_head *new)
{
@ -433,11 +433,11 @@ static inline void list_cut_position(struct list_head *list,
}
static inline int list_is_last(const struct list_head *list,
const struct list_head *head)
const struct list_head *head)
{
return list->next == head;
return list->next == head;
}
#define hlist_entry(ptr, type, field) container_of(ptr, type, field)
#define hlist_for_each(p, head) \

View File

@ -50,7 +50,7 @@ is_power_of_2(unsigned long n)
static inline unsigned long
rounddown_pow_of_two(unsigned long x)
{
return (1UL << (flsl(x) - 1));
return (1UL << (flsl(x) - 1));
}
#define ilog2(n) \

View File

@ -59,7 +59,7 @@ misc_register(struct miscdevice *misc)
misc->cdev->owner = THIS_MODULE;
misc->cdev->ops = misc->fops;
kobject_set_name(&misc->cdev->kobj, misc->name);
if (cdev_add(misc->cdev, misc->this_device->devt, 1))
if (cdev_add(misc->cdev, misc->this_device->devt, 1))
return -EINVAL;
return (0);
}

View File

@ -116,7 +116,7 @@ mutex_is_owned(mutex_t *m)
#ifdef WITNESS_ALL
/* NOTE: the maximum WITNESS name is 64 chars */
#define __mutex_name(name, file, line) \
(((const char *){file ":" #line "-" name}) + \
(((const char *){file ":" #line "-" name}) + \
(sizeof(file) > 16 ? sizeof(file) - 16 : 0))
#else
#define __mutex_name(name, file, line) name

View File

@ -96,8 +96,8 @@ struct pci_device_id {
#define PCI_SUBDEVICE_ID_QEMU 0x1100
#define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07))
#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
#define PCI_FUNC(devfn) ((devfn) & 0x07)
#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
#define PCI_FUNC(devfn) ((devfn) & 0x07)
#define PCI_VDEVICE(_vendor, _device) \
.vendor = PCI_VENDOR_ID_##_vendor, .device = (_device), \
@ -467,7 +467,7 @@ pci_find_capability(struct pci_dev *pdev, int capid)
static inline int pci_pcie_cap(struct pci_dev *dev)
{
return pci_find_capability(dev, PCI_CAP_ID_EXP);
return pci_find_capability(dev, PCI_CAP_ID_EXP);
}
@ -598,12 +598,12 @@ pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries,
static inline int pci_channel_offline(struct pci_dev *pdev)
{
return false;
return false;
}
static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
{
return -ENODEV;
return -ENODEV;
}
static inline void pci_disable_sriov(struct pci_dev *dev)
{
@ -666,169 +666,167 @@ typedef unsigned int __bitwise pci_channel_state_t;
typedef unsigned int __bitwise pci_ers_result_t;
enum pci_channel_state {
pci_channel_io_normal = 1,
pci_channel_io_frozen = 2,
pci_channel_io_perm_failure = 3,
pci_channel_io_normal = 1,
pci_channel_io_frozen = 2,
pci_channel_io_perm_failure = 3,
};
enum pci_ers_result {
PCI_ERS_RESULT_NONE = 1,
PCI_ERS_RESULT_CAN_RECOVER = 2,
PCI_ERS_RESULT_NEED_RESET = 3,
PCI_ERS_RESULT_DISCONNECT = 4,
PCI_ERS_RESULT_RECOVERED = 5,
PCI_ERS_RESULT_NONE = 1,
PCI_ERS_RESULT_CAN_RECOVER = 2,
PCI_ERS_RESULT_NEED_RESET = 3,
PCI_ERS_RESULT_DISCONNECT = 4,
PCI_ERS_RESULT_RECOVERED = 5,
};
/* PCI bus error event callbacks */
struct pci_error_handlers {
pci_ers_result_t (*error_detected)(struct pci_dev *dev,
enum pci_channel_state error);
pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev);
pci_ers_result_t (*link_reset)(struct pci_dev *dev);
pci_ers_result_t (*slot_reset)(struct pci_dev *dev);
void (*resume)(struct pci_dev *dev);
pci_ers_result_t (*error_detected)(struct pci_dev *dev,
enum pci_channel_state error);
pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev);
pci_ers_result_t (*link_reset)(struct pci_dev *dev);
pci_ers_result_t (*slot_reset)(struct pci_dev *dev);
void (*resume)(struct pci_dev *dev);
};
/* FreeBSD does not support SRIOV - yet */
static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
{
return dev;
return dev;
}
static inline bool pci_is_pcie(struct pci_dev *dev)
{
return !!pci_pcie_cap(dev);
return !!pci_pcie_cap(dev);
}
static inline u16 pcie_flags_reg(struct pci_dev *dev)
{
int pos;
u16 reg16;
int pos;
u16 reg16;
pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
if (!pos)
return 0;
pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
if (!pos)
return 0;
pci_read_config_word(dev, pos + PCI_EXP_FLAGS, &reg16);
pci_read_config_word(dev, pos + PCI_EXP_FLAGS, &reg16);
return reg16;
return reg16;
}
static inline int pci_pcie_type(struct pci_dev *dev)
{
return (pcie_flags_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4;
return (pcie_flags_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4;
}
static inline int pcie_cap_version(struct pci_dev *dev)
{
return pcie_flags_reg(dev) & PCI_EXP_FLAGS_VERS;
return pcie_flags_reg(dev) & PCI_EXP_FLAGS_VERS;
}
static inline bool pcie_cap_has_lnkctl(struct pci_dev *dev)
{
int type = pci_pcie_type(dev);
int type = pci_pcie_type(dev);
return pcie_cap_version(dev) > 1 ||
type == PCI_EXP_TYPE_ROOT_PORT ||
type == PCI_EXP_TYPE_ENDPOINT ||
type == PCI_EXP_TYPE_LEG_END;
return pcie_cap_version(dev) > 1 ||
type == PCI_EXP_TYPE_ROOT_PORT ||
type == PCI_EXP_TYPE_ENDPOINT ||
type == PCI_EXP_TYPE_LEG_END;
}
static inline bool pcie_cap_has_devctl(const struct pci_dev *dev)
{
return true;
return true;
}
static inline bool pcie_cap_has_sltctl(struct pci_dev *dev)
{
int type = pci_pcie_type(dev);
int type = pci_pcie_type(dev);
return pcie_cap_version(dev) > 1 ||
type == PCI_EXP_TYPE_ROOT_PORT ||
(type == PCI_EXP_TYPE_DOWNSTREAM &&
pcie_flags_reg(dev) & PCI_EXP_FLAGS_SLOT);
return pcie_cap_version(dev) > 1 || type == PCI_EXP_TYPE_ROOT_PORT ||
(type == PCI_EXP_TYPE_DOWNSTREAM &&
pcie_flags_reg(dev) & PCI_EXP_FLAGS_SLOT);
}
static inline bool pcie_cap_has_rtctl(struct pci_dev *dev)
{
int type = pci_pcie_type(dev);
int type = pci_pcie_type(dev);
return pcie_cap_version(dev) > 1 ||
type == PCI_EXP_TYPE_ROOT_PORT ||
type == PCI_EXP_TYPE_RC_EC;
return pcie_cap_version(dev) > 1 || type == PCI_EXP_TYPE_ROOT_PORT ||
type == PCI_EXP_TYPE_RC_EC;
}
static bool pcie_capability_reg_implemented(struct pci_dev *dev, int pos)
{
if (!pci_is_pcie(dev))
return false;
if (!pci_is_pcie(dev))
return false;
switch (pos) {
case PCI_EXP_FLAGS_TYPE:
return true;
case PCI_EXP_DEVCAP:
case PCI_EXP_DEVCTL:
case PCI_EXP_DEVSTA:
return pcie_cap_has_devctl(dev);
case PCI_EXP_LNKCAP:
case PCI_EXP_LNKCTL:
case PCI_EXP_LNKSTA:
return pcie_cap_has_lnkctl(dev);
case PCI_EXP_SLTCAP:
case PCI_EXP_SLTCTL:
case PCI_EXP_SLTSTA:
return pcie_cap_has_sltctl(dev);
case PCI_EXP_RTCTL:
case PCI_EXP_RTCAP:
case PCI_EXP_RTSTA:
return pcie_cap_has_rtctl(dev);
case PCI_EXP_DEVCAP2:
case PCI_EXP_DEVCTL2:
case PCI_EXP_LNKCAP2:
case PCI_EXP_LNKCTL2:
case PCI_EXP_LNKSTA2:
return pcie_cap_version(dev) > 1;
default:
return false;
}
switch (pos) {
case PCI_EXP_FLAGS_TYPE:
return true;
case PCI_EXP_DEVCAP:
case PCI_EXP_DEVCTL:
case PCI_EXP_DEVSTA:
return pcie_cap_has_devctl(dev);
case PCI_EXP_LNKCAP:
case PCI_EXP_LNKCTL:
case PCI_EXP_LNKSTA:
return pcie_cap_has_lnkctl(dev);
case PCI_EXP_SLTCAP:
case PCI_EXP_SLTCTL:
case PCI_EXP_SLTSTA:
return pcie_cap_has_sltctl(dev);
case PCI_EXP_RTCTL:
case PCI_EXP_RTCAP:
case PCI_EXP_RTSTA:
return pcie_cap_has_rtctl(dev);
case PCI_EXP_DEVCAP2:
case PCI_EXP_DEVCTL2:
case PCI_EXP_LNKCAP2:
case PCI_EXP_LNKCTL2:
case PCI_EXP_LNKSTA2:
return pcie_cap_version(dev) > 1;
default:
return false;
}
}
static inline int
pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *dst)
{
if (pos & 3)
return -EINVAL;
if (pos & 3)
return -EINVAL;
if (!pcie_capability_reg_implemented(dev, pos))
return -EINVAL;
if (!pcie_capability_reg_implemented(dev, pos))
return -EINVAL;
return pci_read_config_dword(dev, pci_pcie_cap(dev) + pos, dst);
return pci_read_config_dword(dev, pci_pcie_cap(dev) + pos, dst);
}
static inline int
pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *dst)
{
if (pos & 3)
return -EINVAL;
if (pos & 3)
return -EINVAL;
if (!pcie_capability_reg_implemented(dev, pos))
return -EINVAL;
if (!pcie_capability_reg_implemented(dev, pos))
return -EINVAL;
return pci_read_config_word(dev, pci_pcie_cap(dev) + pos, dst);
return pci_read_config_word(dev, pci_pcie_cap(dev) + pos, dst);
}
static inline int
pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val)
{
if (pos & 1)
return -EINVAL;
if (pos & 1)
return -EINVAL;
if (!pcie_capability_reg_implemented(dev, pos))
return 0;
if (!pcie_capability_reg_implemented(dev, pos))
return 0;
return pci_write_config_word(dev, pci_pcie_cap(dev) + pos, val);
return pci_write_config_word(dev, pci_pcie_cap(dev) + pos, val);
}
static inline int pcie_get_minimum_link(struct pci_dev *dev,

View File

@ -48,9 +48,9 @@ typedef struct {
#define read_unlock_irq(lock) read_unlock((lock))
#define write_lock_irq(lock) write_lock((lock))
#define write_unlock_irq(lock) write_unlock((lock))
#define read_lock_irqsave(lock, flags) \
#define read_lock_irqsave(lock, flags) \
do {(flags) = 0; read_lock(lock); } while (0)
#define write_lock_irqsave(lock, flags) \
#define write_lock_irqsave(lock, flags) \
do {(flags) = 0; write_lock(lock); } while (0)
#define read_unlock_irqrestore(lock, flags) \
do { read_unlock(lock); } while (0)

View File

@ -55,7 +55,7 @@ struct rw_semaphore {
#ifdef WITNESS_ALL
/* NOTE: the maximum WITNESS name is 64 chars */
#define __rwsem_name(name, file, line) \
(((const char *){file ":" #line "-" name}) + \
(((const char *){file ":" #line "-" name}) + \
(sizeof(file) > 16 ? sizeof(file) - 16 : 0))
#else
#define __rwsem_name(name, file, line) name

View File

@ -49,9 +49,9 @@ MALLOC_DECLARE(M_KMALLOC);
#define vzalloc(size) __vmalloc(size, GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, 0)
#define vfree(arg) kfree(arg)
#define kvfree(arg) kfree(arg)
#define vmalloc_node(size, node) __vmalloc(size, GFP_KERNEL, 0)
#define vmalloc_user(size) __vmalloc(size, GFP_KERNEL | __GFP_ZERO, 0)
#define vmalloc(size) __vmalloc(size, GFP_KERNEL, 0)
#define vmalloc_node(size, node) __vmalloc(size, GFP_KERNEL, 0)
#define vmalloc_user(size) __vmalloc(size, GFP_KERNEL | __GFP_ZERO, 0)
#define vmalloc(size) __vmalloc(size, GFP_KERNEL, 0)
#define __kmalloc(...) kmalloc(__VA_ARGS__)
#define kmalloc_node(chunk, flags, n) kmalloc(chunk, flags)
@ -62,7 +62,7 @@ MALLOC_DECLARE(M_KMALLOC);
#define kmem_cache linux_kmem_cache
#define kmem_cache_create(...) linux_kmem_cache_create(__VA_ARGS__)
#define kmem_cache_alloc(...) linux_kmem_cache_alloc(__VA_ARGS__)
#define kmem_cache_free(...) linux_kmem_cache_free(__VA_ARGS__)
#define kmem_cache_free(...) linux_kmem_cache_free(__VA_ARGS__)
#define kmem_cache_destroy(...) linux_kmem_cache_destroy(__VA_ARGS__)
#define KMEM_CACHE(__struct, flags) \
@ -79,7 +79,7 @@ struct linux_kmem_cache {
};
#define SLAB_HWCACHE_ALIGN (1 << 0)
#define SLAB_TYPESAFE_BY_RCU (1 << 1)
#define SLAB_TYPESAFE_BY_RCU (1 << 1)
#define SLAB_RECLAIM_ACCOUNT (1 << 2)
#define SLAB_DESTROY_BY_RCU \

View File

@ -125,7 +125,7 @@ typedef struct {
#ifdef WITNESS_ALL
/* NOTE: the maximum WITNESS name is 64 chars */
#define __spin_lock_name(name, file, line) \
(((const char *){file ":" #line "-" name}) + \
(((const char *){file ":" #line "-" name}) + \
(sizeof(file) > 16 ? sizeof(file) - 16 : 0))
#else
#define __spin_lock_name(name, file, line) name

View File

@ -45,14 +45,14 @@ struct sysfs_ops {
struct attribute_group {
const char *name;
mode_t (*is_visible)(struct kobject *,
mode_t (*is_visible)(struct kobject *,
struct attribute *, int);
struct attribute **attrs;
};
#define __ATTR(_name, _mode, _show, _store) { \
.attr = { .name = __stringify(_name), .mode = _mode }, \
.show = _show, .store = _store, \
.show = _show, .store = _store, \
}
#define __ATTR_RO(_name) __ATTR(_name, 0444, _name##_show, NULL)
#define __ATTR_WO(_name) __ATTR(_name, 0200, NULL, _name##_store)
@ -99,7 +99,7 @@ sysctl_handle_attr(SYSCTL_HANDLER_ARGS)
/*
* It's valid to not have a 'show' so just return an
* empty string.
*/
*/
if (len < 0) {
error = -len;
if (error != EIO)
@ -180,7 +180,7 @@ sysfs_create_dir(struct kobject *kobj)
kobj->oidp = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(kobj->parent->oidp),
OID_AUTO, kobj->name, CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, kobj->name);
return (0);
return (0);
}
static inline void

View File

@ -64,20 +64,19 @@ typedef void (usb_complete_t)(struct urb *);
struct usb_driver {
const char *name;
int (*probe) (struct usb_interface *intf,
const struct usb_device_id *id);
int (*probe)(struct usb_interface *intf,
const struct usb_device_id *id);
void (*disconnect) (struct usb_interface *intf);
void (*disconnect)(struct usb_interface *intf);
int (*ioctl) (struct usb_interface *intf, unsigned int code,
void *buf);
int (*ioctl)(struct usb_interface *intf, unsigned int code, void *buf);
int (*suspend) (struct usb_interface *intf, pm_message_t message);
int (*resume) (struct usb_interface *intf);
int (*suspend)(struct usb_interface *intf, pm_message_t message);
int (*resume)(struct usb_interface *intf);
const struct usb_device_id *id_table;
void (*shutdown) (struct usb_interface *intf);
void (*shutdown)(struct usb_interface *intf);
LIST_ENTRY(usb_driver) linux_driver_list;
};

View File

@ -103,7 +103,7 @@ to_delayed_work(struct work_struct *work)
return (container_of(work, struct delayed_work, work));
}
#define INIT_WORK(work, fn) \
#define INIT_WORK(work, fn) \
do { \
(work)->func = (fn); \
(work)->work_queue = NULL; \

View File

@ -44,10 +44,10 @@ static inline void ipv6_eth_mc_map(const struct in6_addr *addr, char *buf)
* +-------+-------+-------+-------+-------+-------+
*/
buf[0]= 0x33;
buf[1]= 0x33;
buf[0]= 0x33;
buf[1]= 0x33;
memcpy(buf + 2, &addr->s6_addr32[3], sizeof(__u32));
memcpy(buf + 2, &addr->s6_addr32[3], sizeof(__u32));
}
#endif /* _NET_IF_INET6_H_ */

View File

@ -63,32 +63,31 @@ ipv6_ib_mc_map(const struct in6_addr *addr, const unsigned char *broadcast,
memcpy(&buf[10], &addr->s6_addr[6], 10);
}
static inline void __ipv6_addr_set_half(__be32 *addr,
__be32 wh, __be32 wl)
static inline void __ipv6_addr_set_half(__be32 *addr, __be32 wh, __be32 wl)
{
#if BITS_PER_LONG == 64
#if defined(__BIG_ENDIAN)
if (__builtin_constant_p(wh) && __builtin_constant_p(wl)) {
*(__force u64 *)addr = ((__force u64)(wh) << 32 | (__force u64)(wl));
return;
}
if (__builtin_constant_p(wh) && __builtin_constant_p(wl)) {
*(__force u64 *)addr = ((__force u64)(wh) << 32 | (__force u64)(wl));
return;
}
#elif defined(__LITTLE_ENDIAN)
if (__builtin_constant_p(wl) && __builtin_constant_p(wh)) {
*(__force u64 *)addr = ((__force u64)(wl) << 32 | (__force u64)(wh));
return;
}
if (__builtin_constant_p(wl) && __builtin_constant_p(wh)) {
*(__force u64 *)addr = ((__force u64)(wl) << 32 | (__force u64)(wh));
return;
}
#endif
#endif
addr[0] = wh;
addr[1] = wl;
addr[0] = wh;
addr[1] = wl;
}
static inline void ipv6_addr_set(struct in6_addr *addr,
__be32 w1, __be32 w2,
__be32 w3, __be32 w4)
__be32 w1, __be32 w2,
__be32 w3, __be32 w4)
{
__ipv6_addr_set_half(&addr->s6_addr32[0], w1, w2);
__ipv6_addr_set_half(&addr->s6_addr32[2], w3, w4);
__ipv6_addr_set_half(&addr->s6_addr32[0], w1, w2);
__ipv6_addr_set_half(&addr->s6_addr32[2], w3, w4);
}
static inline void ipv6_addr_set_v4mapped(const __be32 addr,
@ -108,7 +107,7 @@ static inline int ipv6_addr_v4mapped(const struct in6_addr *a)
static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2)
{
return memcmp(a1, a2, sizeof(struct in6_addr));
return memcmp(a1, a2, sizeof(struct in6_addr));
}

View File

@ -39,8 +39,8 @@
enum netevent_notif_type {
NETEVENT_NEIGH_UPDATE = 0,
#if 0 /* Unsupported events. */
NETEVENT_PMTU_UPDATE,
NETEVENT_REDIRECT,
NETEVENT_PMTU_UPDATE,
NETEVENT_REDIRECT,
#endif
};

View File

@ -190,7 +190,7 @@ kobject_add_complete(struct kobject *kobj, struct kobject *parent)
}
if (error)
sysfs_remove_dir(kobj);
}
return (error);
}
@ -2021,22 +2021,22 @@ int
register_inetaddr_notifier(struct notifier_block *nb)
{
nb->tags[NETDEV_CHANGEIFADDR] = EVENTHANDLER_REGISTER(
ifaddr_event, linux_handle_ifaddr_event, nb, 0);
return (0);
nb->tags[NETDEV_CHANGEIFADDR] = EVENTHANDLER_REGISTER(
ifaddr_event, linux_handle_ifaddr_event, nb, 0);
return (0);
}
int
unregister_netdevice_notifier(struct notifier_block *nb)
{
EVENTHANDLER_DEREGISTER(ifnet_link_event,
EVENTHANDLER_DEREGISTER(ifnet_link_event,
nb->tags[NETDEV_UP]);
EVENTHANDLER_DEREGISTER(ifnet_arrival_event,
EVENTHANDLER_DEREGISTER(ifnet_arrival_event,
nb->tags[NETDEV_REGISTER]);
EVENTHANDLER_DEREGISTER(ifnet_departure_event,
EVENTHANDLER_DEREGISTER(ifnet_departure_event,
nb->tags[NETDEV_UNREGISTER]);
EVENTHANDLER_DEREGISTER(iflladdr_event,
EVENTHANDLER_DEREGISTER(iflladdr_event,
nb->tags[NETDEV_CHANGEADDR]);
return (0);
@ -2046,10 +2046,10 @@ int
unregister_inetaddr_notifier(struct notifier_block *nb)
{
EVENTHANDLER_DEREGISTER(ifaddr_event,
nb->tags[NETDEV_CHANGEIFADDR]);
EVENTHANDLER_DEREGISTER(ifaddr_event,
nb->tags[NETDEV_CHANGEIFADDR]);
return (0);
return (0);
}
struct list_sort_thunk {

View File

@ -770,7 +770,7 @@ ida_simple_remove(struct ida *ida, unsigned int id)
void
ida_remove(struct ida *ida, int id)
{
{
idr_remove(&ida->idr, id);
}

View File

@ -252,6 +252,6 @@ radix_tree_insert(struct radix_tree_root *root, unsigned long index, void *item)
return (-EEXIST);
node->slots[idx] = item;
node->count++;
return (0);
}

View File

@ -418,11 +418,11 @@ usb_submit_urb(struct urb *urb, uint16_t mem_flags)
}
/*
* Check to see if the urb is in the process of being killed
* and stop a urb that is in the process of being killed from
* being re-submitted (e.g. from its completion callback
* function).
*/
* Check to see if the urb is in the process of being killed
* and stop a urb that is in the process of being killed from
* being re-submitted (e.g. from its completion callback
* function).
*/
if (urb->kill_count != 0) {
err = -EPERM;
goto done;
@ -1593,9 +1593,9 @@ tr_setup:
if (xfer->flags_int.control_xfr) {
/*
* USB control transfers need special handling.
* First copy in the header, then copy in data!
*/
* USB control transfers need special handling.
* First copy in the header, then copy in data!
*/
if (!xfer->flags.ext_buffer) {
usbd_copy_in(xfer->frbuffers, 0,
urb->setup_packet, REQ_SIZE);
@ -1725,7 +1725,7 @@ usb_bulk_msg(struct usb_device *udev, struct usb_host_endpoint *uhe,
if (urb == NULL)
return (-ENOMEM);
usb_fill_bulk_urb(urb, udev, uhe, data, len,
usb_fill_bulk_urb(urb, udev, uhe, data, len,
usb_linux_wait_complete, NULL);
err = usb_start_wait_urb(urb, timeout, pactlen);