Skip to content

Commit 607117a

Browse files
committed
Merge tag 'driver-core-4.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core fixes from Greg KH: "Here are a small number of debugfs, ISA, and one driver core fix for 4.7-rc4. All of these resolve reported issues. The ISA ones have spent the least amount of time in linux-next, sorry about that, I didn't realize they were regressions that needed to get in now (thanks to Thorsten for the prodding!) but they do all pass the 0-day bot tests. The others have been in linux-next for a while now. Full details about them are in the shortlog below" * tag 'driver-core-4.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: isa: Dummy isa_register_driver should return error code isa: Call isa_bus_init before dependent ISA bus drivers register watchdog: ebc-c384_wdt: Allow build for X86_64 iio: stx104: Allow build for X86_64 gpio: Allow PC/104 devices on X86_64 isa: Allow ISA-style drivers on modern systems base: make module_create_drivers_dir race-free debugfs: open_proxy_open(): avoid double fops release debugfs: full_proxy_open(): free proxy on ->open() failure kernel/kcov: unproxify debugfs file's fops
2 parents 07b5ca2 + 5e25db8 commit 607117a

File tree

11 files changed

+38
-17
lines changed

11 files changed

+38
-17
lines changed

arch/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,9 @@ config HAVE_ARCH_HASH
606606
file which provides platform-specific implementations of some
607607
functions in <linux/hash.h> or fs/namei.c.
608608

609+
config ISA_BUS_API
610+
def_bool ISA
611+
609612
#
610613
# ABI hall of shame
611614
#

arch/x86/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2439,6 +2439,15 @@ config PCI_CNB20LE_QUIRK
24392439

24402440
source "drivers/pci/Kconfig"
24412441

2442+
config ISA_BUS
2443+
bool "ISA-style bus support on modern systems" if EXPERT
2444+
select ISA_BUS_API
2445+
help
2446+
Enables ISA-style drivers on modern systems. This is necessary to
2447+
support PC/104 devices on X86_64 platforms.
2448+
2449+
If unsure, say N.
2450+
24422451
# x86_64 have no ISA slots, but can have ISA-style DMA.
24432452
config ISA_DMA_API
24442453
bool "ISA-style DMA support" if (X86_64 && EXPERT)

drivers/base/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ obj-$(CONFIG_DMA_CMA) += dma-contiguous.o
1010
obj-y += power/
1111
obj-$(CONFIG_HAS_DMA) += dma-mapping.o
1212
obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += dma-coherent.o
13-
obj-$(CONFIG_ISA) += isa.o
13+
obj-$(CONFIG_ISA_BUS_API) += isa.o
1414
obj-$(CONFIG_FW_LOADER) += firmware_class.o
1515
obj-$(CONFIG_NUMA) += node.o
1616
obj-$(CONFIG_MEMORY_HOTPLUG_SPARSE) += memory.o

drivers/base/isa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,4 @@ static int __init isa_bus_init(void)
180180
return error;
181181
}
182182

183-
device_initcall(isa_bus_init);
183+
postcore_initcall(isa_bus_init);

drivers/base/module.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ static char *make_driver_name(struct device_driver *drv)
2424

2525
static void module_create_drivers_dir(struct module_kobject *mk)
2626
{
27-
if (!mk || mk->drivers_dir)
28-
return;
27+
static DEFINE_MUTEX(drivers_dir_mutex);
2928

30-
mk->drivers_dir = kobject_create_and_add("drivers", &mk->kobj);
29+
mutex_lock(&drivers_dir_mutex);
30+
if (mk && !mk->drivers_dir)
31+
mk->drivers_dir = kobject_create_and_add("drivers", &mk->kobj);
32+
mutex_unlock(&drivers_dir_mutex);
3133
}
3234

3335
void module_add_driver(struct module *mod, struct device_driver *drv)

drivers/gpio/Kconfig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ menu "Port-mapped I/O GPIO drivers"
531531

