linux/drivers/memstick/core/memstick.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 *  Sony MemoryStick support
 *
 *  Copyright (C) 2007 Alex Dubov <[email protected]>
 *
 * Special thanks to Carlos Corbacho for providing various MemoryStick cards
 * that made this driver possible.
 */

#include <linux/memstick.h>
#include <linux/idr.h>
#include <linux/fs.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>

#define DRIVER_NAME

static unsigned int cmd_retries =;
module_param(cmd_retries, uint, 0644);

static struct workqueue_struct *workqueue;
static DEFINE_IDR(memstick_host_idr);
static DEFINE_SPINLOCK(memstick_host_lock);

static int memstick_dev_match(struct memstick_dev *card,
			      struct memstick_device_id *id)
{}

static int memstick_bus_match(struct device *dev, const struct device_driver *drv)
{}

static int memstick_uevent(const struct device *dev, struct kobj_uevent_env *env)
{}

static int memstick_device_probe(struct device *dev)
{}

static void memstick_device_remove(struct device *dev)
{}

#ifdef CONFIG_PM

static int memstick_device_suspend(struct device *dev, pm_message_t state)
{}

static int memstick_device_resume(struct device *dev)
{}

#else

#define memstick_device_suspend
#define memstick_device_resume

#endif /* CONFIG_PM */

#define MEMSTICK_ATTR(name, format)

MEMSTICK_ATTR(type, "%02X");
MEMSTICK_ATTR(category, "%02X");
MEMSTICK_ATTR(class, "%02X");

static struct attribute *memstick_dev_attrs[] =;
ATTRIBUTE_GROUPS();

static const struct bus_type memstick_bus_type =;

static void memstick_free(struct device *dev)
{}

static struct class memstick_host_class =;

static void memstick_free_card(struct device *dev)
{}

static int memstick_dummy_check(struct memstick_dev *card)
{}

/**
 * memstick_detect_change - schedule media detection on memstick host
 * @host - host to use
 */
void memstick_detect_change(struct memstick_host *host)
{}
EXPORT_SYMBOL();

/**
 * memstick_next_req - called by host driver to obtain next request to process
 * @host - host to use
 * @mrq - pointer to stick the request to
 *
 * Host calls this function from idle state (*mrq == NULL) or after finishing
 * previous request (*mrq should point to it). If previous request was
 * unsuccessful, it is retried for predetermined number of times. Return value
 * of 0 means that new request was assigned to the host.
 */
int memstick_next_req(struct memstick_host *host, struct memstick_request **mrq)
{}
EXPORT_SYMBOL();

/**
 * memstick_new_req - notify the host that some requests are pending
 * @host - host to use
 */
void memstick_new_req(struct memstick_host *host)
{}
EXPORT_SYMBOL();

/**
 * memstick_init_req_sg - set request fields needed for bulk data transfer
 * @mrq - request to use
 * @tpc - memstick Transport Protocol Command
 * @sg - TPC argument
 */
void memstick_init_req_sg(struct memstick_request *mrq, unsigned char tpc,
			  const struct scatterlist *sg)
{}
EXPORT_SYMBOL();

/**
 * memstick_init_req - set request fields needed for short data transfer
 * @mrq - request to use
 * @tpc - memstick Transport Protocol Command
 * @buf - TPC argument buffer
 * @length - TPC argument size
 *
 * The intended use of this function (transfer of data items several bytes
 * in size) allows us to just copy the value between request structure and
 * user supplied buffer.
 */
void memstick_init_req(struct memstick_request *mrq, unsigned char tpc,
		       const void *buf, size_t length)
{}
EXPORT_SYMBOL();

/*
 * Functions prefixed with "h_" are protocol callbacks. They can be called from
 * interrupt context. Return value of 0 means that request processing is still
 * ongoing, while special error value of -EAGAIN means that current request is
 * finished (and request processor should come back some time later).
 */

static int h_memstick_read_dev_id(struct memstick_dev *card,
				  struct memstick_request **mrq)
{}

static int h_memstick_set_rw_addr(struct memstick_dev *card,
				  struct memstick_request **mrq)
{}

/**
 * memstick_set_rw_addr - issue SET_RW_REG_ADDR request and wait for it to
 *                        complete
 * @card - media device to use
 */
int memstick_set_rw_addr(struct memstick_dev *card)
{}
EXPORT_SYMBOL();

static struct memstick_dev *memstick_alloc_card(struct memstick_host *host)
{}

static int memstick_power_on(struct memstick_host *host)
{}

static void memstick_check(struct work_struct *work)
{}

/**
 * memstick_alloc_host - allocate a memstick_host structure
 * @extra: size of the user private data to allocate
 * @dev: parent device of the host
 */
struct memstick_host *memstick_alloc_host(unsigned int extra,
					  struct device *dev)
{}
EXPORT_SYMBOL();

/**
 * memstick_add_host - start request processing on memstick host
 * @host - host to use
 */
int memstick_add_host(struct memstick_host *host)
{}
EXPORT_SYMBOL();

/**
 * memstick_remove_host - stop request processing on memstick host
 * @host - host to use
 */
void memstick_remove_host(struct memstick_host *host)
{}
EXPORT_SYMBOL();

/**
 * memstick_free_host - free memstick host
 * @host - host to use
 */
void memstick_free_host(struct memstick_host *host)
{}
EXPORT_SYMBOL();

/**
 * memstick_suspend_host - notify bus driver of host suspension
 * @host - host to use
 */
void memstick_suspend_host(struct memstick_host *host)
{}
EXPORT_SYMBOL();

/**
 * memstick_resume_host - notify bus driver of host resumption
 * @host - host to use
 */
void memstick_resume_host(struct memstick_host *host)
{}
EXPORT_SYMBOL();

int memstick_register_driver(struct memstick_driver *drv)
{}
EXPORT_SYMBOL();

void memstick_unregister_driver(struct memstick_driver *drv)
{}
EXPORT_SYMBOL();


static int __init memstick_init(void)
{}

static void __exit memstick_exit(void)
{}

module_init();
module_exit(memstick_exit);

MODULE_AUTHOR();
MODULE_LICENSE();
MODULE_DESCRIPTION();