Message ID | 20220710081853.1699028-1-uwu@icenowy.me |
---|---|
Headers | show |
Series | Allwinner R329 {R-,}PIO pinctrl support | expand |
在 2022-07-10星期日的 21:06 +0200,Andy Shevchenko写道: > On Sun, Jul 10, 2022 at 10:22 AM Icenowy Zheng <uwu@icenowy.me> > wrote: > > > > Allwinner R329 SoC has two pin controllers similar to ones on > > previous > > SoCs, one in CPUX power domain and another in CPUS. > > > > This patch adds support for the CPUX domain pin controller. > > ... > > > +#include <linux/module.h> > > +#include <linux/platform_device.h> > > > +#include <linux/of.h> > > +#include <linux/of_device.h> > > No use of these. > > > +#include <linux/pinctrl/pinctrl.h> > > Missed headers: > mod_devicetable.h Thanks for these. In addition, how to decide what header should be included? The code works properly because of_device.h includes mod_devicetable.h. > > > +#include "pinctrl-sunxi.h" >
On Tue, Jul 12, 2022 at 12:10 PM Andy Shevchenko <andy.shevchenko@gmail.com> wrote: > > On Tue, Jul 12, 2022 at 11:37 AM Icenowy Zheng <uwu@icenowy.me> wrote: > > 在 2022-07-10星期日的 21:06 +0200,Andy Shevchenko写道: > > > On Sun, Jul 10, 2022 at 10:22 AM Icenowy Zheng <uwu@icenowy.me> > > > wrote: > > ... > > > > > +#include <linux/of.h> > > > > +#include <linux/of_device.h> > > > > > > No use of these. > > > > > > > +#include <linux/pinctrl/pinctrl.h> > > > > > > Missed headers: > > > mod_devicetable.h > > > > Thanks for these. > > > > In addition, how to decide what header should be included? The code > > works properly because of_device.h includes mod_devicetable.h. Forgot to put in the first place this: The rule of thumb is Include headers that the header or C module is direct user of. Additional information is located in the sections below. > The best approach is usually learnt with experience — the more you > code, the more you get. One of the rules is to avoid too many > inclusions and at the same time reduce indirect inclusions, so that > the headers which are guaranteed to be included by others shouldn't > appear. Another rule is that, for the headers (*.h files) the forward > declarations are preferable over the inclusion in case if the opaque > pointers are in use.