kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Location of files for a new driver
@ 2020-05-05 13:58 Jacko Dirks
  2020-05-05 14:20 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Jacko Dirks @ 2020-05-05 13:58 UTC (permalink / raw)
  To: kernelnewbies

Hello,

I am starting to work on a new driver. I think the actual driver
(c file) needs to be placed in drivers/staging/subdir (am I 
correct?). But I also need to edit existing dts and dtsi files and I
also need to introduce a new overlay. Where do I place those changes and
new files? 

Thanks in advance,

Jacko Dirks

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Location of files for a new driver
  2020-05-05 13:58 Location of files for a new driver Jacko Dirks
@ 2020-05-05 14:20 ` Greg KH
  2020-05-05 14:38   ` Jacko Dirks
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2020-05-05 14:20 UTC (permalink / raw)
  To: Jacko Dirks; +Cc: kernelnewbies

On Tue, May 05, 2020 at 03:58:28PM +0200, Jacko Dirks wrote:
> Hello,
> 
> I am starting to work on a new driver. I think the actual driver
> (c file) needs to be placed in drivers/staging/subdir (am I 
> correct?).

drivers/staging/ is only for code that needs lots and lots of work to
get into the "real" part of the kernel.  It also requires a TODO file
that lists what is left to do to get it out of that location.

If you can write that TODO list, it's almost always easier to just do
that work yourself and then get the code merged into the real part of
the kernel than to put it into drivers/staging/

> But I also need to edit existing dts and dtsi files and I
> also need to introduce a new overlay. Where do I place those changes and
> new files? 

It all depends on what you are writing.  What exactly does this code do?
That will determine where it goes in the kernel tree.

thanks,

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Location of files for a new driver
  2020-05-05 14:20 ` Greg KH
@ 2020-05-05 14:38   ` Jacko Dirks
  2020-05-05 18:05     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Jacko Dirks @ 2020-05-05 14:38 UTC (permalink / raw)
  To: Greg KH; +Cc: kernelnewbies

On Tue, May 05, 2020 at 04:20:32PM +0200, Greg KH wrote:
> drivers/staging/ is only for code that needs lots and lots of work to
> get into the "real" part of the kernel.  It also requires a TODO file
> that lists what is left to do to get it out of that location.

Oh, I did not know that staging was optional. Well, I will attempt to
skip staging in that case

> It all depends on what you are writing.  What exactly does this code do?
> That will determine where it goes in the kernel tree.

The code is a driver for the Broadcom BSC, which lives on the Raspberry
Pi 3 & 4 (at least, maybe also on 1 & 2). This device can act as an I2C
slave. To "announce" the device (tell the device tree which pins need to
be configured how, etcetera) I need to change existing dts/dtsi files,
to actually be able to enable the device I need to create a new overlay. 
Finally, the actual driver needs to be created in drivers/i2c/busses. And 
then there is also some makefile, documentation and kconfig.

Does that sound right?

> thanks,

No, thank you!

Jacko Dirks

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Location of files for a new driver
  2020-05-05 14:38   ` Jacko Dirks
@ 2020-05-05 18:05     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2020-05-05 18:05 UTC (permalink / raw)
  To: Jacko Dirks; +Cc: kernelnewbies

On Tue, May 05, 2020 at 04:38:06PM +0200, Jacko Dirks wrote:
> On Tue, May 05, 2020 at 04:20:32PM +0200, Greg KH wrote:
> > drivers/staging/ is only for code that needs lots and lots of work to
> > get into the "real" part of the kernel.  It also requires a TODO file
> > that lists what is left to do to get it out of that location.
> 
> Oh, I did not know that staging was optional. Well, I will attempt to
> skip staging in that case

Please do :)

> > It all depends on what you are writing.  What exactly does this code do?
> > That will determine where it goes in the kernel tree.
> 
> The code is a driver for the Broadcom BSC, which lives on the Raspberry
> Pi 3 & 4 (at least, maybe also on 1 & 2). This device can act as an I2C
> slave. To "announce" the device (tell the device tree which pins need to
> be configured how, etcetera) I need to change existing dts/dtsi files,
> to actually be able to enable the device I need to create a new overlay. 
> Finally, the actual driver needs to be created in drivers/i2c/busses. And 
> then there is also some makefile, documentation and kconfig.
> 
> Does that sound right?

Sounds correct to me.  It's easy to move files around if you make up a
patch and submit it to the mailing lists and people tell you to do so.
The harder part is writing a driver that works :)

good luck!

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-05 18:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-05 13:58 Location of files for a new driver Jacko Dirks
2020-05-05 14:20 ` Greg KH
2020-05-05 14:38   ` Jacko Dirks
2020-05-05 18:05     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).