Skip to content

Commit

Permalink
[MMC] Ensure correct mmc_priv() behaviour
Browse files Browse the repository at this point in the history
mmc_priv() has some nasty effects if the wrong pointer type is
passed to it.  Introduce type checking, which also means we get
the right type.  Also add an additional member to mmc_host which
is used to align host-private data appropriately.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Russell King authored and Russell King committed Sep 8, 2005
1 parent 8dc0033 commit 01357dc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion include/linux/mmc/host.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,20 @@ struct mmc_host {
struct mmc_card *card_selected; /* the selected MMC card */

struct work_struct detect;

unsigned long private[0] ____cacheline_aligned;
};

extern struct mmc_host *mmc_alloc_host(int extra, struct device *);
extern int mmc_add_host(struct mmc_host *);
extern void mmc_remove_host(struct mmc_host *);
extern void mmc_free_host(struct mmc_host *);

#define mmc_priv(x) ((void *)((x) + 1))
static inline void *mmc_priv(struct mmc_host *host)
{
return (void *)host->private;
}

#define mmc_dev(x) ((x)->dev)
#define mmc_hostname(x) ((x)->class_dev.class_id)

Expand Down

0 comments on commit 01357dc

Please sign in to comment.