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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > 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-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux