summaryrefslogtreecommitdiff
path: root/drivers/firewire/fw-sbp2.c
diff options
context:
space:
mode:
authorJay Fenlason <fenlason@redhat.com>2007-06-27 16:04:33 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-07-10 00:07:46 +0200
commit6f061487f7d31427d7e8f420f366e5537ae16f43 (patch)
treebba76e89a1ef9585f8105f61d2b72251b518701c /drivers/firewire/fw-sbp2.c
parent7ada60e367640fa8a4a349d9b105f235f346238b (diff)
firewire: fw-sbp2: correctly dereference by container_of
Replace a cast with a container_of(). As long as nobody reorders the structure elements, they do the same thing, but container_of() is more readable. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (added complete_command_orb) Acked-by: Kristian Høgsberg <krh@redhat.com>
Diffstat (limited to 'drivers/firewire/fw-sbp2.c')
-rw-r--r--drivers/firewire/fw-sbp2.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index 2c39f19a9ee1..1fc1af7f55af 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -395,7 +395,7 @@ static void
complete_management_orb(struct sbp2_orb *base_orb, struct sbp2_status *status)
{
struct sbp2_management_orb *orb =
- (struct sbp2_management_orb *)base_orb;
+ container_of(base_orb, struct sbp2_management_orb, base);
if (status)
memcpy(&orb->status, status, sizeof(*status));
@@ -838,7 +838,8 @@ sbp2_status_to_sense_data(u8 *sbp2_status, u8 *sense_data)
static void
complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status)
{
- struct sbp2_command_orb *orb = (struct sbp2_command_orb *)base_orb;
+ struct sbp2_command_orb *orb =
+ container_of(base_orb, struct sbp2_command_orb, base);
struct fw_unit *unit = orb->unit;
struct fw_device *device = fw_device(unit->device.parent);
struct scatterlist *sg;