bus.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * linux/drivers/mmc/core/bus.h
  4. *
  5. * Copyright (C) 2003 Russell King, All Rights Reserved.
  6. * Copyright 2007 Pierre Ossman
  7. */
  8. #ifndef _MMC_CORE_BUS_H
  9. #define _MMC_CORE_BUS_H
  10. #include <linux/device.h>
  11. #include <linux/sysfs.h>
  12. struct mmc_host;
  13. struct mmc_card;
  14. #define MMC_DEV_ATTR(name, fmt, args...) \
  15. static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *attr, char *buf) \
  16. { \
  17. struct mmc_card *card = mmc_dev_to_card(dev); \
  18. return sysfs_emit(buf, fmt, args); \
  19. } \
  20. static DEVICE_ATTR(name, S_IRUGO, mmc_##name##_show, NULL)
  21. struct mmc_card *mmc_alloc_card(struct mmc_host *host,
  22. const struct device_type *type);
  23. int mmc_add_card(struct mmc_card *card);
  24. void mmc_remove_card(struct mmc_card *card);
  25. int mmc_register_bus(void);
  26. void mmc_unregister_bus(void);
  27. struct mmc_driver {
  28. struct device_driver drv;
  29. int (*probe)(struct mmc_card *card);
  30. void (*remove)(struct mmc_card *card);
  31. void (*shutdown)(struct mmc_card *card);
  32. };
  33. int mmc_register_driver(struct mmc_driver *drv);
  34. void mmc_unregister_driver(struct mmc_driver *drv);
  35. #endif