All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: Kay Sievers <kay.sievers@vrfy.org>
Cc: Greg Kroah-Hartman <gregkh@suse.de>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 34/36] tty: add 'active' sysfs attribute to tty0 and console device
Date: Fri, 07 Jan 2011 16:12:21 +0100	[thread overview]
Message-ID: <4D272D55.3040807@suse.cz> (raw)
In-Reply-To: <AANLkTimmtkOhEtRmzFxFS8Z_36Dcys+higaiVJXEr-=7@mail.gmail.com>

On 01/07/2011 02:20 PM, Kay Sievers wrote:
> On Fri, Jan 7, 2011 at 10:09, Jiri Slaby <jslaby@suse.cz> wrote:
>> On 01/06/2011 11:23 PM, Greg Kroah-Hartman wrote:
>>> --- a/drivers/tty/tty_io.c
>>> +++ b/drivers/tty/tty_io.c
>>> @@ -3232,9 +3232,45 @@ static int __init tty_class_init(void)
>>>  postcore_initcall(tty_class_init);
>>>
>>>  /* 3/2004 jmc: why do these devices exist? */
>>> -
>>>  static struct cdev tty_cdev, console_cdev;
>>>
>>> +static ssize_t show_cons_active(struct device *dev,
>>> +                             struct device_attribute *attr, char *buf)
>>> +{
>>> +     struct console *cs[16];
>>> +     int i = 0;
>>> +     struct console *c;
>>> +     ssize_t count = 0;
>>> +
>>> +     acquire_console_sem();
>>> +     for (c = console_drivers; c; c = c->next) {
>>
>> This should be:
>> for_each_console(c)
>> like somebody already suggested.
> 
> That's exported now? It was local to printk.c at least that time.
> 
> Anyway, the only sensible change here is to convert that home-grown
> ->next thing to a proper kernel linked list, and use the common
> iterators instead of doing it on our own, or export new custom ones.

Perhaps -- I didn't look into the code if there is something which
blocked this to be done years ago. I doubt there is...

>>> +             if (!c->device)
>>> +                     continue;
>>
>> Why are consoles without devices ignored here?
> 
> It's a common pattern all over the place. What is a "console without a
> device" that would be interesting here?

For example parport console. The question is whether you are interested
in consoles without ttys in systemd and other potential users.

>> Other than that there are 2 build warnings, see below.
>>
>>> -     device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
>>> +     tty0dev = device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
>>> +     if (IS_ERR(tty0dev))
>>> +             tty0dev = NULL;
>>> +     else
>>> +             device_create_file(tty0dev, &dev_attr_active);
>>
>> drivers/tty/vt/vt.c: In function ‘vty_init’:
>> drivers/tty/vt/vt.c:2997:21: warning: ignoring return value of
>> ‘device_create_file’, declared with attribute warn_unused_result
> 
> The code doesn't even check device_create(). :)
> 
> Anyway we actually don't want to check the return value of
> file_create(), it's a non-fatal error, if it ever happens.

Ok, but we don't want to introduce new warnings.

> What's the preferred way to do that:
>   int ignore = device_create_file()

I think the usual workaround in C is casting to void.

regards,
-- 
js
suse labs

  reply	other threads:[~2011-01-07 15:12 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-06 21:54 [GIT PATCH] TTY/serial merge for .38 Greg KH
2011-01-06 22:00 ` Alan Cox
2011-01-06 22:24   ` Greg KH
2011-01-06 23:54     ` Kay Sievers
2011-01-07  3:40       ` Greg KH
2011-01-06 22:22 ` [PATCH 01/36] ifx6x60: SPI protocol driver for Infineon 6x60 modem Greg Kroah-Hartman
2011-01-06 22:22 ` [PATCH 02/36] serial: Add support for UART on VIA VT8500 and compatibles Greg Kroah-Hartman
2011-01-06 22:22 ` [PATCH 03/36] n_gsm: Fix support for legacy encoding Greg Kroah-Hartman
2011-01-06 22:22 ` [PATCH 04/36] n_gsm: clean up printks Greg Kroah-Hartman
2011-01-06 22:22 ` [PATCH 05/36] serial: add Documentation about RS485 serial communications Greg Kroah-Hartman
2011-01-06 22:22 ` [PATCH 06/36] serial: cpm_uat: reducing CPM serial latency Greg Kroah-Hartman
2011-01-06 22:22 ` [PATCH 07/36] serial: cpu_uart: Remove unused uart_cpm_port fields Greg Kroah-Hartman
2011-01-06 22:22 ` [PATCH 08/36] console: move for_each_console to linux/console.h Greg Kroah-Hartman
2011-01-06 22:22 ` [PATCH 09/36] TTY: include termios.h in tty_driver.h Greg Kroah-Hartman
2011-01-06 22:22 ` [PATCH 10/36] VIDEO: xen-fb, switch to for_each_console Greg Kroah-Hartman
2011-01-06 22:22   ` Greg Kroah-Hartman
2011-01-06 22:22   ` Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 11/36] console: add /proc/consoles Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 12/36] parisc: cleanup console handling Greg Kroah-Hartman
2011-01-06 22:23   ` Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 13/36] serial: mpc52xx: make printout for type more generic Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 14/36] serial: ifx6x60: The IFX requires SPI Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 15/36] serial: ifx6x60: Fix missing include for msleep Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 16/36] Serial: ce4100: Add PCI UART support for the ce4100 Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 17/36] Serial: EG20T: add PCH_UART driver Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 18/36] serial: ifx6x60: free IRQ on error Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 19/36] serial: ifx6x60: fix memory leak Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 20/36] RS485 documentation: add 16C950 UART description Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 21/36] drivers: char: hvc: add arm JTAG DCC console support Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 22/36] serial: fix pch_uart kconfig & build Greg Kroah-Hartman
2011-01-07  0:21   ` Tomoya MORINAGA
2011-01-07  0:31     ` Greg KH
2011-01-06 22:23 ` [PATCH 23/36] serial: omap-serial: Add support for kernel debugger Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 24/36] 8250: use container_of() instead of casting Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 25/36] 8250: add a UPIO_DWAPB32 for 32 bit accesses Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 26/36] rocket: fix compiler warning on rocket_pci_ids Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 27/36] specialix: fix compiler warning on specialix_pci_tbl Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 28/36] ip2: fix compiler warning on ip2main_pci_tbl Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 29/36] 8250: fix uninitialized FIFOs Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 30/36] pch_uart : fix warnings for 64bit compile Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 31/36] tty: fix typos/errors in tty_driver.h comments Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 32/36] Serial: Avoid unbalanced IRQ wake disable during resume Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 33/36] drivers: serial: apbuart: Handle OF failures gracefully Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 34/36] tty: add 'active' sysfs attribute to tty0 and console device Greg Kroah-Hartman
2011-01-07  9:09   ` Jiri Slaby
2011-01-07 13:20     ` Kay Sievers
2011-01-07 15:12       ` Jiri Slaby [this message]
2011-01-06 22:23 ` [PATCH 35/36] TTY: Add tty ioctl to figure device node of the system console Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 36/36] serial: apbuart: Fixup apbuart_console_init() Greg Kroah-Hartman
2011-01-07 22:44 ` [GIT PATCH] TTY/serial merge for .38 Linus Torvalds
2011-01-07 23:41   ` Greg KH
2011-01-11 14:00     ` Daniel Hellstrom
2011-01-11 14:56       ` Thomas Gleixner
2011-01-11 15:08         ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D272D55.3040807@suse.cz \
    --to=jslaby@suse.cz \
    --cc=gregkh@suse.de \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.