Skip to content

Commit 29192a1

Browse files
andy-shevkuba-moo
authored andcommitted
firewire: net: Make use of get_unaligned_be48(), put_unaligned_be48()
Since we have a proper endianness converters for BE 48-bit data use them. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 39befe3 commit 29192a1

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

drivers/firewire/net.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -201,15 +201,6 @@ struct fwnet_packet_task {
201201
u8 enqueued;
202202
};
203203

204-
/*
205-
* Get fifo address embedded in hwaddr
206-
*/
207-
static __u64 fwnet_hwaddr_fifo(union fwnet_hwaddr *ha)
208-
{
209-
return (u64)get_unaligned_be16(&ha->uc.fifo_hi) << 32
210-
| get_unaligned_be32(&ha->uc.fifo_lo);
211-
}
212-
213204
/*
214205
* saddr == NULL means use device source address.
215206
* daddr == NULL means leave destination address (eg unresolved arp).
@@ -1306,7 +1297,7 @@ static netdev_tx_t fwnet_tx(struct sk_buff *skb, struct net_device *net)
13061297
max_payload = peer->max_payload;
13071298
datagram_label_ptr = &peer->datagram_label;
13081299

1309-
ptask->fifo_addr = fwnet_hwaddr_fifo(ha);
1300+
ptask->fifo_addr = get_unaligned_be48(ha->uc.fifo);
13101301
ptask->generation = generation;
13111302
ptask->dest_node = dest_node;
13121303
ptask->speed = peer->speed;
@@ -1494,8 +1485,7 @@ static int fwnet_probe(struct fw_unit *unit,
14941485
ha.uc.uniq_id = cpu_to_be64(card->guid);
14951486
ha.uc.max_rec = dev->card->max_receive;
14961487
ha.uc.sspd = dev->card->link_speed;
1497-
ha.uc.fifo_hi = cpu_to_be16(dev->local_fifo >> 32);
1498-
ha.uc.fifo_lo = cpu_to_be32(dev->local_fifo & 0xffffffff);
1488+
put_unaligned_be48(dev->local_fifo, ha.uc.fifo);
14991489
dev_addr_set(net, ha.u);
15001490

15011491
memset(net->broadcast, -1, net->addr_len);

include/net/firewire.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ union fwnet_hwaddr {
1313
__be64 uniq_id; /* EUI-64 */
1414
u8 max_rec; /* max packet size */
1515
u8 sspd; /* max speed */
16-
__be16 fifo_hi; /* hi 16bits of FIFO addr */
17-
__be32 fifo_lo; /* lo 32bits of FIFO addr */
16+
u8 fifo[6]; /* FIFO addr */
1817
} __packed uc;
1918
};
2019

0 commit comments

Comments
 (0)