Skip to content

Commit d1877e6

Browse files
committed
vfio: de-extern-ify function prototypes
The use of 'extern' in function prototypes has been disrecommended in the kernel coding style for several years now, remove them from all vfio related files so contributors no longer need to decide between style and consistency. Reviewed-by: Kevin Tian <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Reviewed-by: Eric Farman <[email protected]> Reviewed-by: Eric Auger <[email protected]> Reviewed-by: Cornelia Huck <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/165471414407.203056.474032786990662279.stgit@omen Signed-off-by: Alex Williamson <[email protected]>
1 parent 03c765b commit d1877e6

File tree

7 files changed

+91
-95
lines changed

7 files changed

+91
-95
lines changed

Documentation/driver-api/vfio-mediated-device.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ to register and unregister itself with the core driver:
114114

115115
* Register::
116116

117-
extern int mdev_register_driver(struct mdev_driver *drv);
117+
int mdev_register_driver(struct mdev_driver *drv);
118118

119119
* Unregister::
120120

121-
extern void mdev_unregister_driver(struct mdev_driver *drv);
121+
void mdev_unregister_driver(struct mdev_driver *drv);
122122

123123
The mediated bus driver's probe function should create a vfio_device on top of
124124
the mdev_device and connect it to an appropriate implementation of
@@ -127,16 +127,16 @@ vfio_device_ops.
127127
When a driver wants to add the GUID creation sysfs to an existing device it has
128128
probe'd to then it should call::
129129

130-
extern int mdev_register_device(struct device *dev,
131-
struct mdev_driver *mdev_driver);
130+
int mdev_register_device(struct device *dev,
131+
struct mdev_driver *mdev_driver);
132132

133133
This will provide the 'mdev_supported_types/XX/create' files which can then be
134134
used to trigger the creation of a mdev_device. The created mdev_device will be
135135
attached to the specified driver.
136136

137137
When the driver needs to remove itself it calls::
138138

139-
extern void mdev_unregister_device(struct device *dev);
139+
void mdev_unregister_device(struct device *dev);
140140

141141
Which will unbind and destroy all the created mdevs and remove the sysfs files.
142142

drivers/s390/cio/vfio_ccw_cp.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ struct channel_program {
4141
struct ccw1 *guest_cp;
4242
};
4343

44-
extern int cp_init(struct channel_program *cp, union orb *orb);
45-
extern void cp_free(struct channel_program *cp);
46-
extern int cp_prefetch(struct channel_program *cp);
47-
extern union orb *cp_get_orb(struct channel_program *cp, u32 intparm, u8 lpm);
48-
extern void cp_update_scsw(struct channel_program *cp, union scsw *scsw);
49-
extern bool cp_iova_pinned(struct channel_program *cp, u64 iova);
44+
int cp_init(struct channel_program *cp, union orb *orb);
45+
void cp_free(struct channel_program *cp);
46+
int cp_prefetch(struct channel_program *cp);
47+
union orb *cp_get_orb(struct channel_program *cp, u32 intparm, u8 lpm);
48+
void cp_update_scsw(struct channel_program *cp, union scsw *scsw);
49+
bool cp_iova_pinned(struct channel_program *cp, u64 iova);
5050

5151
#endif

drivers/s390/cio/vfio_ccw_private.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ struct vfio_ccw_private {
119119
struct work_struct crw_work;
120120
} __aligned(8);
121121

122-
extern int vfio_ccw_mdev_reg(struct subchannel *sch);
123-
extern void vfio_ccw_mdev_unreg(struct subchannel *sch);
122+
int vfio_ccw_mdev_reg(struct subchannel *sch);
123+
void vfio_ccw_mdev_unreg(struct subchannel *sch);
124124

125-
extern int vfio_ccw_sch_quiesce(struct subchannel *sch);
125+
int vfio_ccw_sch_quiesce(struct subchannel *sch);
126126

127127
extern struct mdev_driver vfio_ccw_mdev_driver;
128128

drivers/vfio/fsl-mc/vfio_fsl_mc_private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct vfio_fsl_mc_device {
3939
struct vfio_fsl_mc_irq *mc_irqs;
4040
};
4141

