Re: [PATCH 1/2] serial: samsung: Move uart_register_driver call todevice probe

From: One Thousand Gnomes
Date: Tue Jan 21 2014 - 04:27:17 EST

> > 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?


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.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at