bus.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * linux/drivers/mmc/core/bus.h
  3. *
  4. * Copyright (C) 2003 Russell King, All Rights Reserved.
  5. * Copyright 2007 Pierre Ossman
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef _MMC_CORE_BUS_H
  12. #define _MMC_CORE_BUS_H
  13. #include <linux/device.h>
  14. struct mmc_host;
  15. struct mmc_card;
  16. #define MMC_DEV_ATTR(name, fmt, args...) \
  17. static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *attr, char *buf) \
  18. { \
  19. struct mmc_card *card = mmc_dev_to_card(dev); \
  20. return sprintf(buf, fmt, args); \
  21. } \
  22. static DEVICE_ATTR(name, S_IRUGO, mmc_##name##_show, NULL)
  23. struct mmc_card *mmc_alloc_card(struct mmc_host *host,
  24. struct device_type *type);
  25. int mmc_add_card(struct mmc_card *card);
  26. void mmc_remove_card(struct mmc_card *card);
  27. int mmc_register_bus(void);
  28. void mmc_unregister_bus(void);
  29. struct mmc_driver {
  30. struct device_driver drv;
  31. int (*probe)(struct mmc_card *card);
  32. void (*remove)(struct mmc_card *card);
  33. void (*shutdown)(struct mmc_card *card);
  34. };
  35. int mmc_register_driver(struct mmc_driver *drv);
  36. void mmc_unregister_driver(struct mmc_driver *drv);
  37. #endif