Files
OrangePi_CM5/drivers/mmc/core/sysfs.c
T

43 lines
928 B
C
Raw Normal View History

2005-04-16 15:20:36 -07:00
/*
2007-02-28 15:33:10 +01:00
* linux/drivers/mmc/core/sysfs.c
2005-04-16 15:20:36 -07:00
*
* Copyright (C) 2003 Russell King, All Rights Reserved.
2007-05-19 13:39:01 +02:00
* Copyright 2007 Pierre Ossman
2005-04-16 15:20:36 -07: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 22:46:55 +01:00
#include "sysfs.h"
2005-04-16 15:20:36 -07:00
2007-05-19 13:39:01 +02:00
int mmc_add_attrs(struct mmc_card *card, struct device_attribute *attrs)
2005-04-16 15:20:36 -07:00
{
2007-05-19 13:39:01 +02:00
int error = 0;
int i;
2005-04-16 15:20:36 -07:00
2007-05-19 13:39:01 +02: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 15:18:58 -07:00
}
}
2007-05-19 13:39:01 +02:00
return error;
2005-04-16 15:20:36 -07:00
}
2007-05-19 13:39:01 +02:00
void mmc_remove_attrs(struct mmc_card *card, struct device_attribute *attrs)
2005-04-16 15:20:36 -07:00
{
2007-05-19 13:39:01 +02:00
int i;
2005-04-16 15:20:36 -07:00
2007-05-19 13:39:01 +02:00
for (i = 0; attr_name(attrs[i]); i++)
device_remove_file(&card->dev, &attrs[i]);
2005-04-16 15:20:36 -07:00
}