本文整理汇总了C++中sdio_func_id函数的典型用法代码示例。如果您正苦于以下问题:C++ sdio_func_id函数的具体用法?C++ sdio_func_id怎么用?C++ sdio_func_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sdio_func_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mwifiex_sdio_suspend
/*
* SDIO suspend.
*
* Kernel needs to suspend all functions separately. Therefore all
* registered functions must have drivers with suspend and resume
* methods. Failing that the kernel simply removes the whole card.
*
* If already not suspended, this function allocates and sends a host
* sleep activate request to the firmware and turns off the traffic.
*/
static int mwifiex_sdio_suspend(struct device *dev)
{
struct sdio_func *func = dev_to_sdio_func(dev);
struct sdio_mmc_card *card;
struct mwifiex_adapter *adapter;
mmc_pm_flag_t pm_flag = 0;
int hs_actived = 0;
int i;
int ret = 0;
if (func) {
pm_flag = sdio_get_host_pm_caps(func);
pr_debug("cmd: %s: suspend: PM flag = 0x%x\n",
sdio_func_id(func), pm_flag);
if (!(pm_flag & MMC_PM_KEEP_POWER)) {
pr_err("%s: cannot remain alive while host is"
" suspended\n", sdio_func_id(func));
return -ENOSYS;
}
card = sdio_get_drvdata(func);
if (!card || !card->adapter) {
pr_err("suspend: invalid card or adapter\n");
return 0;
}
} else {
pr_err("suspend: sdio_func is not specified\n");
return 0;
}
adapter = card->adapter;
/* Enable the Host Sleep */
hs_actived = mwifiex_enable_hs(adapter);
if (hs_actived) {
pr_debug("cmd: suspend with MMC_PM_KEEP_POWER\n");
ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
}
/* Indicate device suspended */
adapter->is_suspended = true;
for (i = 0; i < adapter->priv_num; i++)
netif_carrier_off(adapter->priv[i]->netdev);
return ret;
}
示例2: process_sdio_pending_irqs
static int process_sdio_pending_irqs(struct mmc_card *card)
{
int i, ret, count;
unsigned char pending;
unsigned char reg;
#if 0
#endif
ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_IENx, 0, ®);
if (ret) {
printk(KERN_ERR "%s: error %d reading SDIO_CCCR_IENx\n",
mmc_card_id(card), ret);
return ret;
}
ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_INTx, 0, &pending);
if (ret) {
printk(KERN_DEBUG "%s: error %d reading SDIO_CCCR_INTx\n",
mmc_card_id(card), ret);
return ret;
}
count = 0;
for (i = 1; i <= 7; i++) {
if (pending & (1 << i)) {
struct sdio_func *func = card->sdio_func[i - 1];
if (!(reg & 0x1)) {
pr_err("%s: Master interrupt is disabled but still "
"we have pending interrupt, bug in h/w??\n", __func__);
return -EINVAL;
}
if (!func) {
printk(KERN_WARNING "%s: pending IRQ for "
"non-existent function\n",
mmc_card_id(card));
ret = -EINVAL;
} else if (func->irq_handler) {
if ((reg & (1 << func->num))) {
func->irq_handler(func);
count++;
} else {
pr_err("%s: Interrupt ocurred even when IEx "
"bit is not set, bug in h/w??\n", mmc_card_id(card));
ret = -EINVAL;
}
} else {
printk(KERN_WARNING "%s: pending IRQ with no handler\n",
sdio_func_id(func));
ret = -EINVAL;
}
}
}
if (count)
return count;
return ret;
}
示例3: sdio_enable_func
/**
* sdio_enable_func - enables a SDIO function for usage
* @func: SDIO function to enable
*
* Powers up and activates a SDIO function so that register
* access is possible.
*/
int sdio_enable_func(struct sdio_func *func)
{
int ret;
unsigned char reg;
unsigned long timeout;
BUG_ON(!func);
BUG_ON(!func->card);
pr_debug("SDIO: Enabling device %s...\n", sdio_func_id(func));
ret = mmc_io_rw_direct(func->card, 0, 0, SDIO_CCCR_IOEx, 0, ®);
if (ret)
goto err;
reg |= 1 << func->num;
ret = mmc_io_rw_direct(func->card, 1, 0, SDIO_CCCR_IOEx, reg, NULL);
if (ret)
goto err;
/*
* FIXME: This should timeout based on information in the CIS,
* but we don't have card to parse that yet.
*/
timeout = jiffies + HZ;
while (1) {
ret = mmc_io_rw_direct(func->card, 0, 0, SDIO_CCCR_IORx, 0, ®);
if (ret)
goto err;
if (reg & (1 << func->num))
break;
ret = -ETIME;
if (time_after(jiffies, timeout))
goto err;
}
pr_debug("SDIO: Enabled device %s\n", sdio_func_id(func));
return 0;
err:
pr_debug("SDIO: Failed to enable device %s\n", sdio_func_id(func));
return ret;
}
示例4: process_sdio_pending_irqs
static int process_sdio_pending_irqs(struct mmc_host *host)
{
struct mmc_card *card = host->card;
int i, ret, count;
unsigned char pending;
struct sdio_func *func;
if ((!host->sdio_irq_pending) && (host->caps & MMC_CAP_SDIO_IRQ))
return 0;
/*
* Optimization, if there is only 1 function interrupt registered
* and we know an IRQ was signaled then call irq handler directly.
* Otherwise do the full probe.
*/
func = card->sdio_single_irq;
if (func && host->sdio_irq_pending) {
func->irq_handler(func);
if (func->func_status == func_suspended)
host->break_suspend = 1;
return 1;
}
ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_INTx, 0, &pending);
if (ret) {
pr_debug("%s: error %d reading SDIO_CCCR_INTx\n",
mmc_card_id(card), ret);
return ret;
}
count = 0;
for (i = 1; i <= 7; i++) {
if (pending & (1 << i)) {
func = card->sdio_func[i - 1];
if (!func) {
pr_warning("%s: pending IRQ for "
"non-existent function\n",
mmc_card_id(card));
ret = -EINVAL;
} else if (func->irq_handler) {
if (func->func_status == func_suspended)
host->break_suspend = 1;
func->irq_handler(func);
count++;
} else {
pr_warning("%s: pending IRQ with no handler\n",
sdio_func_id(func));
ret = -EINVAL;
}
}
}
if (count)
return count;
return ret;
}
示例5: mwifiex_sdio_suspend
/*
* SDIO suspend.
*
* Kernel needs to suspend all functions separately. Therefore all
* registered functions must have drivers with suspend and resume
* methods. Failing that the kernel simply removes the whole card.
*
* If already not suspended, this function allocates and sends a host
* sleep activate request to the firmware and turns off the traffic.
*/
static int mwifiex_sdio_suspend(struct device *dev)
{
struct sdio_func *func = dev_to_sdio_func(dev);
struct sdio_mmc_card *card;
struct mwifiex_adapter *adapter;
mmc_pm_flag_t pm_flag = 0;
int ret = 0;
if (func) {
pm_flag = sdio_get_host_pm_caps(func);
pr_debug("cmd: %s: suspend: PM flag = 0x%x\n",
sdio_func_id(func), pm_flag);
if (!(pm_flag & MMC_PM_KEEP_POWER)) {
pr_err("%s: cannot remain alive while host is"
" suspended\n", sdio_func_id(func));
return -ENOSYS;
}
card = sdio_get_drvdata(func);
if (!card || !card->adapter) {
pr_err("suspend: invalid card or adapter\n");
return 0;
}
} else {
pr_err("suspend: sdio_func is not specified\n");
return 0;
}
adapter = card->adapter;
/* Enable the Host Sleep */
if (!mwifiex_enable_hs(adapter)) {
dev_err(adapter->dev, "cmd: failed to suspend\n");
return -EFAULT;
}
dev_dbg(adapter->dev, "cmd: suspend with MMC_PM_KEEP_POWER\n");
ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
/* Indicate device suspended */
adapter->is_suspended = true;
return ret;
}
示例6: process_sdio_pending_irqs
static int process_sdio_pending_irqs(struct mmc_card *card)
{
int i, ret, count;
unsigned char pending;
struct sdio_func *func;
/*
* Optimization, if there is only 1 function interrupt registered
* call irq handler directly
*/
func = card->sdio_single_irq;
if (func) {
func->irq_handler(func);
return 1;
}
ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_INTx, 0, &pending);
if (ret) {
pr_debug("%s: error %d reading SDIO_CCCR_INTx\n",
mmc_card_id(card), ret);
return ret;
}
count = 0;
for (i = 1; i <= 7; i++) {
if (pending & (1 << i)) {
func = card->sdio_func[i - 1];
if (!func) {
pr_warning("%s: pending IRQ for "
"non-existent function\n",
mmc_card_id(card));
ret = -EINVAL;
} else if (func->irq_handler) {
func->irq_handler(func);
count++;
} else {
pr_warning("%s: pending IRQ with no handler\n",
sdio_func_id(func));
ret = -EINVAL;
}
}
}
if (count)
return count;
return ret;
}
示例7: process_sdio_pending_irqs
static int process_sdio_pending_irqs(struct mmc_card *card)
{
int i, ret, count;
unsigned char pending;
ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_INTx, 0, &pending);
if (ret) {
printk(KERN_DEBUG "%s: error %d reading SDIO_CCCR_INTx\n",
mmc_card_id(card), ret);
sdio_debug = 1;
return ret;
}
count = 0;
for (i = 1; i <= 7; i++) {
if (pending & (1 << i)) {
struct sdio_func *func = card->sdio_func[i - 1];
if (!func) {
printk(KERN_WARNING "%s: pending IRQ for "
"non-existant function\n",
mmc_card_id(card));
ret = -EINVAL;
} else if (func->irq_handler) {
if (sdio_debug) {
printk(KERN_DEBUG "%s: pending irq for func%d\n",
mmc_card_id(card), i);
}
func->irq_handler(func);
count++;
} else {
printk(KERN_WARNING "%s: pending IRQ with no handler\n",
sdio_func_id(func));
ret = -EINVAL;
}
}
}
if (sdio_debug) {
printk(KERN_DEBUG "%s: pending irq 0x%x\n",
mmc_card_id(card), pending);
sdio_debug = 0;
}
if (count)
return count;
return ret;
}
示例8: woal_sdio_resume
/** @brief This function handles client driver resume
*
* @param dev A pointer to device structure
* @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
*/
int
woal_sdio_resume(struct device *dev)
{
struct sdio_func *func = dev_to_sdio_func(dev);
mmc_pm_flag_t pm_flags = 0;
moal_handle *handle = NULL;
struct sdio_mmc_card *cardp;
int i;
ENTER();
if (func) {
pm_flags = sdio_get_host_pm_caps(func);
PRINTM(MCMND, "%s: resume: PM flags = 0x%x\n", sdio_func_id(func),
pm_flags);
cardp = sdio_get_drvdata(func);
if (!cardp || !cardp->handle) {
PRINTM(MERROR, "Card or moal_handle structure is not valid\n");
LEAVE();
return MLAN_STATUS_SUCCESS;
}
} else {
PRINTM(MERROR, "sdio_func is not specified\n");
LEAVE();
return MLAN_STATUS_SUCCESS;
}
handle = cardp->handle;
if (handle->is_suspended == MFALSE) {
PRINTM(MWARN, "Device already resumed\n");
LEAVE();
return MLAN_STATUS_SUCCESS;
}
handle->is_suspended = MFALSE;
for (i = 0; i < handle->priv_num; i++)
netif_carrier_on(handle->priv[i]->netdev);
/* Disable Host Sleep */
woal_hs_cfg_cancel(woal_get_priv(handle, MLAN_BSS_TYPE_ANY), MOAL_NO_WAIT);
LEAVE();
return MLAN_STATUS_SUCCESS;
}
示例9: sdio_release_irq
/**
* sdio_release_irq - release the IRQ for a SDIO function
* @func: SDIO function
*
* Disable and release the IRQ for the given SDIO function.
*/
int sdio_release_irq(struct sdio_func *func)
{
int ret;
unsigned char reg;
BUG_ON(!func);
BUG_ON(!func->card);
pr_debug("SDIO: Disabling IRQ for %s...\n", sdio_func_id(func));
#ifndef CONFIG_HUAWEI_WIFI_SDCC
if (func->irq_handler) {
func->irq_handler = NULL;
sdio_card_irq_put(func->card);
}
#endif
ret = mmc_io_rw_direct(func->card, 0, 0, SDIO_CCCR_IENx, 0, ®);
if (ret)
return ret;
reg &= ~(1 << func->num);
/* Disable master interrupt with the last function interrupt */
if (!(reg & 0xFE))
reg = 0;
ret = mmc_io_rw_direct(func->card, 1, 0, SDIO_CCCR_IENx, reg, NULL);
if (ret)
return ret;
#ifdef CONFIG_HUAWEI_WIFI_SDCC
if (func->irq_handler) {
func->irq_handler = NULL;
sdio_card_irq_put(func->card);
}
#endif
return 0;
}
示例10: woal_sdio_resume
/** @brief This function handles client driver resume
*
* @param dev A pointer to device structure
* @return MLAN_STATUS_SUCCESS
*/
int
woal_sdio_resume(struct device *dev)
{
struct sdio_func *func = dev_to_sdio_func(dev);
mmc_pm_flag_t pm_flags = 0;
moal_handle *handle = NULL;
struct sdio_mmc_card *cardp;
int i;
ENTER();
PRINTM(MCMND, "<--- Enter woal_sdio_resume --->\n");
wifi_enable_hostwake_irq(MFALSE);
pm_flags = sdio_get_host_pm_caps(func);
PRINTM(MCMND, "%s: resume: PM flags = 0x%x\n", sdio_func_id(func),
pm_flags);
cardp = sdio_get_drvdata(func);
if (!cardp || !cardp->handle) {
PRINTM(MERROR, "Card or moal_handle structure is not valid\n");
LEAVE();
return MLAN_STATUS_SUCCESS;
}
handle = cardp->handle;
if (handle->is_suspended == MFALSE) {
PRINTM(MWARN, "Device already resumed\n");
LEAVE();
return MLAN_STATUS_SUCCESS;
}
handle->is_suspended = MFALSE;
if (woal_check_driver_status(handle)) {
PRINTM(MERROR, "Resuem, device is in hang state\n");
LEAVE();
return MLAN_STATUS_SUCCESS;
}
for (i = 0; i < handle->priv_num; i++)
netif_device_attach(handle->priv[i]->netdev);
/* Disable Host Sleep */
woal_cancel_hs(woal_get_priv(handle, MLAN_BSS_ROLE_ANY), MOAL_NO_WAIT);
PRINTM(MCMND, "<--- Leave woal_sdio_resume --->\n");
LEAVE();
return MLAN_STATUS_SUCCESS;
}
示例11: bt_sdio_resume
/** @brief This function handles client driver resume
*
* @param dev A pointer to device structure
* @return BT_STATUS_SUCCESS
*/
int
bt_sdio_resume(struct device *dev)
{
struct sdio_func *func = dev_to_sdio_func(dev);
mmc_pm_flag_t pm_flags = 0;
bt_private *priv = NULL;
struct sdio_mmc_card *cardp;
struct hci_dev *hcidev;
ENTER();
if (func) {
pm_flags = sdio_get_host_pm_caps(func);
PRINTM(CMD, "BT: %s: resume: PM flags = 0x%x\n", sdio_func_id(func),
pm_flags);
cardp = sdio_get_drvdata(func);
if (!cardp || !cardp->priv) {
PRINTM(ERROR, "BT: Card or priv structure is not valid\n");
LEAVE();
return BT_STATUS_SUCCESS;
}
} else {
PRINTM(ERROR, "BT: sdio_func is not specified\n");
LEAVE();
return BT_STATUS_SUCCESS;
}
priv = cardp->priv;
priv->adapter->is_suspended = FALSE;
hcidev = priv->bt_dev.hcidev;
PRINTM(CMD, "BT %s: SDIO resume\n", hcidev->name);
hci_resume_dev(hcidev);
sbi_wakeup_firmware(priv);
priv->adapter->hs_state = HS_DEACTIVATED;
PRINTM(CMD, "BT:%s: HS DEACTIVATED in Resume!\n", hcidev->name);
LEAVE();
return BT_STATUS_SUCCESS;
}
示例12: process_sdio_pending_irqs
static int process_sdio_pending_irqs(struct mmc_host *host)
{
struct mmc_card *card = host->card;
int i, ret, count;
unsigned char pending;
struct sdio_func *func;
/*
* Optimization, if there is only 1 function interrupt registered
* and we know an IRQ was signaled then call irq handler directly.
* Otherwise do the full probe.
*/
func = card->sdio_single_irq;
if (func && host->sdio_irq_pending) {
func->irq_handler(func);
return 1;
}
ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_INTx, 0, &pending);
if (ret) {
pr_debug("%s: error %d reading SDIO_CCCR_INTx\n",
mmc_card_id(card), ret);
return ret;
}
if (pending && mmc_card_broken_irq_polling(card) &&
!(host->caps & MMC_CAP_SDIO_IRQ)) {
unsigned char dummy;
/* A fake interrupt could be created when we poll SDIO_CCCR_INTx
* register with a Marvell SD8797 card. A dummy CMD52 read to
* function 0 register 0xff can avoid this.
*/
mmc_io_rw_direct(card, 0, 0, 0xff, 0, &dummy);
}
count = 0;
for (i = 1; i <= 7; i++) {
if (pending & (1 << i)) {
func = card->sdio_func[i - 1];
if (!func) {
pr_warning("%s: pending IRQ for "
"non-existent function\n",
mmc_card_id(card));
ret = -EINVAL;
} else if (func->irq_handler) {
func->irq_handler(func);
count++;
} else {
pr_warning("%s: pending IRQ with no handler\n",
sdio_func_id(func));
ret = -EINVAL;
}
}
}
if (count)
return count;
return ret;
}
示例13: sdio_irq_thread
//.........这里部分代码省略.........
"ksdioirqd/%s", mmc_hostname(host));
if (IS_ERR(host->sdio_irq_thread)) {
int err = PTR_ERR(host->sdio_irq_thread);
host->sdio_irqs--;
return err;
}
} else {
mmc_host_clk_hold(host);
host->ops->enable_sdio_irq(host, 1);
mmc_host_clk_release(host);
}
}
return 0;
}
static int sdio_card_irq_put(struct mmc_card *card)
{
struct mmc_host *host = card->host;
WARN_ON(!host->claimed);
BUG_ON(host->sdio_irqs < 1);
if (!--host->sdio_irqs) {
if (!(host->caps2 & MMC_CAP2_SDIO_IRQ_NOTHREAD)) {
atomic_set(&host->sdio_irq_thread_abort, 1);
kthread_stop(host->sdio_irq_thread);
} else {
mmc_host_clk_hold(host);
host->ops->enable_sdio_irq(host, 0);
mmc_host_clk_release(host);
}
}
return 0;
}
/* If there is only 1 function registered set sdio_single_irq */
static void sdio_single_irq_set(struct mmc_card *card)
{
struct sdio_func *func;
int i;
card->sdio_single_irq = NULL;
if ((card->host->caps & MMC_CAP_SDIO_IRQ) &&
card->host->sdio_irqs == 1)
for (i = 0; i < card->sdio_funcs; i++) {
func = card->sdio_func[i];
if (func && func->irq_handler) {
card->sdio_single_irq = func;
break;
}
}
}
/**
* sdio_claim_irq - claim the IRQ for a SDIO function
* @func: SDIO function
* @handler: IRQ handler callback
*
* Claim and activate the IRQ for the given SDIO function. The provided
* handler will be called when that IRQ is asserted. The host is always
* claimed already when the handler is called so the handler must not
* call sdio_claim_host() nor sdio_release_host().
*/
int sdio_claim_irq(struct sdio_func *func, sdio_irq_handler_t *handler)
{
int ret;
unsigned char reg;
BUG_ON(!func);
BUG_ON(!func->card);
pr_debug("SDIO: Enabling IRQ for %s...\n", sdio_func_id(func));
if (func->irq_handler) {
pr_debug("SDIO: IRQ for %s already in use.\n", sdio_func_id(func));
return -EBUSY;
}
ret = mmc_io_rw_direct(func->card, 0, 0, SDIO_CCCR_IENx, 0, ®);
if (ret)
return ret;
reg |= 1 << func->num;
reg |= 1; /* Master interrupt enable */
ret = mmc_io_rw_direct(func->card, 1, 0, SDIO_CCCR_IENx, reg, NULL);
if (ret)
return ret;
func->irq_handler = handler;
ret = sdio_card_irq_get(func->card);
if (ret)
func->irq_handler = NULL;
sdio_single_irq_set(func->card);
return ret;
}
示例14: woal_sdio_suspend
/** @brief This function handles client driver suspend
*
* @param dev A pointer to device structure
* @return MLAN_STATUS_SUCCESS or error code
*/
int
woal_sdio_suspend(struct device *dev)
{
struct sdio_func *func = dev_to_sdio_func(dev);
mmc_pm_flag_t pm_flags = 0;
moal_handle *handle = NULL;
struct sdio_mmc_card *cardp;
int i, retry_num = 8;
int ret = MLAN_STATUS_SUCCESS;
int hs_actived = 0;
mlan_ds_ps_info pm_info;
ENTER();
PRINTM(MCMND, "<--- Enter woal_sdio_suspend --->\n");
pm_flags = sdio_get_host_pm_caps(func);
PRINTM(MCMND, "%s: suspend: PM flags = 0x%x\n", sdio_func_id(func),
pm_flags);
if (!(pm_flags & MMC_PM_KEEP_POWER)) {
PRINTM(MERROR,
"%s: cannot remain alive while host is suspended\n",
sdio_func_id(func));
LEAVE();
return -ENOSYS;
}
cardp = sdio_get_drvdata(func);
if (!cardp || !cardp->handle) {
PRINTM(MERROR, "Card or moal_handle structure is not valid\n");
LEAVE();
return MLAN_STATUS_SUCCESS;
}
handle = cardp->handle;
if (handle->is_suspended == MTRUE) {
PRINTM(MWARN, "Device already suspended\n");
LEAVE();
return MLAN_STATUS_SUCCESS;
}
if (handle->fw_dump) {
PRINTM(MMSG, "suspend not allowed while FW dump!");
ret = -EBUSY;
goto done;
}
handle->suspend_fail = MFALSE;
memset(&pm_info, 0, sizeof(pm_info));
for (i = 0; i < retry_num; i++) {
if (MLAN_STATUS_SUCCESS ==
woal_get_pm_info(woal_get_priv(handle, MLAN_BSS_ROLE_ANY),
&pm_info)) {
if (pm_info.is_suspend_allowed == MTRUE)
break;
else
PRINTM(MMSG,
"Suspend not allowed and retry again\n");
}
woal_sched_timeout(100);
}
if (pm_info.is_suspend_allowed == MFALSE) {
PRINTM(MMSG, "Suspend not allowed\n");
ret = -EBUSY;
goto done;
}
for (i = 0; i < handle->priv_num; i++)
netif_device_detach(handle->priv[i]->netdev);
if (pm_keep_power) {
/* Enable the Host Sleep */
#ifdef MMC_PM_FUNC_SUSPENDED
handle->suspend_notify_req = MTRUE;
#endif
hs_actived =
woal_enable_hs(woal_get_priv
(handle, MLAN_BSS_ROLE_ANY));
#ifdef MMC_PM_FUNC_SUSPENDED
handle->suspend_notify_req = MFALSE;
#endif
if (hs_actived) {
#ifdef MMC_PM_SKIP_RESUME_PROBE
PRINTM(MCMND,
"suspend with MMC_PM_KEEP_POWER and MMC_PM_SKIP_RESUME_PROBE\n");
ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER |
MMC_PM_SKIP_RESUME_PROBE);
#else
PRINTM(MCMND, "suspend with MMC_PM_KEEP_POWER\n");
ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
#endif
} else {
PRINTM(MMSG, "HS not actived, suspend fail!");
handle->suspend_fail = MTRUE;
for (i = 0; i < handle->priv_num; i++)
netif_device_attach(handle->priv[i]->netdev);
ret = -EBUSY;
goto done;
}
}
//.........这里部分代码省略.........
示例15: smssdio_probe
static int smssdio_probe(struct sdio_func *func,
const struct sdio_device_id *id)
{
int ret;
int board_id;
struct smssdio_device *smsdev;
struct smsdevice_params_t params;
board_id = id->driver_data;
smsdev = kzalloc(sizeof(struct smssdio_device), GFP_KERNEL);
if (!smsdev)
return -ENOMEM;
smsdev->func = func;
memset(¶ms, 0, sizeof(struct smsdevice_params_t));
params.device = &func->dev;
params.buffer_size = 0x5000; /* ?? */
params.num_buffers = 22; /* ?? */
params.context = smsdev;
snprintf(params.devpath, sizeof(params.devpath),
"sdio\\%s", sdio_func_id(func));
params.sendrequest_handler = smssdio_sendrequest;
params.device_type = sms_get_board(board_id)->type;
if (params.device_type != SMS_STELLAR)
params.flags |= SMS_DEVICE_FAMILY2;
else {
/*
* FIXME: Stellar needs special handling...
*/
ret = -ENODEV;
goto free;
}
ret = smscore_register_device(¶ms, &smsdev->coredev);
if (ret < 0)
goto free;
smscore_set_board_id(smsdev->coredev, board_id);
sdio_claim_host(func);
ret = sdio_enable_func(func);
if (ret)
goto release;
ret = sdio_set_block_size(func, 128);
if (ret)
goto disable;
ret = sdio_claim_irq(func, smssdio_interrupt);
if (ret)
goto disable;
sdio_set_drvdata(func, smsdev);
sdio_release_host(func);
ret = smscore_start_device(smsdev->coredev);
if (ret < 0)
goto reclaim;
return 0;
reclaim:
sdio_claim_host(func);
sdio_release_irq(func);
disable:
sdio_disable_func(func);
release:
sdio_release_host(func);
smscore_unregister_device(smsdev->coredev);
free:
kfree(smsdev);
return ret;
}