Skip to content

Commit 4a13617

Browse files
committed
firewire: ohci: use inline functions to operate data of self-ID DMA
The code of 1394 OHCI driver includes hard-coded magic number to operate data of Self-ID DMA. This commit replaces them with the inline functions added/tested in the former commit. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Sakamoto <[email protected]>
1 parent 7a14f78 commit 4a13617

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

drivers/firewire/ohci.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2003,7 +2003,7 @@ static void bus_reset_work(struct work_struct *work)
20032003
struct fw_ohci *ohci =
20042004
container_of(work, struct fw_ohci, bus_reset_work);
20052005
int self_id_count, generation, new_generation, i, j;
2006-
u32 reg;
2006+
u32 reg, quadlet;
20072007
void *free_rom = NULL;
20082008
dma_addr_t free_rom_bus = 0;
20092009
bool is_new_root;
@@ -2028,7 +2028,7 @@ static void bus_reset_work(struct work_struct *work)
20282028
ohci->is_root = is_new_root;
20292029

20302030
reg = reg_read(ohci, OHCI1394_SelfIDCount);
2031-
if (reg & OHCI1394_SelfIDCount_selfIDError) {
2031+
if (ohci1394_self_id_count_is_error(reg)) {
20322032
ohci_notice(ohci, "self ID receive error\n");
20332033
return;
20342034
}
@@ -2038,14 +2038,15 @@ static void bus_reset_work(struct work_struct *work)
20382038
* the inverted quadlets and a header quadlet, we shift one
20392039
* bit extra to get the actual number of self IDs.
20402040
*/
2041-
self_id_count = (reg >> 3) & 0xff;
2041+
self_id_count = ohci1394_self_id_count_get_size(reg) >> 1;
20422042

20432043
if (self_id_count > 252) {
20442044
ohci_notice(ohci, "bad selfIDSize (%08x)\n", reg);
20452045
return;
20462046
}
20472047

2048-
generation = (cond_le32_to_cpu(ohci->self_id[0], has_be_header_quirk(ohci)) >> 16) & 0xff;
2048+
quadlet = cond_le32_to_cpu(ohci->self_id[0], has_be_header_quirk(ohci));
2049+
generation = ohci1394_self_id_receive_q0_get_generation(quadlet);
20492050
rmb();
20502051

20512052
for (i = 1, j = 0; j < self_id_count; i += 2, j++) {
@@ -2102,7 +2103,8 @@ static void bus_reset_work(struct work_struct *work)
21022103
* of self IDs.
21032104
*/
21042105

2105-
new_generation = (reg_read(ohci, OHCI1394_SelfIDCount) >> 16) & 0xff;
2106+
reg = reg_read(ohci, OHCI1394_SelfIDCount);
2107+
new_generation = ohci1394_self_id_count_get_generation(reg);
21062108
if (new_generation != generation) {
21072109
ohci_notice(ohci, "new bus reset, discarding self ids\n");
21082110
return;

drivers/firewire/ohci.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#define OHCI1394_HCControl_softReset 0x00010000
3232
#define OHCI1394_SelfIDBuffer 0x064
3333
#define OHCI1394_SelfIDCount 0x068
34-
#define OHCI1394_SelfIDCount_selfIDError 0x80000000
3534
#define OHCI1394_IRMultiChanMaskHiSet 0x070
3635
#define OHCI1394_IRMultiChanMaskHiClear 0x074
3736
#define OHCI1394_IRMultiChanMaskLoSet 0x078

0 commit comments

Comments
 (0)