Skip to content

Commit b5f0998

Browse files
committed
Merge tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394
Pull firewire updates from Stefan Richter: - Fix a regression since 3.2 inclusive: The subsystem workqueue deadlocked between transaction completion handling and bus reset handling if the worker pool could not be increased in time. - janitorial updates * tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394: firewire: ohci: Fix deadlock at bus reset firewire: ohci: Change module_pci_driver to module_init/module_exit firewire: ohci: beautify some macro definitions firewire: ohci: change confusing name of a struct member firewire: core: typecast from gfp_t to bool more safely firewire: WQ_NON_REENTRANT is meaningless and going away
2 parents 64c3538 + db9ae8f commit b5f0998

File tree

3 files changed

+36
-19
lines changed

3 files changed

+36
-19
lines changed

drivers/firewire/core-cdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ static int ioctl_get_info(struct client *client, union ioctl_arg *arg)
486486
static int add_client_resource(struct client *client,
487487
struct client_resource *resource, gfp_t gfp_mask)
488488
{
489-
bool preload = gfp_mask & __GFP_WAIT;
489+
bool preload = !!(gfp_mask & __GFP_WAIT);
490490
unsigned long flags;
491491
int ret;
492492

drivers/firewire/core-transaction.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,8 +1262,7 @@ static int __init fw_core_init(void)
12621262
{
12631263
int ret;
12641264

1265-
fw_workqueue = alloc_workqueue("firewire",
1266-
WQ_NON_REENTRANT | WQ_MEM_RECLAIM, 0);
1265+
fw_workqueue = alloc_workqueue("firewire", WQ_MEM_RECLAIM, 0);
12671266
if (!fw_workqueue)
12681267
return -ENOMEM;
12691268

drivers/firewire/ohci.c

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,15 @@ struct fw_ohci {
235235
dma_addr_t next_config_rom_bus;
236236
__be32 next_header;
237237

238-
__le32 *self_id_cpu;
238+
__le32 *self_id;
239239
dma_addr_t self_id_bus;
240240
struct work_struct bus_reset_work;
241241

242242
u32 self_id_buffer[512];
243243
};
244244

245+
static struct workqueue_struct *selfid_workqueue;
246+
245247
static inline struct fw_ohci *fw_ohci(struct fw_card *card)
246248
{
247249
return container_of(card, struct fw_ohci, card);
@@ -271,24 +273,24 @@ static inline struct fw_ohci *fw_ohci(struct fw_card *card)
271273

272274
static char ohci_driver_name[] = KBUILD_MODNAME;
273275

276+
#define PCI_VENDOR_ID_PINNACLE_SYSTEMS 0x11bd
274277
#define PCI_DEVICE_ID_AGERE_FW643 0x5901
275278
#define PCI_DEVICE_ID_CREATIVE_SB1394 0x4001
276279
#define PCI_DEVICE_ID_JMICRON_JMB38X_FW 0x2380
277280
#define PCI_DEVICE_ID_TI_TSB12LV22 0x8009
278281
#define PCI_DEVICE_ID_TI_TSB12LV26 0x8020
279282
#define PCI_DEVICE_ID_TI_TSB82AA2 0x8025
280283
#define PCI_DEVICE_ID_VIA_VT630X 0x3044
281-
#define PCI_VENDOR_ID_PINNACLE_SYSTEMS 0x11bd
282284
#define PCI_REV_ID_VIA_VT6306 0x46
283285

284-
#define QUIRK_CYCLE_TIMER 1
285-
#define QUIRK_RESET_PACKET 2
286-
#define QUIRK_BE_HEADERS 4
287-
#define QUIRK_NO_1394A 8
288-
#define QUIRK_NO_MSI 16
289-
#define QUIRK_TI_SLLZ059 32
290-
#define QUIRK_IR_WAKE 64
291-
#define QUIRK_PHY_LCTRL_TIMEOUT 128
286+
#define QUIRK_CYCLE_TIMER 0x1
287+
#define QUIRK_RESET_PACKET 0x2
288+
#define QUIRK_BE_HEADERS 0x4
289+
#define QUIRK_NO_1394A 0x8
290+
#define QUIRK_NO_MSI 0x10
291+
#define QUIRK_TI_SLLZ059 0x20
292+
#define QUIRK_IR_WAKE 0x40
293+
#define QUIRK_PHY_LCTRL_TIMEOUT 0x80
292294

293295
/* In case of multiple matches in ohci_quirks[], only the first one is used. */
294296
static const struct {
@@ -1929,12 +1931,12 @@ static void bus_reset_work(struct work_struct *work)
19291931
return;
19301932
}
19311933

1932-
generation = (cond_le32_to_cpu(ohci->self_id_cpu[0]) >> 16) & 0xff;
1934+
generation = (cond_le32_to_cpu(ohci->self_id[0]) >> 16) & 0xff;
19331935
rmb();
19341936

19351937
for (i = 1, j = 0; j < self_id_count; i += 2, j++) {
1936-
u32 id = cond_le32_to_cpu(ohci->self_id_cpu[i]);
1937-
u32 id2 = cond_le32_to_cpu(ohci->self_id_cpu[i + 1]);
1938+
u32 id = cond_le32_to_cpu(ohci->self_id[i]);
1939+
u32 id2 = cond_le32_to_cpu(ohci->self_id[i + 1]);
19381940

19391941
if (id != ~id2) {
19401942
/*
@@ -2087,7 +2089,7 @@ static irqreturn_t irq_handler(int irq, void *data)
20872089
log_irqs(ohci, event);
20882090

20892091
if (event & OHCI1394_selfIDComplete)
2090-
queue_work(fw_workqueue, &ohci->bus_reset_work);
2092+
queue_work(selfid_workqueue, &ohci->bus_reset_work);
20912093

20922094
if (event & OHCI1394_RQPkt)
20932095
tasklet_schedule(&ohci->ar_request_ctx.tasklet);
@@ -3692,7 +3694,7 @@ static int pci_probe(struct pci_dev *dev,
36923694
goto fail_contexts;
36933695
}
36943696

3695-
ohci->self_id_cpu = ohci->misc_buffer + PAGE_SIZE/2;
3697+
ohci->self_id = ohci->misc_buffer + PAGE_SIZE/2;
36963698
ohci->self_id_bus = ohci->misc_buffer_bus + PAGE_SIZE/2;
36973699

36983700
bus_options = reg_read(ohci, OHCI1394_BusOptions);
@@ -3870,7 +3872,23 @@ static struct pci_driver fw_ohci_pci_driver = {
38703872
#endif
38713873
};
38723874

3873-
module_pci_driver(fw_ohci_pci_driver);
3875+
static int __init fw_ohci_init(void)
3876+
{
3877+
selfid_workqueue = alloc_workqueue(KBUILD_MODNAME, WQ_MEM_RECLAIM, 0);
3878+
if (!selfid_workqueue)
3879+
return -ENOMEM;
3880+
3881+
return pci_register_driver(&fw_ohci_pci_driver);
3882+
}
3883+
3884+
static void __exit fw_ohci_cleanup(void)
3885+
{
3886+
pci_unregister_driver(&fw_ohci_pci_driver);
3887+
destroy_workqueue(selfid_workqueue);
3888+
}
3889+
3890+
module_init(fw_ohci_init);
3891+
module_exit(fw_ohci_cleanup);
38743892

38753893
MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>");
38763894
MODULE_DESCRIPTION("Driver for PCI OHCI IEEE1394 controllers");

0 commit comments

Comments
 (0)