|
@@ -45,8 +45,8 @@ struct sysfs_open_dirent {
|
|
|
struct sysfs_buffer {
|
|
|
size_t count;
|
|
|
loff_t pos;
|
|
|
- char * page;
|
|
|
- const struct sysfs_ops * ops;
|
|
|
+ char *page;
|
|
|
+ const struct sysfs_ops *ops;
|
|
|
struct mutex mutex;
|
|
|
int needs_read_fill;
|
|
|
int event;
|
|
@@ -64,11 +64,11 @@ struct sysfs_buffer {
|
|
|
* This is called only once, on the file's first read unless an error
|
|
|
* is returned.
|
|
|
*/
|
|
|
-static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer)
|
|
|
+static int fill_read_buffer(struct dentry *dentry, struct sysfs_buffer *buffer)
|
|
|
{
|
|
|
struct sysfs_dirent *attr_sd = dentry->d_fsdata;
|
|
|
struct kobject *kobj = attr_sd->s_parent->s_dir.kobj;
|
|
|
- const struct sysfs_ops * ops = buffer->ops;
|
|
|
+ const struct sysfs_ops *ops = buffer->ops;
|
|
|
int ret = 0;
|
|
|
ssize_t count;
|
|
|
|
|
@@ -127,12 +127,12 @@ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer
|
|
|
static ssize_t
|
|
|
sysfs_read_file(struct file *file, char __user *buf, size_t count, loff_t *ppos)
|
|
|
{
|
|
|
- struct sysfs_buffer * buffer = file->private_data;
|
|
|
+ struct sysfs_buffer *buffer = file->private_data;
|
|
|
ssize_t retval = 0;
|
|
|
|
|
|
mutex_lock(&buffer->mutex);
|
|
|
if (buffer->needs_read_fill || *ppos == 0) {
|
|
|
- retval = fill_read_buffer(file->f_path.dentry,buffer);
|
|
|
+ retval = fill_read_buffer(file->f_path.dentry, buffer);
|
|
|
if (retval)
|
|
|
goto out;
|
|
|
}
|
|
@@ -154,8 +154,8 @@ out:
|
|
|
* Allocate @buffer->page if it hasn't been already, then
|
|
|
* copy the user-supplied buffer into it.
|
|
|
*/
|
|
|
-static int fill_write_buffer(struct sysfs_buffer * buffer,
|
|
|
- const char __user * buf, size_t count)
|
|
|
+static int fill_write_buffer(struct sysfs_buffer *buffer,
|
|
|
+ const char __user *buf, size_t count)
|
|
|
{
|
|
|
int error;
|
|
|
|
|
@@ -166,7 +166,7 @@ static int fill_write_buffer(struct sysfs_buffer * buffer,
|
|
|
|
|
|
if (count >= PAGE_SIZE)
|
|
|
count = PAGE_SIZE - 1;
|
|
|
- error = copy_from_user(buffer->page,buf,count);
|
|
|
+ error = copy_from_user(buffer->page, buf, count);
|
|
|
buffer->needs_read_fill = 1;
|
|
|
/* if buf is assumed to contain a string, terminate it by \0,
|
|
|
so e.g. sscanf() can scan the string easily */
|
|
@@ -186,11 +186,11 @@ static int fill_write_buffer(struct sysfs_buffer * buffer,
|
|
|
* passing the buffer that we acquired in fill_write_buffer().
|
|
|
*/
|
|
|
static int
|
|
|
-flush_write_buffer(struct dentry * dentry, struct sysfs_buffer * buffer, size_t count)
|
|
|
+flush_write_buffer(struct dentry *dentry, struct sysfs_buffer *buffer, size_t count)
|
|
|
{
|
|
|
struct sysfs_dirent *attr_sd = dentry->d_fsdata;
|
|
|
struct kobject *kobj = attr_sd->s_parent->s_dir.kobj;
|
|
|
- const struct sysfs_ops * ops = buffer->ops;
|
|
|
+ const struct sysfs_ops *ops = buffer->ops;
|
|
|
int rc;
|
|
|
|
|
|
/* need attr_sd for attr and ops, its parent for kobj */
|
|
@@ -225,7 +225,7 @@ flush_write_buffer(struct dentry * dentry, struct sysfs_buffer * buffer, size_t
|
|
|
static ssize_t
|
|
|
sysfs_write_file(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
|
|
|
{
|
|
|
- struct sysfs_buffer * buffer = file->private_data;
|
|
|
+ struct sysfs_buffer *buffer = file->private_data;
|
|
|
ssize_t len;
|
|
|
|
|
|
mutex_lock(&buffer->mutex);
|
|
@@ -418,7 +418,7 @@ static int sysfs_release(struct inode *inode, struct file *filp)
|
|
|
*/
|
|
|
static unsigned int sysfs_poll(struct file *filp, poll_table *wait)
|
|
|
{
|
|
|
- struct sysfs_buffer * buffer = filp->private_data;
|
|
|
+ struct sysfs_buffer *buffer = filp->private_data;
|
|
|
struct sysfs_dirent *attr_sd = filp->f_path.dentry->d_fsdata;
|
|
|
struct sysfs_open_dirent *od = attr_sd->s_attr.open;
|
|
|
|
|
@@ -567,7 +567,7 @@ int sysfs_add_file(struct sysfs_dirent *dir_sd, const struct attribute *attr,
|
|
|
* @kobj: object we're creating for.
|
|
|
* @attr: attribute descriptor.
|
|
|
*/
|
|
|
-int sysfs_create_file(struct kobject * kobj, const struct attribute * attr)
|
|
|
+int sysfs_create_file(struct kobject *kobj, const struct attribute *attr)
|
|
|
{
|
|
|
BUG_ON(!kobj || !kobj->sd || !attr);
|
|
|
|
|
@@ -660,7 +660,7 @@ EXPORT_SYMBOL_GPL(sysfs_chmod_file);
|
|
|
*
|
|
|
* Hash the attribute name and kill the victim.
|
|
|
*/
|
|
|
-void sysfs_remove_file(struct kobject * kobj, const struct attribute * attr)
|
|
|
+void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr)
|
|
|
{
|
|
|
const void *ns;
|
|
|
|
|
@@ -671,7 +671,7 @@ void sysfs_remove_file(struct kobject * kobj, const struct attribute * attr)
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(sysfs_remove_file);
|
|
|
|
|
|
-void sysfs_remove_files(struct kobject * kobj, const struct attribute **ptr)
|
|
|
+void sysfs_remove_files(struct kobject *kobj, const struct attribute **ptr)
|
|
|
{
|
|
|
int i;
|
|
|
for (i = 0; ptr[i]; i++)
|