[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140121092531.350ab714@alan.etchedpixels.co.uk>
Date: Tue, 21 Jan 2014 09:25:31 +0000
From: One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>
To: Russell King - ARM Linux <linux@....linux.org.uk>
Cc: Greg KH <gregkh@...uxfoundation.org>,
Tushar Behera <tushar.behera@...aro.org>,
linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org,
linux-samsung-soc@...r.kernel.org, jslaby@...e.cz,
ben.dooks@...ethink.co.uk, broonie@...nel.org
Subject: Re: [PATCH 1/2] serial: samsung: Move uart_register_driver call to
device probe
> > So, let's go back to your original worry, what are you concerned about?
> > A device being removed while probe() is called?
>
> My concern is that we're turning something which should be simple into
> something unnecessarily complex. By that, I mean something along the
> lines of:
Or in fact more complex in other cases because your remove may well be
refcounted so the stuff may not be going away in the foo_remove() path.
>
> static DEFINE_MUTEX(foo_mutex);
> static unsigned foo_devices;
>
> static int foo_probe(struct platform_device *pdev)
> {
> int ret;
>
> mutex_lock(&foo_mutex);
> if (foo_devices++ == 0)
> uart_register_driver(&driver);
>
> ret = foo_really_probe_device(pdev);
We have atomic_inc_and_test and atomic_dec_and_test so it's
fractionally less ugly.
> in every single serial driver we have... Wouldn't it just be better to
> fix the major/minor number problem rather than have to add all that code
> repetitively to all those drivers?
Quite.
Although for some drivers I suspect what is actually missing when built
in is
module_init() {
if (not_the_right_platform())
return -ENOGOOD;
}
Going dynamic is the right fix though. Changing how the driver
registration work is a different (and quite independent) problem.
Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists