9
0
Fork 0

console: drop f_caps and check the function pointer getc/putc instead

None of the driver make the difference between STDOUT and STDERR.
So we just need to check if putc or getc are filled in the console_device

save 32 bytes on versatilepb

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Jean-Christophe PLAGNIOL-VILLARD 2013-09-20 05:31:29 +02:00 committed by Sascha Hauer
parent fe4117357f
commit e62d425517
29 changed files with 16 additions and 43 deletions

View File

@ -36,11 +36,6 @@ int barebox_register_console(char *name, int stdinfd, int stdoutfd)
strcpy(dev->name, "console");
if (stdinfd >= 0)
data->flags = CONSOLE_STDIN;
if (stdoutfd >= 0)
data->flags |= CONSOLE_STDOUT | CONSOLE_STDERR;
data->stdoutfd = stdoutfd;
data->stdinfd = stdinfd;

View File

@ -23,7 +23,6 @@ int barebox_register_console(char *name_template, int stdinfd, int stdoutfd);
struct linux_console_data {
int stdinfd;
int stdoutfd;
unsigned int flags;
};
extern int sdl_xres;

View File

@ -63,19 +63,21 @@ static int console_std_set(struct device_d *dev, struct param_d *param,
unsigned int flag = 0, i = 0;
if (val) {
if (strchr(val, 'i') && cdev->f_caps & CONSOLE_STDIN) {
if (strchr(val, 'i') && cdev->getc) {
active[i++] = 'i';
flag |= CONSOLE_STDIN;
}
if (strchr(val, 'o') && cdev->f_caps & CONSOLE_STDOUT) {
active[i++] = 'o';
flag |= CONSOLE_STDOUT;
}
if (cdev->putc) {
if (strchr(val, 'o')) {
active[i++] = 'o';
flag |= CONSOLE_STDOUT;
}
if (strchr(val, 'e') && cdev->f_caps & CONSOLE_STDERR) {
active[i++] = 'e';
flag |= CONSOLE_STDERR;
if (strchr(val, 'e')) {
active[i++] = 'e';
flag |= CONSOLE_STDERR;
}
}
}

View File

@ -95,7 +95,6 @@ static int __init gpio_keys_probe(struct device_d *dev)
cdev = &pdata->cdev;
dev->type_data = cdev;
cdev->dev = dev;
cdev->f_caps = CONSOLE_STDIN;
cdev->tstc = gpio_keys_tstc;
cdev->getc = gpio_keys_getc;

View File

@ -441,7 +441,6 @@ static int __init imx_keypad_probe(struct device_d *dev)
cdev->dev = dev;
cdev->tstc = imx_keypad_tstc;
cdev->getc = imx_keypad_getc;
cdev->f_caps = CONSOLE_STDIN;
cdev->f_active = CONSOLE_STDIN;
console_register(&keypad->cdev);

View File

@ -265,7 +265,6 @@ static int qt1070_probe(struct device_d *dev)
cdev = &data->cdev;
cdev->dev = dev;
cdev->f_caps = CONSOLE_STDIN;
cdev->tstc = qt1070_tstc;
cdev->getc = qt1070_getc;

View File

@ -93,7 +93,6 @@ static int __init twl6030_pwrbtn_probe(struct device_d *dev)
dev->type_data = &idata->cdev;
idata->cdev.dev = dev;
idata->cdev.f_caps = CONSOLE_STDIN;
idata->cdev.tstc = twl6030_pwrbtn_tstc;
idata->cdev.getc = twl6030_pwrbtn_getc;
console_register(&idata->cdev);

View File

@ -196,7 +196,6 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
cdev = &uart->uart;
cdev->dev = &dev->dev;
cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
cdev->tstc = pl011_tstc;
cdev->putc = pl011_putc;
cdev->getc = pl011_getc;

View File

@ -133,7 +133,6 @@ static int arm_dcc_probe(struct device_d *dev)
cdev = &arm_dcc_dev;
cdev->dev = dev;
cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
cdev->tstc = arm_dcc_tstc;
cdev->putc = arm_dcc_putc;
cdev->getc = arm_dcc_getc;

View File

@ -399,7 +399,6 @@ static int atmel_serial_probe(struct device_d *dev)
uart = xzalloc(sizeof(struct atmel_uart_port));
cdev = &uart->uart;
cdev->dev = dev;
cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
cdev->tstc = atmel_serial_tstc;
cdev->putc = atmel_serial_putc;
cdev->getc = atmel_serial_getc;

View File

@ -64,10 +64,12 @@ static int linux_console_probe(struct device_d *dev)
cdev = xzalloc(sizeof(struct console_device));
cdev->dev = dev;
cdev->f_caps = data->flags;
cdev->tstc = linux_console_tstc;
cdev->putc = linux_console_putc;
cdev->getc = linux_console_getc;
if (data->stdinfd >= 0) {
cdev->tstc = linux_console_tstc;
cdev->getc = linux_console_getc;
}
if (data->stdoutfd >= 0)
cdev->putc = linux_console_putc;
console_register(cdev);

View File

@ -86,7 +86,6 @@ static int altera_serial_probe(struct device_d *dev)
priv->regs = dev_request_mem_region(dev, 0);
cdev->dev = dev;
cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
cdev->tstc = altera_serial_tstc;
cdev->putc = altera_serial_putc;
cdev->getc = altera_serial_getc;

View File

@ -91,7 +91,6 @@ static int altera_serial_jtag_probe(struct device_d *dev) {
priv->regs = dev_request_mem_region(dev, 0);
cdev->dev = dev;
cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
cdev->tstc = altera_serial_jtag_tstc;
cdev->putc = altera_serial_jtag_putc;
cdev->getc = altera_serial_jtag_getc;

View File

@ -187,7 +187,6 @@ static int auart_serial_probe(struct device_d *dev)
priv = xzalloc(sizeof *priv);
cdev = &priv->cdev;
cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
cdev->tstc = auart_serial_tstc;
cdev->putc = auart_serial_putc;
cdev->getc = auart_serial_getc;

View File

@ -113,7 +113,6 @@ static int blackfin_serial_probe(struct device_d *dev)
cdev = xzalloc(sizeof(struct console_device));
cdev->dev = dev;
cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
cdev->tstc = blackfin_serial_tstc;
cdev->putc = blackfin_serial_putc;
cdev->getc = blackfin_serial_getc;

View File

@ -246,7 +246,6 @@ static int cadence_serial_probe(struct device_d *dev)
}
cdev->dev = dev;
cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
cdev->tstc = cadence_serial_tstc;
cdev->putc = cadence_serial_putc;
cdev->getc = cadence_serial_getc;

View File

@ -131,7 +131,6 @@ static int clps711x_probe(struct device_d *dev)
dev->priv = s;
s->cdev.dev = dev;
s->cdev.f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
s->cdev.tstc = clps711x_tstc;
s->cdev.putc = clps711x_putc;
s->cdev.getc = clps711x_getc;

View File

@ -330,7 +330,6 @@ static int imx_serial_probe(struct device_d *dev)
priv->regs = dev_request_mem_region(dev, 0);
cdev->dev = dev;
cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
cdev->tstc = imx_serial_tstc;
cdev->putc = imx_serial_putc;
cdev->getc = imx_serial_getc;

View File

@ -149,7 +149,6 @@ static int mpc5xxx_serial_probe(struct device_d *dev)
cdev = xzalloc(sizeof(struct console_device));
dev->priv = dev_request_mem_region(dev, 0);
cdev->dev = dev;
cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
cdev->tstc = mpc5xxx_serial_tstc;
cdev->putc = mpc5xxx_serial_putc;
cdev->getc = mpc5xxx_serial_getc;

View File

@ -138,7 +138,6 @@ static int netx_serial_probe(struct device_d *dev)
cdev = xzalloc(sizeof(struct console_device));
dev->priv = dev_request_mem_region(dev, 0);
cdev->dev = dev;
cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
cdev->tstc = netx_serial_tstc;
cdev->putc = netx_serial_putc;
cdev->getc = netx_serial_getc;

View File

@ -291,7 +291,6 @@ static int ns16550_probe(struct device_d *dev)
cdev = &priv->cdev;
cdev->dev = dev;
cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
cdev->tstc = ns16550_tstc;
cdev->putc = ns16550_putc;
cdev->getc = ns16550_getc;

View File

@ -62,7 +62,6 @@ static int serial_omap4_usbboot_probe(struct device_d *dev)
priv = xzalloc(sizeof(*priv));
priv->cdev.dev = dev;
priv->cdev.f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
priv->cdev.tstc = serial_omap4_usbboot_tstc;
priv->cdev.putc = serial_omap4_usbboot_putc;
priv->cdev.getc = serial_omap4_usbboot_getc;

View File

@ -140,7 +140,6 @@ static int pl010_probe(struct device_d *dev)
cdev = xzalloc(sizeof(struct console_device));
dev->priv = dev_request_mem_region(dev, 0);
cdev->dev = dev;
cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
cdev->tstc = pl010_tstc;
cdev->putc = pl010_putc;
cdev->getc = pl010_getc;

View File

@ -170,7 +170,6 @@ static int pxa_serial_probe(struct device_d *dev)
dev->priv = priv;
cdev->dev = dev;
cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
cdev->tstc = pxa_serial_tstc;
cdev->putc = pxa_serial_putc;
cdev->getc = pxa_serial_getc;

View File

@ -184,7 +184,6 @@ static int s3c_serial_probe(struct device_d *dev)
priv->regs = dev_request_mem_region(dev, 0);
dev->priv = priv;
cdev->dev = dev;
cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
cdev->tstc = s3c_serial_tstc;
cdev->putc = s3c_serial_putc;
cdev->getc = s3c_serial_getc;

View File

@ -153,7 +153,6 @@ static int stm_serial_probe(struct device_d *dev)
cdev = &priv->cdev;
cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
cdev->tstc = stm_serial_tstc;
cdev->putc = stm_serial_putc;
cdev->getc = stm_serial_getc;

View File

@ -478,7 +478,6 @@ int gserial_connect(struct gserial *gser, u8 port_num)
gser->connect(gser);
cdev = &port->cdev;
cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
cdev->tstc = serial_tstc;
cdev->putc = serial_putc;
cdev->getc = serial_getc;

View File

@ -40,7 +40,6 @@ struct console_device {
struct list_head list;
unsigned char f_caps;
unsigned char f_active;
unsigned int baudrate;

View File

@ -72,7 +72,6 @@ static int nc_init(void)
}
net_udp_bind(priv->con, priv->port);
priv->cdev.f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
return 0;
}