Commit e5530adc authored by Andy Shevchenko's avatar Andy Shevchenko

pinctrl: Clean up headers

There is a few things done:
- include only the headers we are direct user of
- when pointer is in use, provide a forward declaration
- add missing headers
- group generic headers and subsystem headers
- sort each group alphabetically

While at it, fix some awkward indentations.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent de23ccb1
...@@ -12,19 +12,21 @@ ...@@ -12,19 +12,21 @@
*/ */
#define pr_fmt(fmt) "pinctrl core: " fmt #define pr_fmt(fmt) "pinctrl core: " fmt
#include <linux/kernel.h> #include <linux/debugfs.h>
#include <linux/kref.h>
#include <linux/export.h>
#include <linux/init.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/slab.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/export.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/kref.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
#include <linux/pinctrl/pinctrl.h> #include <linux/pinctrl/devinfo.h>
#include <linux/pinctrl/machine.h> #include <linux/pinctrl/machine.h>
#include <linux/pinctrl/pinctrl.h>
#ifdef CONFIG_GPIOLIB #ifdef CONFIG_GPIOLIB
#include "../gpio/gpiolib.h" #include "../gpio/gpiolib.h"
...@@ -33,9 +35,8 @@ ...@@ -33,9 +35,8 @@
#include "core.h" #include "core.h"
#include "devicetree.h" #include "devicetree.h"
#include "pinmux.h"
#include "pinconf.h" #include "pinconf.h"
#include "pinmux.h"
static bool pinctrl_dummy_state; static bool pinctrl_dummy_state;
......
...@@ -9,12 +9,22 @@ ...@@ -9,12 +9,22 @@
*/ */
#include <linux/kref.h> #include <linux/kref.h>
#include <linux/list.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/radix-tree.h> #include <linux/radix-tree.h>
#include <linux/pinctrl/pinconf.h> #include <linux/types.h>
#include <linux/pinctrl/machine.h> #include <linux/pinctrl/machine.h>
struct dentry;
struct device;
struct device_node;
struct module;
struct pinctrl;
struct pinctrl_desc;
struct pinctrl_gpio_range; struct pinctrl_gpio_range;
struct pinctrl_state;
/** /**
* struct pinctrl_dev - pin control class device * struct pinctrl_dev - pin control class device
......
...@@ -5,8 +5,14 @@ ...@@ -5,8 +5,14 @@
* Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved. * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved.
*/ */
#include <linux/errno.h>
struct device_node;
struct of_phandle_args; struct of_phandle_args;
struct pinctrl;
struct pinctrl_dev;
#ifdef CONFIG_OF #ifdef CONFIG_OF
void pinctrl_dt_free_maps(struct pinctrl *p); void pinctrl_dt_free_maps(struct pinctrl *p);
......
...@@ -10,6 +10,16 @@ ...@@ -10,6 +10,16 @@
* Author: Linus Walleij <linus.walleij@linaro.org> * Author: Linus Walleij <linus.walleij@linaro.org>
*/ */
#include <linux/errno.h>
struct dentry;
struct device_node;
struct seq_file;
struct pinctrl_dev;
struct pinctrl_map;
struct pinctrl_setting;
#ifdef CONFIG_PINCONF #ifdef CONFIG_PINCONF
int pinconf_check_ops(struct pinctrl_dev *pctldev); int pinconf_check_ops(struct pinctrl_dev *pctldev);
......
...@@ -9,6 +9,11 @@ ...@@ -9,6 +9,11 @@
#ifndef __PINCTRL_UTILS_H__ #ifndef __PINCTRL_UTILS_H__
#define __PINCTRL_UTILS_H__ #define __PINCTRL_UTILS_H__
#include <linux/pinctrl/machine.h>
struct pinctrl_dev;
struct pinctrl_map;
int pinctrl_utils_reserve_map(struct pinctrl_dev *pctldev, int pinctrl_utils_reserve_map(struct pinctrl_dev *pctldev,
struct pinctrl_map **map, unsigned *reserved_maps, struct pinctrl_map **map, unsigned *reserved_maps,
unsigned *num_maps, unsigned reserve); unsigned *num_maps, unsigned reserve);
......
...@@ -13,19 +13,22 @@ ...@@ -13,19 +13,22 @@
#define pr_fmt(fmt) "pinmux core: " fmt #define pr_fmt(fmt) "pinmux core: " fmt
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/kernel.h> #include <linux/debugfs.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/slab.h>
#include <linux/radix-tree.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/string.h> #include <linux/module.h>
#include <linux/debugfs.h> #include <linux/radix-tree.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/pinctrl/machine.h> #include <linux/pinctrl/machine.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/pinctrl/pinmux.h> #include <linux/pinctrl/pinmux.h>
#include "core.h" #include "core.h"
#include "pinmux.h" #include "pinmux.h"
......
...@@ -9,6 +9,17 @@ ...@@ -9,6 +9,17 @@
* *
* Author: Linus Walleij <linus.walleij@linaro.org> * Author: Linus Walleij <linus.walleij@linaro.org>
*/ */
#include <linux/types.h>
struct dentry;
struct seq_file;
struct pinctrl_dev;
struct pinctrl_gpio_range;
struct pinctrl_map;
struct pinctrl_setting;
#ifdef CONFIG_PINMUX #ifdef CONFIG_PINMUX
int pinmux_check_ops(struct pinctrl_dev *pctldev); int pinmux_check_ops(struct pinctrl_dev *pctldev);
......
...@@ -12,14 +12,15 @@ ...@@ -12,14 +12,15 @@
#define __LINUX_PINCTRL_CONSUMER_H #define __LINUX_PINCTRL_CONSUMER_H
#include <linux/err.h> #include <linux/err.h>
#include <linux/list.h> #include <linux/types.h>
#include <linux/seq_file.h>
#include <linux/pinctrl/pinctrl-state.h> #include <linux/pinctrl/pinctrl-state.h>
struct device;
/* This struct is private to the core and should be regarded as a cookie */ /* This struct is private to the core and should be regarded as a cookie */
struct pinctrl; struct pinctrl;
struct pinctrl_state; struct pinctrl_state;
struct device;
#ifdef CONFIG_PINCTRL #ifdef CONFIG_PINCTRL
...@@ -33,8 +34,7 @@ extern int pinctrl_gpio_set_config(unsigned gpio, unsigned long config); ...@@ -33,8 +34,7 @@ extern int pinctrl_gpio_set_config(unsigned gpio, unsigned long config);
extern struct pinctrl * __must_check pinctrl_get(struct device *dev); extern struct pinctrl * __must_check pinctrl_get(struct device *dev);
extern void pinctrl_put(struct pinctrl *p); extern void pinctrl_put(struct pinctrl *p);
extern struct pinctrl_state * __must_check pinctrl_lookup_state( extern struct pinctrl_state * __must_check pinctrl_lookup_state(struct pinctrl *p,
struct pinctrl *p,
const char *name); const char *name);
extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s); extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s);
...@@ -101,8 +101,7 @@ static inline void pinctrl_put(struct pinctrl *p) ...@@ -101,8 +101,7 @@ static inline void pinctrl_put(struct pinctrl *p)
{ {
} }
static inline struct pinctrl_state * __must_check pinctrl_lookup_state( static inline struct pinctrl_state * __must_check pinctrl_lookup_state(struct pinctrl *p,
struct pinctrl *p,
const char *name) const char *name)
{ {
return NULL; return NULL;
...@@ -145,8 +144,8 @@ static inline int pinctrl_pm_select_idle_state(struct device *dev) ...@@ -145,8 +144,8 @@ static inline int pinctrl_pm_select_idle_state(struct device *dev)
#endif /* CONFIG_PINCTRL */ #endif /* CONFIG_PINCTRL */
static inline struct pinctrl * __must_check pinctrl_get_select( static inline struct pinctrl * __must_check pinctrl_get_select(struct device *dev,
struct device *dev, const char *name) const char *name)
{ {
struct pinctrl *p; struct pinctrl *p;
struct pinctrl_state *s; struct pinctrl_state *s;
...@@ -171,14 +170,13 @@ static inline struct pinctrl * __must_check pinctrl_get_select( ...@@ -171,14 +170,13 @@ static inline struct pinctrl * __must_check pinctrl_get_select(
return p; return p;
} }
static inline struct pinctrl * __must_check pinctrl_get_select_default( static inline struct pinctrl * __must_check pinctrl_get_select_default(struct device *dev)
struct device *dev)
{ {
return pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT); return pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT);
} }
static inline struct pinctrl * __must_check devm_pinctrl_get_select( static inline struct pinctrl * __must_check devm_pinctrl_get_select(struct device *dev,
struct device *dev, const char *name) const char *name)
{ {
struct pinctrl *p; struct pinctrl *p;
struct pinctrl_state *s; struct pinctrl_state *s;
...@@ -203,8 +201,7 @@ static inline struct pinctrl * __must_check devm_pinctrl_get_select( ...@@ -203,8 +201,7 @@ static inline struct pinctrl * __must_check devm_pinctrl_get_select(
return p; return p;
} }
static inline struct pinctrl * __must_check devm_pinctrl_get_select_default( static inline struct pinctrl * __must_check devm_pinctrl_get_select_default(struct device *dev)
struct device *dev)
{ {
return devm_pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT); return devm_pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT);
} }
......
...@@ -14,11 +14,15 @@ ...@@ -14,11 +14,15 @@
#ifndef PINCTRL_DEVINFO_H #ifndef PINCTRL_DEVINFO_H
#define PINCTRL_DEVINFO_H #define PINCTRL_DEVINFO_H
struct device;
#ifdef CONFIG_PINCTRL #ifdef CONFIG_PINCTRL
/* The device core acts as a consumer toward pinctrl */ /* The device core acts as a consumer toward pinctrl */
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
struct pinctrl;
/** /**
* struct dev_pin_info - pin state container for devices * struct dev_pin_info - pin state container for devices
* @p: pinctrl handle for the containing device * @p: pinctrl handle for the containing device
...@@ -42,8 +46,6 @@ extern int pinctrl_init_done(struct device *dev); ...@@ -42,8 +46,6 @@ extern int pinctrl_init_done(struct device *dev);
#else #else
struct device;
/* Stubs if we're not using pinctrl */ /* Stubs if we're not using pinctrl */
static inline int pinctrl_bind_pins(struct device *dev) static inline int pinctrl_bind_pins(struct device *dev)
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#ifndef __LINUX_PINCTRL_MACHINE_H #ifndef __LINUX_PINCTRL_MACHINE_H
#define __LINUX_PINCTRL_MACHINE_H #define __LINUX_PINCTRL_MACHINE_H
#include <linux/bug.h> #include <linux/kernel.h> /* ARRAY_SIZE() */
#include <linux/pinctrl/pinctrl-state.h> #include <linux/pinctrl/pinctrl-state.h>
...@@ -149,6 +149,8 @@ struct pinctrl_map { ...@@ -149,6 +149,8 @@ struct pinctrl_map {
#define PIN_MAP_CONFIGS_GROUP_HOG_DEFAULT(dev, grp, cfgs) \ #define PIN_MAP_CONFIGS_GROUP_HOG_DEFAULT(dev, grp, cfgs) \
PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, cfgs) PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, cfgs)
struct pinctrl_map;
#ifdef CONFIG_PINCTRL #ifdef CONFIG_PINCTRL
extern int pinctrl_register_mappings(const struct pinctrl_map *map, extern int pinctrl_register_mappings(const struct pinctrl_map *map,
......
...@@ -11,9 +11,12 @@ ...@@ -11,9 +11,12 @@
#ifndef __LINUX_PINCTRL_PINCONF_GENERIC_H #ifndef __LINUX_PINCTRL_PINCONF_GENERIC_H
#define __LINUX_PINCTRL_PINCONF_GENERIC_H #define __LINUX_PINCTRL_PINCONF_GENERIC_H
#include <linux/device.h> #include <linux/types.h>
#include <linux/pinctrl/machine.h> #include <linux/pinctrl/machine.h>
struct device_node;
struct pinctrl_dev; struct pinctrl_dev;
struct pinctrl_map; struct pinctrl_map;
...@@ -196,25 +199,25 @@ int pinconf_generic_dt_node_to_map(struct pinctrl_dev *pctldev, ...@@ -196,25 +199,25 @@ int pinconf_generic_dt_node_to_map(struct pinctrl_dev *pctldev,
void pinconf_generic_dt_free_map(struct pinctrl_dev *pctldev, void pinconf_generic_dt_free_map(struct pinctrl_dev *pctldev,
struct pinctrl_map *map, unsigned num_maps); struct pinctrl_map *map, unsigned num_maps);
static inline int pinconf_generic_dt_node_to_map_group( static inline int pinconf_generic_dt_node_to_map_group(struct pinctrl_dev *pctldev,
struct pinctrl_dev *pctldev, struct device_node *np_config, struct device_node *np_config, struct pinctrl_map **map,
struct pinctrl_map **map, unsigned *num_maps) unsigned *num_maps)
{ {
return pinconf_generic_dt_node_to_map(pctldev, np_config, map, num_maps, return pinconf_generic_dt_node_to_map(pctldev, np_config, map, num_maps,
PIN_MAP_TYPE_CONFIGS_GROUP); PIN_MAP_TYPE_CONFIGS_GROUP);
} }
static inline int pinconf_generic_dt_node_to_map_pin( static inline int pinconf_generic_dt_node_to_map_pin(struct pinctrl_dev *pctldev,
struct pinctrl_dev *pctldev, struct device_node *np_config, struct device_node *np_config, struct pinctrl_map **map,
struct pinctrl_map **map, unsigned *num_maps) unsigned *num_maps)
{ {
return pinconf_generic_dt_node_to_map(pctldev, np_config, map, num_maps, return pinconf_generic_dt_node_to_map(pctldev, np_config, map, num_maps,
PIN_MAP_TYPE_CONFIGS_PIN); PIN_MAP_TYPE_CONFIGS_PIN);
} }
static inline int pinconf_generic_dt_node_to_map_all( static inline int pinconf_generic_dt_node_to_map_all(struct pinctrl_dev *pctldev,
struct pinctrl_dev *pctldev, struct device_node *np_config, struct device_node *np_config, struct pinctrl_map **map,
struct pinctrl_map **map, unsigned *num_maps) unsigned *num_maps)
{ {
/* /*
* passing the type as PIN_MAP_TYPE_INVALID causes the underlying parser * passing the type as PIN_MAP_TYPE_INVALID causes the underlying parser
......
...@@ -11,20 +11,20 @@ ...@@ -11,20 +11,20 @@
#ifndef __LINUX_PINCTRL_PINCTRL_H #ifndef __LINUX_PINCTRL_PINCTRL_H
#define __LINUX_PINCTRL_PINCTRL_H #define __LINUX_PINCTRL_PINCTRL_H
#include <linux/radix-tree.h> #include <linux/types.h>
#include <linux/list.h>
#include <linux/seq_file.h>
#include <linux/pinctrl/pinctrl-state.h>
#include <linux/pinctrl/devinfo.h>
struct device; struct device;
struct device_node;
struct gpio_chip;
struct module;
struct seq_file;
struct pin_config_item;
struct pinconf_generic_params;
struct pinconf_ops;
struct pinctrl_dev; struct pinctrl_dev;
struct pinctrl_map; struct pinctrl_map;
struct pinmux_ops; struct pinmux_ops;
struct pinconf_ops;
struct pin_config_item;
struct gpio_chip;
struct device_node;
/** /**
* struct pingroup - provides information on pingroup * struct pingroup - provides information on pingroup
......
...@@ -11,11 +11,10 @@ ...@@ -11,11 +11,10 @@
#ifndef __LINUX_PINCTRL_PINMUX_H #ifndef __LINUX_PINCTRL_PINMUX_H
#define __LINUX_PINCTRL_PINMUX_H #define __LINUX_PINCTRL_PINMUX_H
#include <linux/list.h> #include <linux/types.h>
#include <linux/seq_file.h>
#include <linux/pinctrl/pinctrl.h>
struct pinctrl_dev; struct pinctrl_dev;
struct pinctrl_gpio_range;
/** /**
* struct pinmux_ops - pinmux operations, to be implemented by pin controller * struct pinmux_ops - pinmux operations, to be implemented by pin controller
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment