Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29722150 authored by Jing Lin's avatar Jing Lin Committed by Gerrit - the friendly Code Review server
Browse files

input: maxim_sti: move header to uapi



Move kernel data structures to driver and keep the
data structures shared between kernel and user space
in the header file. Move the header to uapi to make
it accesible to user space.

Fix checkpatch errors to replace deprecated functions
and hardcoded error return values.

Change-Id: Ic3312c11ddda9f02da9807a6243206d582281995
Signed-off-by: default avatarJing Lin <jinglin@codeaurora.org>
parent c57b8e5f
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -27,7 +27,9 @@
#include <linux/interrupt.h>
#include <linux/input.h>
#include <linux/regulator/consumer.h>
#include <linux/input/maxim_sti.h>
#include <net/genetlink.h>
#include <net/sock.h>
#include <uapi/linux/maxim_sti.h>
#include <asm/byteorder.h>  /* MUST include this header to get byte order */
#ifdef CONFIG_OF
#include <linux/gpio.h>
@@ -57,6 +59,24 @@
/****************************************************************************\
* Device context structure, globals, and macros                              *
\****************************************************************************/
#define MAXIM_STI_NAME  "maxim_sti"

struct maxim_sti_pdata {
	char      *touch_fusion;
	char      *config_file;
	char      *nl_family;
	char      *fw_name;
	u32       nl_mc_groups;
	u32       chip_access_method;
	u32       default_reset_state;
	u32       tx_buf_size;
	u32       rx_buf_size;
	int       gpio_reset;
	int       gpio_irq;
	int       (*init)(struct maxim_sti_pdata *pdata, bool init);
	void      (*reset)(struct maxim_sti_pdata *pdata, int value);
	int       (*irq)(struct maxim_sti_pdata *pdata);
};

struct dev_data;

+1 −0
Original line number Diff line number Diff line
@@ -252,6 +252,7 @@ header-y += magic.h
header-y += major.h
header-y += map_to_7segment.h
header-y += matroxfb.h
header-y += maxim_sti.h
header-y += mdio.h
header-y += mdss_rotator.h
header-y += media.h
+3 −31
Original line number Diff line number Diff line
@@ -20,10 +20,7 @@
#ifndef __MAXIM_STI_H__
#define __MAXIM_STI_H__

#ifdef __KERNEL__
#include <net/genetlink.h>
#include <net/sock.h>
#else
#ifndef __KERNEL__
#include <stdlib.h>
#include "genetlink.h"
#endif
@@ -61,7 +58,7 @@
	((struct nlattr *)((void *)aptr + \
			NLA_ALIGN(((struct nlattr *)aptr)->nla_len)))
#define GENL_CMP(name1, name2)  strncmp(name1, name2, GENL_NAMSIZ)
#define GENL_COPY(name1, name2) strncpy(name1, name2, GENL_NAMSIZ)
#define GENL_COPY(name1, name2) strlcpy(name1, name2, GENL_NAMSIZ)
#define GENL_CHK(name)          (strlen(name) > (GENL_NAMSIZ - 1))
#define MSG_TYPE(nptr)          NL_ATTR_FIRST(nptr)->nla_type
#define MSG_PAYLOAD(nptr)       NL_ATTR_VAL(NL_ATTR_FIRST(nptr), void)
@@ -106,7 +103,7 @@ nl_add_attr(void *buf, __u16 type, void *ptr, __u16 len)

	a_ptr = nl_alloc_attr(buf, type, len);
	if (a_ptr == NULL)
		return -1;
		return -EPERM;
	memcpy(a_ptr, ptr, len);
	return 0;
}
@@ -329,30 +326,5 @@ struct __attribute__ ((__packed__)) fu_sysfs_info {
	__u16  lcd_fps_value;
};

#ifdef __KERNEL__
/****************************************************************************\
* Kernel platform data structure                                             *
\****************************************************************************/

#define MAXIM_STI_NAME  "maxim_sti"

struct maxim_sti_pdata {
	char      *touch_fusion;
	char      *config_file;
	char      *nl_family;
	char      *fw_name;
	u32       nl_mc_groups;
	u32       chip_access_method;
	u32       default_reset_state;
	u32       tx_buf_size;
	u32       rx_buf_size;
	int       gpio_reset;
	int       gpio_irq;
	int       (*init)(struct maxim_sti_pdata *pdata, bool init);
	void      (*reset)(struct maxim_sti_pdata *pdata, int value);
	int       (*irq)(struct maxim_sti_pdata *pdata);
};
#endif

#endif