2005-04-16 22:20:36 +00:00
|
|
|
/*
|
2007-02-28 14:33:10 +00:00
|
|
|
* linux/drivers/mmc/core/sysfs.c
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2003 Russell King, All Rights Reserved.
|
2007-05-19 11:39:01 +00:00
|
|
|
* Copyright 2007 Pierre Ossman
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* MMC sysfs/driver model support.
|
|
|
|
*/
|
|
|
|
#include <linux/device.h>
|
|
|
|
|
|
|
|
#include <linux/mmc/card.h>
|
|
|
|
|
2006-12-24 21:46:55 +00:00
|
|
|
#include "sysfs.h"
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-05-19 11:39:01 +00:00
|
|
|
int mmc_add_attrs(struct mmc_card *card, struct device_attribute *attrs)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2007-05-19 11:39:01 +00:00
|
|
|
int error = 0;
|
|
|
|
int i;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-05-19 11:39:01 +00:00
|
|
|
for (i = 0; attr_name(attrs[i]); i++) {
|
|
|
|
error = device_create_file(&card->dev, &attrs[i]);
|
|
|
|
if (error) {
|
|
|
|
while (--i >= 0)
|
|
|
|
device_remove_file(&card->dev, &attrs[i]);
|
|
|
|
break;
|
2005-09-06 22:18:58 +00:00
|
|
|
}
|
|
|
|
}
|
2007-05-19 11:39:01 +00:00
|
|
|
|
|
|
|
return error;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2007-05-19 11:39:01 +00:00
|
|
|
void mmc_remove_attrs(struct mmc_card *card, struct device_attribute *attrs)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2007-05-19 11:39:01 +00:00
|
|
|
int i;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-05-19 11:39:01 +00:00
|
|
|
for (i = 0; attr_name(attrs[i]); i++)
|
|
|
|
device_remove_file(&card->dev, &attrs[i]);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|