Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/drzeus/mmc

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc: (26 commits)
  mmc: sdio_ops.c should #include "sdio_ops.h"
  mmc: proper prototypes for mmc_attach_*()
  mmc: make __mmc_release_bus() static
  sdhci: improve no card, no reset quirk
  MMC: OMAP: Do not busy wait for end of command for ever
  MMC: OMAP: Start new commands from work queue instead of irq
  MMC: OMAP: Lazy clock shutdown
  MMC: OMAP: Move failing command abortion to workqueue
  MMC: OMAP: Use tasklet instead of workqueue for cover switch notification
  MMC: OMAP: Check the get_cover_state function pointer if not set
  MMC: OMAP: Using setup_timer instead of init_timer
  MMC: OMAP: Abort stuck commands
  MMC: OMAP: General cleanup for MMC multislot support
  MMC: OMAP: Power functions modified to MMC multislot support
  MMC: OMAP: Fix timeout calculation for MMC multislot support
  MMC: OMAP: New release dma and abort xfer functions
  MMC: OMAP: Add back cover switch support
  MMC: OMAP: Introduce new multislot structure and change driver to use it
  MMC: OMAP: Remove cover switch handling to allow adding multislot support
  MMC: OMAP: Fix the BYTEBLOCK capability removal
  ...
  • Loading branch information
Linus Torvalds committed Apr 22, 2008
2 parents 8a32272 + e70aa3f commit 135ceda
Show file tree
Hide file tree
Showing 9 changed files with 778 additions and 382 deletions.
6 changes: 1 addition & 5 deletions drivers/mmc/core/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@
#include "sd_ops.h"
#include "sdio_ops.h"

extern int mmc_attach_mmc(struct mmc_host *host, u32 ocr);
extern int mmc_attach_sd(struct mmc_host *host, u32 ocr);
extern int mmc_attach_sdio(struct mmc_host *host, u32 ocr);

static struct workqueue_struct *workqueue;

/*
Expand Down Expand Up @@ -516,7 +512,7 @@ static void mmc_power_off(struct mmc_host *host)
/*
* Cleanup when the last reference to the bus operator is dropped.
*/
void __mmc_release_bus(struct mmc_host *host)
static void __mmc_release_bus(struct mmc_host *host)
{
BUG_ON(!host);
BUG_ON(host->bus_refs);
Expand Down
4 changes: 4 additions & 0 deletions drivers/mmc/core/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ void mmc_rescan(struct work_struct *work);
void mmc_start_host(struct mmc_host *host);
void mmc_stop_host(struct mmc_host *host);

int mmc_attach_mmc(struct mmc_host *host, u32 ocr);
int mmc_attach_sd(struct mmc_host *host, u32 ocr);
int mmc_attach_sdio(struct mmc_host *host, u32 ocr);

extern int use_spi_crc;

#endif
Expand Down
39 changes: 22 additions & 17 deletions drivers/mmc/core/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* linux/drivers/mmc/core/host.c
*
* Copyright (C) 2003 Russell King, All Rights Reserved.
* Copyright (C) 2007 Pierre Ossman
* Copyright (C) 2007-2008 Pierre Ossman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
Expand Down Expand Up @@ -57,12 +57,25 @@ static DEFINE_SPINLOCK(mmc_host_lock);
*/
struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
{
int err;
struct mmc_host *host;

if (!idr_pre_get(&mmc_host_idr, GFP_KERNEL))
return NULL;

host = kzalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL);
if (!host)
return NULL;

spin_lock(&mmc_host_lock);
err = idr_get_new(&mmc_host_idr, host, &host->index);
spin_unlock(&mmc_host_lock);
if (err)
goto free;

snprintf(host->class_dev.bus_id, BUS_ID_SIZE,
"mmc%d", host->index);

host->parent = dev;
host->class_dev.parent = dev;
host->class_dev.class = &mmc_host_class;
Expand All @@ -85,6 +98,10 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
host->max_blk_count = PAGE_CACHE_SIZE / 512;

return host;

free:
kfree(host);
return NULL;
}

EXPORT_SYMBOL(mmc_alloc_host);
Expand All @@ -104,18 +121,6 @@ int mmc_add_host(struct mmc_host *host)
WARN_ON((host->caps & MMC_CAP_SDIO_IRQ) &&
!host->ops->enable_sdio_irq);

if (!idr_pre_get(&mmc_host_idr, GFP_KERNEL))
return -ENOMEM;

spin_lock(&mmc_host_lock);
err = idr_get_new(&mmc_host_idr, host, &host->index);
spin_unlock(&mmc_host_lock);
if (err)
return err;

snprintf(host->class_dev.bus_id, BUS_ID_SIZE,
"mmc%d", host->index);

led_trigger_register_simple(host->class_dev.bus_id, &host->led);

err = device_add(&host->class_dev);
Expand Down Expand Up @@ -144,10 +149,6 @@ void mmc_remove_host(struct mmc_host *host)
device_del(&host->class_dev);

led_trigger_unregister_simple(host->led);

spin_lock(&mmc_host_lock);
idr_remove(&mmc_host_idr, host->index);
spin_unlock(&mmc_host_lock);
}

EXPORT_SYMBOL(mmc_remove_host);
Expand All @@ -160,6 +161,10 @@ EXPORT_SYMBOL(mmc_remove_host);
*/
void mmc_free_host(struct mmc_host *host)
{
spin_lock(&mmc_host_lock);
idr_remove(&mmc_host_idr, host->index);
spin_unlock(&mmc_host_lock);

put_device(&host->class_dev);
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/mmc/core/sdio_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ static int sdio_irq_thread(void *_host)
}
}

set_task_state(current, TASK_INTERRUPTIBLE);
set_current_state(TASK_INTERRUPTIBLE);
if (host->caps & MMC_CAP_SDIO_IRQ)
host->ops->enable_sdio_irq(host, 1);
if (!kthread_should_stop())
schedule_timeout(period);
set_task_state(current, TASK_RUNNING);
set_current_state(TASK_RUNNING);
} while (!kthread_should_stop());

if (host->caps & MMC_CAP_SDIO_IRQ)
Expand Down
1 change: 1 addition & 0 deletions drivers/mmc/core/sdio_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/mmc/sdio.h>

#include "core.h"
#include "sdio_ops.h"

int mmc_send_io_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
{
Expand Down
Loading

0 comments on commit 135ceda

Please sign in to comment.