532532
config GPIO_104_DIO_48E
533533
tristate "ACCES 104-DIO-48E GPIO support"
534-
depends on ISA
534+
depends on ISA_BUS_API
535535
select GPIOLIB_IRQCHIP
536536
help
537537
Enables GPIO support for the ACCES 104-DIO-48E series (104-DIO-48E,
@@ -541,7 +541,7 @@ config GPIO_104_DIO_48E
541541

542542
config GPIO_104_IDIO_16
543543
tristate "ACCES 104-IDIO-16 GPIO support"
544-
depends on ISA
544+
depends on ISA_BUS_API
545545
select GPIOLIB_IRQCHIP
546546
help
547547
Enables GPIO support for the ACCES 104-IDIO-16 family (104-IDIO-16,
@@ -552,7 +552,7 @@ config GPIO_104_IDIO_16
552552

553553
config GPIO_104_IDI_48
554554
tristate "ACCES 104-IDI-48 GPIO support"
555-
depends on ISA
555+
depends on ISA_BUS_API
556556
select GPIOLIB_IRQCHIP
557557
help
558558
Enables GPIO support for the ACCES 104-IDI-48 family (104-IDI-48A,
@@ -628,7 +628,7 @@ config GPIO_TS5500
628628

629629
config GPIO_WS16C48
630630
tristate "WinSystems WS16C48 GPIO support"
631-
depends on ISA
631+
depends on ISA_BUS_API
632632
select GPIOLIB_IRQCHIP
633633
help
634634
Enables GPIO support for the WinSystems WS16C48. The base port

drivers/iio/dac/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ config MCP4922
247247

248248
config STX104
249249
tristate "Apex Embedded Systems STX104 DAC driver"
250-
depends on X86 && ISA
250+
depends on X86 && ISA_BUS_API
251251
help
252252
Say yes here to build support for the 2-channel DAC on the Apex
253253
Embedded Systems STX104 integrated analog PC/104 card. The base port

drivers/watchdog/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ config ALIM7101_WDT
746746

747747
config EBC_C384_WDT
748748
tristate "WinSystems EBC-C384 Watchdog Timer"
749-
depends on X86 && ISA
749+
depends on X86 && ISA_BUS_API
750750
select WATCHDOG_CORE
751751
help
752752
Enables watchdog timer support for the watchdog timer on the

fs/debugfs/file.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ static int open_proxy_open(struct inode *inode, struct file *filp)
127127
r = real_fops->open(inode, filp);
128128

129129
out:
130-
fops_put(real_fops);
131130
debugfs_use_file_finish(srcu_idx);
132131
return r;
133132
}
@@ -262,8 +261,10 @@ static int full_proxy_open(struct inode *inode, struct file *filp)
262261

263262
if (real_fops->open) {
264263
r = real_fops->open(inode, filp);
265-
266-
if (filp->f_op != proxy_fops) {
264+
if (r) {
265+
replace_fops(filp, d_inode(dentry)->i_fop);
266+
goto free_proxy;
267+
} else if (filp->f_op != proxy_fops) {
267268
/* No protection against file removal anymore. */
268269
WARN(1, "debugfs file owner replaced proxy fops: %pd",
269270
dentry);

include/linux/isa.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#define __LINUX_ISA_H
77

88
#include <linux/device.h>
9+
#include <linux/errno.h>
910
#include <linux/kernel.h>
1011

1112
struct isa_driver {
@@ -22,13 +23,13 @@ struct isa_driver {
2223

2324
#define to_isa_driver(x) container_of((x), struct isa_driver, driver)
2425

25-
#ifdef CONFIG_ISA
26+
#ifdef CONFIG_ISA_BUS_API
2627
int isa_register_driver(struct isa_driver *, unsigned int);
2728
void isa_unregister_driver(struct isa_driver *);
2829
#else
2930
static inline int isa_register_driver(struct isa_driver *d, unsigned int i)
3031
{
31-
return 0;
32+
return -ENODEV;
3233
}
3334

3435
static inline void isa_unregister_driver(struct isa_driver *d)

kernel/kcov.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,12 @@ static const struct file_operations kcov_fops = {
264264

265265
static int __init kcov_init(void)
266266
{
267-
if (!debugfs_create_file("kcov", 0600, NULL, NULL, &kcov_fops)) {
267+
/*
268+
* The kcov debugfs file won't ever get removed and thus,
269+
* there is no need to protect it against removal races. The
270+
* use of debugfs_create_file_unsafe() is actually safe here.
271+
*/
272+
if (!debugfs_create_file_unsafe("kcov", 0600, NULL, NULL, &kcov_fops)) {
268273
pr_err("failed to create kcov in debugfs\n");
269274
return -ENOMEM;
270275
}

0 commit comments

Comments
 (0)