[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADYu30_EN78+1CdD=VF8gi-5H2Ot7ArKWq5DQ5HaptwTuL3C6A@mail.gmail.com>
Date: Mon, 4 Aug 2014 00:24:06 +0530
From: Aniroop Mathur <aniroop.mathur@...il.com>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, linux-hotplug@...r.kernel.org
Subject: Re: [Question: Drivers/base/core.c] Why dev->init_name = NULL in
device_add function ?
On Sat, Aug 2, 2014 at 8:09 AM, Greg KH <gregkh@...uxfoundation.org> wrote:
> On Sat, Aug 02, 2014 at 05:14:44AM +0530, Aniroop Mathur wrote:
>> >> So, overall output will be
>> >> /dev/input/event<x> --> /dev/input/event_accelerometer
>> >> sys/class/input/input<x> --> sys/class/input/accelerometer
>> >>
>> >> In short, input and event node names are set just by
>> >> adding one line, which i found quite efficient.
>> >> There is other way also to set name of event node but
>> >> it involves using extra variable and little more code,
>> >> So I am looking for best solution possible. :)
>> >
>> > Only use init_name for static struct devices, for a dynamic one, jsut
>> > set the name like everyone else does, how is that "more" code than
>> > anything else?
>> >
>>
>> Can you please elaborate what do you mean by static struct devices ?
>
> Exactly what you wrote there, 'static' is a C thing, right?
>
>> Can I consider embedded accelerometer, proximity, gyro sensor,
>> touch panel in android mobile devices as static devices ?
>
> Nope, because in my Android phone, I can yank out those and add new ones
> on the fly while the phone is running. The kernel is fully dynamic that
> way.
>
>> Input subsystem is setting default name of input and event node.
>
> As it should.
>
>> This is the normal method everyone uses.
>
> And so should you :)
>
>> I do not want to use default name like event0, event4, input2, etc
>
> Yes, you really do.
>
>> My aim is to set name of input and event node through driver as desired.
>
> Nope, that's userspace's job, just use udev to rename the device node,
> or even better yet, create a symlink like /dev/input/by-id/ has if you
> really need more than that.
>
> Don't mess with kernel device names, we can't do that without breaking
> tons of things, there's a reason that we standardized on something,
> please use it.
>
Okay, will follow the same. :)
One last thing,
Why init_name will go away some day ?
Is it because now we have dev_set_name,
so there is no need of it anymore.
Moreover as you said,
"people would start to use it thinking it was the real name of the
device, when it might not be."
So, there remains no purpose of init_name anymore, right ?
> good luck,
>
> greg k-h
Thanks,
Aniroop
--
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