42-
extern int vfio_fsl_mc_set_irqs_ioctl(struct vfio_fsl_mc_device *vdev,
42+
int vfio_fsl_mc_set_irqs_ioctl(struct vfio_fsl_mc_device *vdev,
4343
u32 flags, unsigned int index,
4444
unsigned int start, unsigned int count,
4545
void *data);

drivers/vfio/platform/vfio_platform_private.h

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,20 @@ struct vfio_platform_reset_node {
7878
vfio_platform_reset_fn_t of_reset;
7979
};
8080

81-
extern int vfio_platform_probe_common(struct vfio_platform_device *vdev,
82-
struct device *dev);
81+
int vfio_platform_probe_common(struct vfio_platform_device *vdev,
82+
struct device *dev);
8383
void vfio_platform_remove_common(struct vfio_platform_device *vdev);
8484

85-
extern int vfio_platform_irq_init(struct vfio_platform_device *vdev);
86-
extern void vfio_platform_irq_cleanup(struct vfio_platform_device *vdev);
85+
int vfio_platform_irq_init(struct vfio_platform_device *vdev);
86+
void vfio_platform_irq_cleanup(struct vfio_platform_device *vdev);
8787

88-
extern int vfio_platform_set_irqs_ioctl(struct vfio_platform_device *vdev,
89-
uint32_t flags, unsigned index,
90-
unsigned start, unsigned count,
91-
void *data);
88+
int vfio_platform_set_irqs_ioctl(struct vfio_platform_device *vdev,
89+
uint32_t flags, unsigned index,
90+
unsigned start, unsigned count, void *data);
9291

93-
extern void __vfio_platform_register_reset(struct vfio_platform_reset_node *n);
94-
extern void vfio_platform_unregister_reset(const char *compat,
95-
vfio_platform_reset_fn_t fn);
92+
void __vfio_platform_register_reset(struct vfio_platform_reset_node *n);
93+
void vfio_platform_unregister_reset(const char *compat,
94+
vfio_platform_reset_fn_t fn);
9695
#define vfio_platform_register_reset(__compat, __reset) \
9796
static struct vfio_platform_reset_node __reset ## _node = { \
9897
.owner = THIS_MODULE, \

include/linux/vfio.h

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,19 @@ int vfio_mig_get_next_state(struct vfio_device *device,
140140
/*
141141
* External user API
142142
*/
143-
extern struct iommu_group *vfio_file_iommu_group(struct file *file);
144-
extern bool vfio_file_enforced_coherent(struct file *file);
145-
extern void vfio_file_set_kvm(struct file *file, struct kvm *kvm);
146-
extern bool vfio_file_has_dev(struct file *file, struct vfio_device *device);
143+
struct iommu_group *vfio_file_iommu_group(struct file *file);
144+
bool vfio_file_enforced_coherent(struct file *file);
145+
void vfio_file_set_kvm(struct file *file, struct kvm *kvm);
146+
bool vfio_file_has_dev(struct file *file, struct vfio_device *device);
147147

148148
#define VFIO_PIN_PAGES_MAX_ENTRIES (PAGE_SIZE/sizeof(unsigned long))
149149

150-
extern int vfio_pin_pages(struct vfio_device *device, unsigned long *user_pfn,
151-
int npage, int prot, unsigned long *phys_pfn);
152-
extern int vfio_unpin_pages(struct vfio_device *device, unsigned long *user_pfn,
153-
int npage);
154-
extern int vfio_dma_rw(struct vfio_device *device, dma_addr_t user_iova,
155-
void *data, size_t len, bool write);
150+
int vfio_pin_pages(struct vfio_device *device, unsigned long *user_pfn,
151+
int npage, int prot, unsigned long *phys_pfn);
152+
int vfio_unpin_pages(struct vfio_device *device, unsigned long *user_pfn,
153+
int npage);
154+
int vfio_dma_rw(struct vfio_device *device, dma_addr_t user_iova,
155+
void *data, size_t len, bool write);
156156

157157
/* each type has independent events */
158158
enum vfio_notify_type {
@@ -162,13 +162,13 @@ enum vfio_notify_type {
162162
/* events for VFIO_IOMMU_NOTIFY */
163163
#define VFIO_IOMMU_NOTIFY_DMA_UNMAP BIT(0)
164164

165-
extern int vfio_register_notifier(struct vfio_device *device,
166-
enum vfio_notify_type type,
167-
unsigned long *required_events,
168-
struct notifier_block *nb);
169-
extern int vfio_unregister_notifier(struct vfio_device *device,
170-
enum vfio_notify_type type,
171-
struct notifier_block *nb);
165+
int vfio_register_notifier(struct vfio_device *device,
166+
enum vfio_notify_type type,
167+
unsigned long *required_events,
168+
struct notifier_block *nb);
169+
int vfio_unregister_notifier(struct vfio_device *device,
170+
enum vfio_notify_type type,
171+
struct notifier_block *nb);
172172

173173

174174
/*
@@ -178,25 +178,24 @@ struct vfio_info_cap {
178178
struct vfio_info_cap_header *buf;
179179
size_t size;
180180
};
181-
extern struct vfio_info_cap_header *vfio_info_cap_add(
182-
struct vfio_info_cap *caps, size_t size, u16 id, u16 version);
183-
extern void vfio_info_cap_shift(struct vfio_info_cap *caps, size_t offset);
181+
struct vfio_info_cap_header *vfio_info_cap_add(struct vfio_info_cap *caps,
182+
size_t size, u16 id,
183+
u16 version);
184+
void vfio_info_cap_shift(struct vfio_info_cap *caps, size_t offset);
184185

185-
extern int vfio_info_add_capability(struct vfio_info_cap *caps,
186-
struct vfio_info_cap_header *cap,
187-
size_t size);
186+
int vfio_info_add_capability(struct vfio_info_cap *caps,
187+
struct vfio_info_cap_header *cap, size_t size);
188188

189-
extern int vfio_set_irqs_validate_and_prepare(struct vfio_irq_set *hdr,
190-
int num_irqs, int max_irq_type,
191-
size_t *data_size);
189+
int vfio_set_irqs_validate_and_prepare(struct vfio_irq_set *hdr,
190+
int num_irqs, int max_irq_type,
191+
size_t *data_size);
192192

193193
struct pci_dev;
194194
#if IS_ENABLED(CONFIG_VFIO_SPAPR_EEH)
195-
extern void vfio_spapr_pci_eeh_open(struct pci_dev *pdev);
196-
extern void vfio_spapr_pci_eeh_release(struct pci_dev *pdev);
197-
extern long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
198-
unsigned int cmd,
199-
unsigned long arg);
195+
void vfio_spapr_pci_eeh_open(struct pci_dev *pdev);
196+
void vfio_spapr_pci_eeh_release(struct pci_dev *pdev);
197+
long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group, unsigned int cmd,
198+
unsigned long arg);
200199
#else
201200
static inline void vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
202201
{
@@ -230,10 +229,9 @@ struct virqfd {
230229
struct virqfd **pvirqfd;
231230
};
232231

233-
extern int vfio_virqfd_enable(void *opaque,
234-
int (*handler)(void *, void *),
235-
void (*thread)(void *, void *),
236-
void *data, struct virqfd **pvirqfd, int fd);
237-
extern void vfio_virqfd_disable(struct virqfd **pvirqfd);
232+
int vfio_virqfd_enable(void *opaque, int (*handler)(void *, void *),
233+
void (*thread)(void *, void *), void *data,
234+
struct virqfd **pvirqfd, int fd);
235+
void vfio_virqfd_disable(struct virqfd **pvirqfd);
238236

239237
#endif /* VFIO_H */

include/linux/vfio_pci_core.h

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -147,23 +147,23 @@ struct vfio_pci_core_device {
147147
#define is_irq_none(vdev) (!(is_intx(vdev) || is_msi(vdev) || is_msix(vdev)))
148148
#define irq_is(vdev, type) (vdev->irq_type == type)
149149

150-
extern void vfio_pci_intx_mask(struct vfio_pci_core_device *vdev);
151-
extern void vfio_pci_intx_unmask(struct vfio_pci_core_device *vdev);
150+
void vfio_pci_intx_mask(struct vfio_pci_core_device *vdev);
151+
void vfio_pci_intx_unmask(struct vfio_pci_core_device *vdev);
152152

153-
extern int vfio_pci_set_irqs_ioctl(struct vfio_pci_core_device *vdev,
154-
uint32_t flags, unsigned index,
155-
unsigned start, unsigned count, void *data);
153+
int vfio_pci_set_irqs_ioctl(struct vfio_pci_core_device *vdev,
154+
uint32_t flags, unsigned index,
155+
unsigned start, unsigned count, void *data);
156156

157-
extern ssize_t vfio_pci_config_rw(struct vfio_pci_core_device *vdev,
158-
char __user *buf, size_t count,
159-
loff_t *ppos, bool iswrite);
157+
ssize_t vfio_pci_config_rw(struct vfio_pci_core_device *vdev,
158+
char __user *buf, size_t count,
159+
loff_t *ppos, bool iswrite);
160160

161-
extern ssize_t vfio_pci_bar_rw(struct vfio_pci_core_device *vdev, char __user *buf,
162-
size_t count, loff_t *ppos, bool iswrite);
161+
ssize_t vfio_pci_bar_rw(struct vfio_pci_core_device *vdev, char __user *buf,
162+
size_t count, loff_t *ppos, bool iswrite);
163163

164164
#ifdef CONFIG_VFIO_PCI_VGA
165-
extern ssize_t vfio_pci_vga_rw(struct vfio_pci_core_device *vdev, char __user *buf,
166-
size_t count, loff_t *ppos, bool iswrite);
165+
ssize_t vfio_pci_vga_rw(struct vfio_pci_core_device *vdev, char __user *buf,
166+
size_t count, loff_t *ppos, bool iswrite);
167167
#else
168168
static inline ssize_t vfio_pci_vga_rw(struct vfio_pci_core_device *vdev,
169169
char __user *buf, size_t count,
@@ -173,32 +173,31 @@ static inline ssize_t vfio_pci_vga_rw(struct vfio_pci_core_device *vdev,
173173
}
174174
#endif
175175

176-
extern long vfio_pci_ioeventfd(struct vfio_pci_core_device *vdev, loff_t offset,
177-
uint64_t data, int count, int fd);
176+
long vfio_pci_ioeventfd(struct vfio_pci_core_device *vdev, loff_t offset,
177+
uint64_t data, int count, int fd);
178178

179-
extern int vfio_pci_init_perm_bits(void);
180-
extern void vfio_pci_uninit_perm_bits(void);
179+
int vfio_pci_init_perm_bits(void);
180+
void vfio_pci_uninit_perm_bits(void);
181181

182-
extern int vfio_config_init(struct vfio_pci_core_device *vdev);
183-
extern void vfio_config_free(struct vfio_pci_core_device *vdev);
182+
int vfio_config_init(struct vfio_pci_core_device *vdev);
183+
void vfio_config_free(struct vfio_pci_core_device *vdev);
184184

185-
extern int vfio_pci_register_dev_region(struct vfio_pci_core_device *vdev,
186-
unsigned int type, unsigned int subtype,
187-
const struct vfio_pci_regops *ops,
188-
size_t size, u32 flags, void *data);
185+
int vfio_pci_register_dev_region(struct vfio_pci_core_device *vdev,
186+
unsigned int type, unsigned int subtype,
187+
const struct vfio_pci_regops *ops,
188+
size_t size, u32 flags, void *data);
189189

190-
extern int vfio_pci_set_power_state(struct vfio_pci_core_device *vdev,
191-
pci_power_t state);
190+
int vfio_pci_set_power_state(struct vfio_pci_core_device *vdev,
191+
pci_power_t state);
192192

193-
extern bool __vfio_pci_memory_enabled(struct vfio_pci_core_device *vdev);
194-
extern void vfio_pci_zap_and_down_write_memory_lock(struct vfio_pci_core_device
195-
*vdev);
196-
extern u16 vfio_pci_memory_lock_and_enable(struct vfio_pci_core_device *vdev);
197-
extern void vfio_pci_memory_unlock_and_restore(struct vfio_pci_core_device *vdev,
198-
u16 cmd);
193+
bool __vfio_pci_memory_enabled(struct vfio_pci_core_device *vdev);
194+
void vfio_pci_zap_and_down_write_memory_lock(struct vfio_pci_core_device *vdev);
195+
u16 vfio_pci_memory_lock_and_enable(struct vfio_pci_core_device *vdev);
196+
void vfio_pci_memory_unlock_and_restore(struct vfio_pci_core_device *vdev,
197+
u16 cmd);
199198

200199
#ifdef CONFIG_VFIO_PCI_IGD
201-
extern int vfio_pci_igd_init(struct vfio_pci_core_device *vdev);
200+
int vfio_pci_igd_init(struct vfio_pci_core_device *vdev);
202201
#else
203202
static inline int vfio_pci_igd_init(struct vfio_pci_core_device *vdev)
204203
{
@@ -207,8 +206,8 @@ static inline int vfio_pci_igd_init(struct vfio_pci_core_device *vdev)
207206
#endif
208207

209208
#ifdef CONFIG_S390
210-
extern int vfio_pci_info_zdev_add_caps(struct vfio_pci_core_device *vdev,
211-
struct vfio_info_cap *caps);
209+
int vfio_pci_info_zdev_add_caps(struct vfio_pci_core_device *vdev,
210+
struct vfio_info_cap *caps);
212211
#else
213212
static inline int vfio_pci_info_zdev_add_caps(struct vfio_pci_core_device *vdev,
214213
struct vfio_info_cap *caps)

0 commit comments

Comments
 (0)