Skip to content

Commit 781c467

Browse files
committed
[PR #975] config: untwist config backend prototypes
PR: #975
1 parent 2e85d81 commit 781c467

File tree

7 files changed

+59
-24
lines changed

7 files changed

+59
-24
lines changed

config/config-backends.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,4 @@
3434
void remove_devices(const char *backend, const char *config_info);
3535
BOOL device_is_duplicate(const char *config_info);
3636

37-
#ifdef CONFIG_UDEV
38-
int config_udev_pre_init(void);
39-
int config_udev_init(void);
40-
void config_udev_fini(void);
41-
void config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback);
42-
#elif defined(CONFIG_HAL)
43-
int config_hal_init(void);
44-
void config_hal_fini(void);
45-
#elif defined(CONFIG_WSCONS)
46-
int config_wscons_init(void);
47-
void config_wscons_fini(void);
48-
#endif
49-
5037
#endif /* XSERVER_CONFIG_BACKENDS_H */

config/config-hal.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef _XSERVER_CONFIG_HAL_H
2+
#define _XSERVER_CONFIG_HAL_H
3+
4+
#ifdef CONFIG_HAL
5+
6+
int config_hal_init(void);
7+
void config_hal_fini(void);
8+
9+
#else
10+
11+
static inline int config_hal_init(void) { return 1; }
12+
static inline void config_hal_fini(void) {}
13+
14+
#endif
15+
16+
#endif /* _XSERVER_CONFIG_HAL_H */

config/config-udev.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#ifndef _XSERVER_CONFIG_UDEV_H
2+
#define _XSERVER_CONFIG_UDEV_H
3+
4+
#ifdef CONFIG_UDEV
5+
6+
#include "config/hotplug_priv.h"
7+
8+
int config_udev_init(void);
9+
void config_udev_fini(void);
10+
int config_udev_pre_init(void);
11+
void config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback);
12+
13+
#else
14+
15+
static inline int config_udev_init(void) { return 1; }
16+
static inline void config_udev_fini(void) {}
17+
static inline int config_udev_pre_init(void) { return 1; }
18+
19+
#endif
20+
21+
#endif /* _XSERVER_CONFIG_UDEV_H */

config/config-wscons.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef _XSERVER_CONFIG_WSCONS_H
2+
#define _XSERVER_CONFIG_WSCONS_H
3+
4+
#ifdef CONFIG_WSCONS
5+
6+
int config_wscons_init(void);
7+
void config_wscons_fini(void);
8+
9+
#else
10+
11+
static inline int config_wscons_init(void) { return 1; }
12+
static inline void config_wscons_fini(void) {}
13+
14+
#endif
15+
16+
#endif /* _XSERVER_CONFIG_WSCONS_H */

config/config.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727

2828
#include <unistd.h>
2929

30+
#include "config/config-hal.h"
31+
#include "config/config-udev.h"
32+
#include "config/config-wscons.h"
3033
#include "config/hotplug_priv.h"
3134

3235
#include "os.h"
@@ -38,37 +41,27 @@
3841
void
3942
config_pre_init(void)
4043
{
41-
#ifdef CONFIG_UDEV
4244
if (!config_udev_pre_init())
4345
ErrorF("[config] failed to pre-init udev\n");
44-
#endif
4546
}
4647

4748
void
4849
config_init(void)
4950
{
50-
#ifdef CONFIG_UDEV
5151
if (!config_udev_init())
5252
ErrorF("[config] failed to initialise udev\n");
53-
#elif defined(CONFIG_HAL)
5453
if (!config_hal_init())
5554
ErrorF("[config] failed to initialise HAL\n");
56-
#elif defined(CONFIG_WSCONS)
5755
if (!config_wscons_init())
5856
ErrorF("[config] failed to initialise wscons\n");
59-
#endif
6057
}
6158

6259
void
6360
config_fini(void)
6461
{
65-
#if defined(CONFIG_UDEV)
6662
config_udev_fini();
67-
#elif defined(CONFIG_HAL)
6863
config_hal_fini();
69-
#elif defined(CONFIG_WSCONS)
7064
config_wscons_fini();
71-
#endif
7265
}
7366

7467
void

config/hal.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <dbus/dbus.h>
3232
#include <hal/libhal.h>
3333

34+
#include "config/config-hal.h"
3435
#include "config/hotplug_priv.h"
3536
#include "config/dbus-core.h"
3637
#include "os/fmt.h"

config/wscons.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
#include "input.h"
3737
#include "inputstr.h"
3838
#include "os.h"
39-
#include "config-backends.h"
39+
40+
#include "config/config-wscons.h"
4041

4142
#define WSCONS_KBD_DEVICE "/dev/wskbd"
4243
#define WSCONS_MOUSE_PREFIX "/dev/wsmouse"

0 commit comments

Comments
 (0)