[lkml]   [2014]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [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?


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.


 \ /
  Last update: 2014-01-21 10:41    [W:0.147 / U:3.500 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site