Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 38054
b: refs/heads/master
c: 928e964
h: refs/heads/master
v: v3
  • Loading branch information
Antonino A. Daplas authored and Linus Torvalds committed Oct 3, 2006
1 parent 83fd819 commit 774416e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 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: 212f26398f63bc905ea28f55b31d4ecd4a21a33b
refs/heads/master: 928e964f262b522dad57483108f62d87c52ccf82
31 changes: 24 additions & 7 deletions trunk/drivers/char/vt.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
#define MAX_NR_CON_DRIVER 16

#define CON_DRIVER_FLAG_MODULE 1
#define CON_DRIVER_FLAG_INIT 2
#define CON_DRIVER_FLAG_INIT 2
#define CON_DRIVER_FLAG_ATTR 4

struct con_driver {
const struct consw *con;
Expand Down Expand Up @@ -3070,22 +3071,37 @@ static struct class_device_attribute class_device_attrs[] = {
static int vtconsole_init_class_device(struct con_driver *con)
{
int i;
int error = 0;

con->flag |= CON_DRIVER_FLAG_ATTR;
class_set_devdata(con->class_dev, con);
for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
class_device_create_file(con->class_dev,
for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) {
error = class_device_create_file(con->class_dev,
&class_device_attrs[i]);
if (error)
break;
}

return 0;
if (error) {
while (--i >= 0)
class_device_remove_file(con->class_dev,
&class_device_attrs[i]);
con->flag &= ~CON_DRIVER_FLAG_ATTR;
}

return error;
}

static void vtconsole_deinit_class_device(struct con_driver *con)
{
int i;

for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
class_device_remove_file(con->class_dev,
&class_device_attrs[i]);
if (con->flag & CON_DRIVER_FLAG_ATTR) {
for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
class_device_remove_file(con->class_dev,
&class_device_attrs[i]);
con->flag &= ~CON_DRIVER_FLAG_ATTR;
}
}

/**
Expand Down Expand Up @@ -3184,6 +3200,7 @@ int register_con_driver(const struct consw *csw, int first, int last)
} else {
vtconsole_init_class_device(con_driver);
}

err:
release_console_sem();
module_put(owner);
Expand Down

0 comments on commit 774416e

Please sign in to comment.