Skip to content

Commit

Permalink
firewire: fw-sbp2: correctly dereference by container_of
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jay Fenlason authored and Stefan Richter committed Jul 9, 2007
1 parent 7ada60e commit 6f06148
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/firewire/fw-sbp2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6f06148

Please sign in to comment.