162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci *  linux/drivers/mmc/core/bus.h
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci *  Copyright (C) 2003 Russell King, All Rights Reserved.
662306a36Sopenharmony_ci *  Copyright 2007 Pierre Ossman
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci#ifndef _MMC_CORE_BUS_H
962306a36Sopenharmony_ci#define _MMC_CORE_BUS_H
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <linux/device.h>
1262306a36Sopenharmony_ci#include <linux/sysfs.h>
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_cistruct mmc_host;
1562306a36Sopenharmony_cistruct mmc_card;
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#define MMC_DEV_ATTR(name, fmt, args...)					\
1862306a36Sopenharmony_cistatic ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *attr, char *buf)	\
1962306a36Sopenharmony_ci{										\
2062306a36Sopenharmony_ci	struct mmc_card *card = mmc_dev_to_card(dev);				\
2162306a36Sopenharmony_ci	return sysfs_emit(buf, fmt, args);					\
2262306a36Sopenharmony_ci}										\
2362306a36Sopenharmony_cistatic DEVICE_ATTR(name, S_IRUGO, mmc_##name##_show, NULL)
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_cistruct mmc_card *mmc_alloc_card(struct mmc_host *host,
2662306a36Sopenharmony_ci	struct device_type *type);
2762306a36Sopenharmony_ciint mmc_add_card(struct mmc_card *card);
2862306a36Sopenharmony_civoid mmc_remove_card(struct mmc_card *card);
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ciint mmc_register_bus(void);
3162306a36Sopenharmony_civoid mmc_unregister_bus(void);
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_cistruct mmc_driver {
3462306a36Sopenharmony_ci	struct device_driver drv;
3562306a36Sopenharmony_ci	int (*probe)(struct mmc_card *card);
3662306a36Sopenharmony_ci	void (*remove)(struct mmc_card *card);
3762306a36Sopenharmony_ci	void (*shutdown)(struct mmc_card *card);
3862306a36Sopenharmony_ci};
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ciint mmc_register_driver(struct mmc_driver *drv);
4162306a36Sopenharmony_civoid mmc_unregister_driver(struct mmc_driver *drv);
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci#endif
44