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

Commit ca466128 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

ANDROID: GKI: USB: add Android ABI padding to some structures



To try to mitigate potential future USB api changes, add some padding to
the following structures:
	struct usb_interface
	struct usb_host_bos
	struct usb_bus
	struct usb_device
	struct usb_driver
	struct urb
	struct usb_hcd
	struct hc_driver
	struct usb_tt
	struct usbnet
	struct driver_info (for usbnet driver)

Based on a patch from Oliver Neukum <oneukum@suse.de> from the SLES
kernel.

Bug: 151154716
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
Change-Id: Ie9e246d9333ac70fc9cc2b0bf7cb466a8ffdb6de
parent 9dc35e84
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <linux/sched.h>	/* for current && schedule_timeout */
#include <linux/mutex.h>	/* for struct mutex */
#include <linux/pm_runtime.h>	/* for runtime PM */
#include <linux/android_kabi.h>

struct usb_device;
struct usb_driver;
@@ -257,6 +258,11 @@ struct usb_interface {
	struct device dev;		/* interface specific device info */
	struct device *usb_dev;
	struct work_struct reset_ws;	/* for resets in atomic context */

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
	ANDROID_KABI_RESERVE(3);
	ANDROID_KABI_RESERVE(4);
};
#define	to_usb_interface(d) container_of(d, struct usb_interface, dev)

@@ -404,6 +410,11 @@ struct usb_host_bos {
	struct usb_ptm_cap_descriptor	*ptm_cap;
	struct usb_config_summary_descriptor	*config_summary;
	unsigned int	num_config_summary_desc;

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
	ANDROID_KABI_RESERVE(3);
	ANDROID_KABI_RESERVE(4);
};

int __usb_get_extra_descriptor(char *buffer, unsigned size,
@@ -477,6 +488,11 @@ struct usb_bus {
					 * wakeup is detected or an interface
					 * driver starts I/O.
					 */

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
	ANDROID_KABI_RESERVE(3);
	ANDROID_KABI_RESERVE(4);
};

struct usb_dev_state;
@@ -718,6 +734,11 @@ struct usb_device {
	unsigned lpm_disable_count;

	u16 hub_delay;

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
	ANDROID_KABI_RESERVE(3);
	ANDROID_KABI_RESERVE(4);
};
#define	to_usb_device(d) container_of(d, struct usb_device, dev)

@@ -1227,6 +1248,11 @@ struct usb_driver {
	unsigned int supports_autosuspend:1;
	unsigned int disable_hub_initiated_lpm:1;
	unsigned int soft_unbind:1;

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
	ANDROID_KABI_RESERVE(3);
	ANDROID_KABI_RESERVE(4);
};
#define	to_usb_driver(d) container_of(d, struct usb_driver, drvwrap.driver)

@@ -1601,6 +1627,10 @@ struct urb {
	usb_complete_t complete;	/* (in) completion routine */
	struct usb_iso_packet_descriptor iso_frame_desc[0];
					/* (in) ISO ONLY */
	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
	ANDROID_KABI_RESERVE(3);
	ANDROID_KABI_RESERVE(4);
};

/* ----------------------------------------------------------------------- */
+16 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <linux/rwsem.h>
#include <linux/interrupt.h>
#include <linux/idr.h>
#include <linux/android_kabi.h>

#define MAX_TOPO_LEVEL		6

@@ -217,6 +218,11 @@ struct usb_hcd {
	 * (ohci 32, uhci 1024, ehci 256/512/1024).
	 */

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
	ANDROID_KABI_RESERVE(3);
	ANDROID_KABI_RESERVE(4);

	/* The HC driver's private data is stored at the end of
	 * this structure.
	 */
@@ -418,6 +424,11 @@ struct hc_driver {
	int (*get_core_id)(struct usb_hcd *hcd);
	int (*stop_endpoint)(struct usb_hcd *hcd, struct usb_device *udev,
			struct usb_host_endpoint *ep);

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
	ANDROID_KABI_RESERVE(3);
	ANDROID_KABI_RESERVE(4);
};

static inline int hcd_giveback_urb_in_bh(struct usb_hcd *hcd)
@@ -572,6 +583,11 @@ struct usb_tt {
	spinlock_t		lock;
	struct list_head	clear_list;	/* of usb_tt_clear */
	struct work_struct	clear_work;

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
	ANDROID_KABI_RESERVE(3);
	ANDROID_KABI_RESERVE(4);
};

struct usb_tt_clear {
+10 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@
#ifndef	__LINUX_USB_USBNET_H
#define	__LINUX_USB_USBNET_H

#include <linux/android_kabi.h>

/* interface from usbnet core to each USB networking link we handle */
struct usbnet {
	/* housekeeping */
@@ -83,6 +85,11 @@ struct usbnet {
#		define EVENT_LINK_CHANGE	11
#		define EVENT_SET_RX_MODE	12
#		define EVENT_NO_IP_ALIGN	13

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
	ANDROID_KABI_RESERVE(3);
	ANDROID_KABI_RESERVE(4);
};

static inline struct usb_driver *driver_of(struct usb_interface *intf)
@@ -172,6 +179,9 @@ struct driver_info {
	int		out;		/* tx endpoint */

	unsigned long	data;		/* Misc driver specific data */

	ANDROID_KABI_RESERVE(1);
	ANDROID_KABI_RESERVE(2);
};

/* Minidrivers are just drivers using the "usbnet" core as a powerful