Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 219018
b: refs/heads/master
c: 703aae3
h: refs/heads/master
v: v3
  • Loading branch information
Andy Shevchenko authored and Chris Ball committed Oct 23, 2010
1 parent bcefd7b commit b23208a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 643a81ff3c5a89ae5c0768f89b29d3e1d08be5c3
refs/heads/master: 703aae3d09a4b351866f1a97b2afafb905bdbf1e
35 changes: 33 additions & 2 deletions trunk/drivers/mmc/core/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,33 @@ static const struct file_operations mmc_ios_fops = {
.release = single_release,
};

static int mmc_clock_opt_get(void *data, u64 *val)
{
struct mmc_host *host = data;

*val = host->ios.clock;

return 0;
}

static int mmc_clock_opt_set(void *data, u64 val)
{
struct mmc_host *host = data;

/* We need this check due to input value is u64 */
if (val > host->f_max)
return -EINVAL;

mmc_claim_host(host);
mmc_set_clock(host, (unsigned int) val);
mmc_release_host(host);

return 0;
}

DEFINE_SIMPLE_ATTRIBUTE(mmc_clock_fops, mmc_clock_opt_get, mmc_clock_opt_set,
"%llu\n");

void mmc_add_host_debugfs(struct mmc_host *host)
{
struct dentry *root;
Expand All @@ -150,11 +177,15 @@ void mmc_add_host_debugfs(struct mmc_host *host)
host->debugfs_root = root;

if (!debugfs_create_file("ios", S_IRUSR, root, host, &mmc_ios_fops))
goto err_ios;
goto err_node;

if (!debugfs_create_file("clock", S_IRUSR | S_IWUSR, root, host,
&mmc_clock_fops))
goto err_node;

return;

err_ios:
err_node:
debugfs_remove_recursive(root);
host->debugfs_root = NULL;
err_root:
Expand Down

0 comments on commit b23208a

Please sign in to comment.