Pierre Ossman | 4101c16 | 2007-05-19 13:39:01 +0200 | [diff] [blame] | 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 | |
Ulf Hansson | 4facdde | 2017-01-13 14:14:14 +0100 | [diff] [blame] | 14 | #include <linux/device.h> |
| 15 | |
Ulf Hansson | 066185d | 2017-01-13 14:14:07 +0100 | [diff] [blame] | 16 | struct mmc_host; |
| 17 | struct mmc_card; |
Ulf Hansson | 066185d | 2017-01-13 14:14:07 +0100 | [diff] [blame] | 18 | |
Pierre Ossman | 51ec92e | 2008-03-21 23:54:50 +0100 | [diff] [blame] | 19 | #define MMC_DEV_ATTR(name, fmt, args...) \ |
| 20 | static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *attr, char *buf) \ |
| 21 | { \ |
Andy Shevchenko | 265cdc9 | 2010-09-17 20:32:25 -0400 | [diff] [blame] | 22 | struct mmc_card *card = mmc_dev_to_card(dev); \ |
Pierre Ossman | 51ec92e | 2008-03-21 23:54:50 +0100 | [diff] [blame] | 23 | return sprintf(buf, fmt, args); \ |
| 24 | } \ |
| 25 | static DEVICE_ATTR(name, S_IRUGO, mmc_##name##_show, NULL) |
| 26 | |
| 27 | struct mmc_card *mmc_alloc_card(struct mmc_host *host, |
| 28 | struct device_type *type); |
Pierre Ossman | 4101c16 | 2007-05-19 13:39:01 +0200 | [diff] [blame] | 29 | int mmc_add_card(struct mmc_card *card); |
| 30 | void mmc_remove_card(struct mmc_card *card); |
| 31 | |
| 32 | int mmc_register_bus(void); |
| 33 | void mmc_unregister_bus(void); |
| 34 | |
Ulf Hansson | 4facdde | 2017-01-13 14:14:14 +0100 | [diff] [blame] | 35 | struct mmc_driver { |
| 36 | struct device_driver drv; |
| 37 | int (*probe)(struct mmc_card *card); |
| 38 | void (*remove)(struct mmc_card *card); |
| 39 | void (*shutdown)(struct mmc_card *card); |
| 40 | }; |
Pierre Ossman | 4101c16 | 2007-05-19 13:39:01 +0200 | [diff] [blame] | 41 | |
Ulf Hansson | 4facdde | 2017-01-13 14:14:14 +0100 | [diff] [blame] | 42 | int mmc_register_driver(struct mmc_driver *drv); |
| 43 | void mmc_unregister_driver(struct mmc_driver *drv); |
| 44 | |
| 45 | #endif |