Skip to contentSkip to conversation

driver core fixes for 3.1

PATCH New Greg KH 2 participants 15 messages Aug 26, 2011

Subsystems (2)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 driver core fixes for 3.1

Here's some driver core, and other driver-core related fixes for your 3.1 git tree.

Just a few minor fixes for things that people have reported, and a number of bug fixes for the ti-st driver.

Please pull from:
master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-core-2.6.git/ driver-core-linus

All of these patches have been in the linux-next and mm trees for a while now.

The patches will be sent as a follow-on to this message to lkml for people to see.

thanks,

greg k-h

------------

 drivers/base/devres.c          |    1 +
 drivers/base/devtmpfs.c        |    2 +-
 drivers/base/platform.c        |    2 +-
 drivers/firmware/google/gsmi.c |    2 +-
 drivers/misc/Kconfig           |    1 +
 drivers/misc/ti-st/st_core.c   |   10 +++++++++-
 drivers/misc/ti-st/st_kim.c    |   33 +++++++++++++++++++++++++++++++++
 drivers/misc/ti-st/st_ll.c     |   19 +++++++++++++++++++
 include/linux/ti_wilink_st.h   |   27 ++++++++++++++++++++++++++-
 9 files changed, 92 insertions(+), 5 deletions(-)

---------------

Arnaud Lacombe (1):
drivers/base/devtmpfs.c: correct annotation of `setup_done'

H Hartley Sweeten (1):
base/devres.c: quiet sparse noise about context imbalance

Heiko Carstens (1):
pti: add missing CONFIG_PCI dependency

Pavan Savoy (7):
drivers:misc: ti-st: avoid a misleading dbg msg drivers:misc:ti-st: platform hooks for chip states drivers:misc: ti-st: reinit completion on ver read drivers:misc: ti-st: reinit completion before send drivers:misc: ti-st: wait for completion at fail drivers:misc: ti-st: free skb on firmware download drivers:misc: ti-st: fix unexpected UART close

Randy Dunlap (2):
firmware: fix google/gsmi.c build warning driver core: fix kernel-doc warning in platform.c

Vijay Badawadagi (1):
drivers:misc: ti-st: fail-safe on wrong pkt type

#1 lore raw

PATCH 1/13 firmware: fix google/gsmi.c build warning

From: Randy Dunlap <[email protected]>

Modify function parameter type to match expected type. Fixes a build warning:

drivers/firmware/google/gsmi.c:473: warning: initialization from incompatible pointer type

---
 drivers/firmware/google/gsmi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/firmware/google/gsmi.c +1 -1
index 68810fd..aa83de9 100644
@@ -420,7 +420,7 @@ static efi_status_t gsmi_get_next_variable(unsigned long *name_size,
 
 static efi_status_t gsmi_set_variable(efi_char16_t *name,
 				      efi_guid_t *vendor,
-				      unsigned long attr,
+				      u32 attr,
 				      unsigned long data_size,
 				      void *data)
 {
Signature · 1 line
1.7.6.1
#2 lore raw

PATCH 2/13 driver core: fix kernel-doc warning in platform.c

From: Randy Dunlap <[email protected]>

Warning(drivers/base/platform.c:50): No description found for parameter 'pdev' Warning(drivers/base/platform.c:50): Excess function parameter 'dev' description in 'arch_setup_pdev_archdata'

---
 drivers/base/platform.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/base/platform.c +1 -1
index 0cad9c7..99a5272 100644
@@ -33,7 +33,7 @@ EXPORT_SYMBOL_GPL(platform_bus);
 
 /**
  * arch_setup_pdev_archdata - Allow manipulation of archdata before its used
- * @dev: platform device
+ * @pdev: platform device
  *
  * This is called before platform_device_add() such that any pdev_archdata may
  * be setup before the platform_notifier is called.  So if a user needs to
Signature · 1 line
1.7.6.1
#3 lore raw

PATCH 3/13 drivers/base/devtmpfs.c: correct annotation of `setup_done'

In reply to Greg Kroah-Hartman

From: Arnaud Lacombe <[email protected]>

This fixes the following section mismatch issue:

WARNING: vmlinux.o(.text+0x1192bf): Section mismatch in reference from the function devtmpfsd() to the variable .init.data:setup_done The function devtmpfsd() references the variable __initdata setup_done.
This is often because devtmpfsd lacks a __initdata annotation or the annotation of setup_done is wrong.

WARNING: vmlinux.o(.text+0x119342): Section mismatch in reference from the function devtmpfsd() to the variable .init.data:setup_done The function devtmpfsd() references the variable __initdata setup_done.
This is often because devtmpfsd lacks a __initdata annotation or the annotation of setup_done is wrong.

---
 drivers/base/devtmpfs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/base/devtmpfs.c +1 -1
index 33e1bed..a4760e0 100644
@@ -376,7 +376,7 @@ int devtmpfs_mount(const char *mntdir)
 	return err;
 }
 
-static __initdata DECLARE_COMPLETION(setup_done);
+static DECLARE_COMPLETION(setup_done);
 
 static int handle(const char *name, mode_t mode, struct device *dev)
 {
Signature · 1 line
1.7.6.1
#4 lore raw

PATCH 4/13 pti: add missing CONFIG_PCI dependency

In reply to Greg Kroah-Hartman

From: Heiko Carstens <[email protected]>

allmodconfig compile fails on s390 because of the new PTI driver:

drivers/misc/pti.c:407:3: error: implicit declaration of function 'pci_iounmap' drivers/misc/pti.c:410:3: error: implicit declaration of function 'pci_release_region'

Add a 'depends on PCI' statement so it doesn't get compiled.

Cc J Freyensee <[email protected]>
---
 drivers/misc/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/misc/Kconfig +1 -0
index 0a4d86c..2d6423c 100644
@@ -146,6 +146,7 @@ config PHANTOM
 
 config INTEL_MID_PTI
 	tristate "Parallel Trace Interface for MIPI P1149.7 cJTAG standard"
+	depends on PCI
 	default n
 	help
 	  The PTI (Parallel Trace Interface) driver directs
Signature · 1 line
1.7.6.1
#5 lore raw

PATCH 5/13 base/devres.c: quiet sparse noise about context imbalance

In reply to Greg Kroah-Hartman

From: H Hartley Sweeten <[email protected]>

devres_release_all and devres_release_group both aquire the lock &dev->devres_lock but the release of that lock is done in release_nodes. This results in sparse noise about context imbalance.

Add a lock annotation to release_nodes to quiet this noise.

---
 drivers/base/devres.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/base/devres.c +1 -0
index cf7a0c7..65cd748 100644
@@ -397,6 +397,7 @@ static int remove_nodes(struct device *dev,
 
 static int release_nodes(struct device *dev, struct list_head *first,
 			 struct list_head *end, unsigned long flags)
+	__releases(&dev->devres_lock)
 {
 	LIST_HEAD(todo);
 	int cnt;
Signature · 1 line
1.7.6.1
#6 lore raw

PATCH 6/13 drivers:misc: ti-st: avoid a misleading dbg msg

In reply to Greg Kroah-Hartman

From: Pavan Savoy <[email protected]>

Previously the private data of each protocol registered to use ST was used to determine whether the protocol was registered to use shared transport or otherwise.
However, now a flag is_registered is maintained to identify whether a protocol intends to use ST.
Upon closing of the UART the error message relevant to this lack of un-registration was misleading and this patch fixes that.

---
 drivers/misc/ti-st/st_core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/misc/ti-st/st_core.c +1 -1
index 54c91ff..c8e335d 100644
@@ -717,7 +717,7 @@ static void st_tty_close(struct tty_struct *tty)
 	 */
 	spin_lock_irqsave(&st_gdata->lock, flags);
 	for (i = ST_BT; i < ST_MAX_CHANNELS; i++) {
-		if (st_gdata->list[i] != NULL)
+		if (st_gdata->is_registered[i] == true)
 			pr_err("%d not un-registered", i);
 		st_gdata->list[i] = NULL;
 	}
Signature · 1 line
1.7.6.1
#7 lore raw

PATCH 7/13 drivers:misc:ti-st: platform hooks for chip states

In reply to Greg Kroah-Hartman

From: Pavan Savoy <[email protected]>

Certain platform specific or Host-WiLink Interface specific actions would be required to be taken when the chip is being enabled and after the chip is disabled such as configuration of the mux modes for the GPIO of host connected to the nshutdown of the chip or relinquishing UART after the chip is disabled.

Similar actions can also be taken when the chip is in deep sleep or when the chip is awake. Performance enhancements such as configuring the host to run faster when chip is awake and slower when chip is asleep can also be made here.

---
 drivers/misc/ti-st/st_kim.c  |   12 ++++++++++++
 drivers/misc/ti-st/st_ll.c   |   19 +++++++++++++++++++
 include/linux/ti_wilink_st.h |   27 ++++++++++++++++++++++++++-
 3 files changed, 57 insertions(+), 1 deletions(-)
drivers/misc/ti-st/st_kim.c +12 -0
index 38fd2f0..6884dd1 100644
@@ -434,11 +434,17 @@ long st_kim_start(void *kim_data)
 {
 	long err = 0;
 	long retry = POR_RETRY_COUNT;
+	struct ti_st_plat_data	*pdata;
 	struct kim_data_s	*kim_gdata = (struct kim_data_s *)kim_data;
 
 	pr_info(" %s", __func__);
+	pdata = kim_gdata->kim_pdev->dev.platform_data;
 
 	do {
+		/* platform specific enabling code here */
+		if (pdata->chip_enable)
+			pdata->chip_enable(kim_gdata);
+
 		/* Configure BT nShutdown to HIGH state */
 		gpio_set_value(kim_gdata->nshutdown, GPIO_LOW);
 		mdelay(5);	/* FIXME: a proper toggle */
@@ -489,6 +495,8 @@ long st_kim_stop(void *kim_data)
 {
 	long err = 0;
 	struct kim_data_s	*kim_gdata = (struct kim_data_s *)kim_data;
+	struct ti_st_plat_data	*pdata =
+		kim_gdata->kim_pdev->dev.platform_data;
 
 	INIT_COMPLETION(kim_gdata->ldisc_installed);
 
@@ -515,6 +523,10 @@ long st_kim_stop(void *kim_data)
 	gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH);
 	mdelay(1);
 	gpio_set_value(kim_gdata->nshutdown, GPIO_LOW);
+
+	/* platform specific disable */
+	if (pdata->chip_disable)
+		pdata->chip_disable(kim_gdata);
 	return err;
 }
 
drivers/misc/ti-st/st_ll.c +19 -0
index 3f24951..1ff460a 100644
@@ -22,6 +22,7 @@
 #define pr_fmt(fmt) "(stll) :" fmt
 #include <linux/skbuff.h>
 #include <linux/module.h>
+#include <linux/platform_device.h>
 #include <linux/ti_wilink_st.h>
 
 /**********************************************************************/
@@ -37,6 +38,9 @@ static void send_ll_cmd(struct st_data_s *st_data,
 
 static void ll_device_want_to_sleep(struct st_data_s *st_data)
 {
+	struct kim_data_s	*kim_data;
+	struct ti_st_plat_data	*pdata;
+
 	pr_debug("%s", __func__);
 	/* sanity check */
 	if (st_data->ll_state != ST_LL_AWAKE)
@@ -46,10 +50,19 @@ static void ll_device_want_to_sleep(struct st_data_s *st_data)
 	send_ll_cmd(st_data, LL_SLEEP_ACK);
 	/* update state */
 	st_data->ll_state = ST_LL_ASLEEP;
+
+	/* communicate to platform about chip asleep */
+	kim_data = st_data->kim_data;
+	pdata = kim_data->kim_pdev->dev.platform_data;
+	if (pdata->chip_asleep)
+		pdata->chip_asleep(NULL);
 }
 
 static void ll_device_want_to_wakeup(struct st_data_s *st_data)
 {
+	struct kim_data_s	*kim_data;
+	struct ti_st_plat_data	*pdata;
+
 	/* diff actions in diff states */
 	switch (st_data->ll_state) {
 	case ST_LL_ASLEEP:
@@ -70,6 +83,12 @@ static void ll_device_want_to_wakeup(struct st_data_s *st_data)
 	}
 	/* update state */
 	st_data->ll_state = ST_LL_AWAKE;
+
+	/* communicate to platform about chip wakeup */
+	kim_data = st_data->kim_data;
+	pdata = kim_data->kim_pdev->dev.platform_data;
+	if (pdata->chip_asleep)
+		pdata->chip_awake(NULL);
 }
 
 /**********************************************************************/
include/linux/ti_wilink_st.h +26 -1
index b004e55..2ef4385 100644
@@ -410,7 +410,28 @@ struct gps_event_hdr {
 	u16 plen;
 } __attribute__ ((packed));
 
-/* platform data */
+/**
+ * struct ti_st_plat_data - platform data shared between ST driver and
+ *	platform specific board file which adds the ST device.
+ * @nshutdown_gpio: Host's GPIO line to which chip's BT_EN is connected.
+ * @dev_name: The UART/TTY name to which chip is interfaced. (eg: /dev/ttyS1)
+ * @flow_cntrl: Should always be 1, since UART's CTS/RTS is used for PM
+ *	purposes.
+ * @baud_rate: The baud rate supported by the Host UART controller, this will
+ *	be shared across with the chip via a HCI VS command from User-Space Init
+ *	Mgr application.
+ * @suspend:
+ * @resume: legacy PM routines hooked to platform specific board file, so as
+ *	to take chip-host interface specific action.
+ * @chip_enable:
+ * @chip_disable: Platform/Interface specific mux mode setting, GPIO
+ *	configuring, Host side PM disabling etc.. can be done here.
+ * @chip_asleep:
+ * @chip_awake: Chip specific deep sleep states is communicated to Host
+ *	specific board-xx.c to take actions such as cut UART clocks when chip
+ *	asleep or run host faster when chip awake etc..
+ *
+ */
 struct ti_st_plat_data {
 	long nshutdown_gpio;
 	unsigned char dev_name[UART_DEV_NAME_LEN]; /* uart name */
@@ -418,6 +439,10 @@ struct ti_st_plat_data {
 	unsigned long baud_rate;
 	int (*suspend)(struct platform_device *, pm_message_t);
 	int (*resume)(struct platform_device *);
+	int (*chip_enable) (struct kim_data_s *);
+	int (*chip_disable) (struct kim_data_s *);
+	int (*chip_asleep) (struct kim_data_s *);
+	int (*chip_awake) (struct kim_data_s *);
 };
 
 #endif /* TI_WILINK_ST_H */
Signature · 1 line
1.7.6.1
#8 lore raw

PATCH 8/13 drivers:misc: ti-st: reinit completion on ver read

In reply to Greg Kroah-Hartman

From: Pavan Savoy <[email protected]>

After the version information has been read, the completion which assists in wait_for_completion during the firmware send/wait sequence is being re-used and hence this needs to be re-initialised for fool proof firmware download retries.

---
 drivers/misc/ti-st/st_kim.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/misc/ti-st/st_kim.c +1 -0
index 6884dd1..e5639ca 100644
@@ -210,6 +210,7 @@ static long read_local_version(struct kim_data_s *kim_gdata, char *bts_scr_name)
 		pr_err(" waiting for ver info- timed out ");
 		return -ETIMEDOUT;
 	}
+	INIT_COMPLETION(kim_gdata->kim_rcvd);
 
 	version =
 		MAKEWORD(kim_gdata->resp_buffer[13],
Signature · 1 line
1.7.6.1
#9 lore raw

PATCH 9/13 drivers:misc: ti-st: fail-safe on wrong pkt type

In reply to Greg Kroah-Hartman

From: Vijay Badawadagi <[email protected]>

Texas Instrument's shared transport driver interpret incoming data from the UART based on the various protocol drivers registered to the driver such as btwilink driver or FM or GPS driver which provide logical channel IDs.

In case of bad-behavior from chip such as HCI Event response for a GPS command or a HCI Event (h/w error event) for a FM response & In case of bad-behavior from UART driver such as dropping data bytes a fail-safe is required to avoid kernel panic.

---
 drivers/misc/ti-st/st_core.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/misc/ti-st/st_core.c +7 -0
index c8e335d..1f973ce 100644
@@ -338,6 +338,12 @@ void st_int_recv(void *disc_data,
 			/* Unknow packet? */
 		default:
 			type = *ptr;
+			if (st_gdata->list[type] == NULL) {
+				pr_err("chip/interface misbehavior dropping"
+					" frame starting with 0x%02x", type);
+				goto done;
+
+			}
 			st_gdata->rx_skb = alloc_skb(
 					st_gdata->list[type]->max_frame_size,
 					GFP_ATOMIC);
@@ -354,6 +360,7 @@ void st_int_recv(void *disc_data,
 		ptr++;
 		count--;
 	}
+done:
 	spin_unlock_irqrestore(&st_gdata->lock, flags);
 	pr_debug("done %s", __func__);
 	return;
Signature · 1 line
1.7.6.1
#10 lore raw

PATCH 10/13 drivers:misc: ti-st: reinit completion before send

In reply to Greg Kroah-Hartman

From: Pavan Savoy <[email protected]>

download firmware behaves differently at different times, when logs are enabled and the system is loaded, the wait_for_completion is able to wait for every send, However during other times the wait does not happen.

So, for reliability reinitializing the completion before every send, makes sure the wait happens for every send.

---
 drivers/misc/ti-st/st_kim.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/misc/ti-st/st_kim.c +6 -0
index e5639ca..1748a93 100644
@@ -299,6 +299,7 @@ static long download_firmware(struct kim_data_s *kim_gdata)
 
 		switch (((struct bts_action *)ptr)->type) {
 		case ACTION_SEND_COMMAND:	/* action send */
+			pr_debug("S");
 			action_ptr = &(((struct bts_action *)ptr)->data[0]);
 			if (unlikely
 			    (((struct hci_command *)action_ptr)->opcode ==
@@ -336,6 +337,10 @@ static long download_firmware(struct kim_data_s *kim_gdata)
 				release_firmware(kim_gdata->fw_entry);
 				return -ETIMEDOUT;
 			}
+			/* reinit completion before sending for the
+			 * relevant wait
+			 */
+			INIT_COMPLETION(kim_gdata->kim_rcvd);
 
 			/*
 			 * Free space found in uart buffer, call st_int_write
@@ -362,6 +367,7 @@ static long download_firmware(struct kim_data_s *kim_gdata)
 			}
 			break;
 		case ACTION_WAIT_EVENT:  /* wait */
+			pr_debug("W");
 			if (!wait_for_completion_timeout
 					(&kim_gdata->kim_rcvd,
 					 msecs_to_jiffies(CMD_RESP_TIME))) {
Signature · 1 line
1.7.6.1
#11 lore raw

PATCH 11/13 drivers:misc: ti-st: wait for completion at fail

In reply to Greg Kroah-Hartman

From: Pavan Savoy <[email protected]>

When the line discipline install fails for reasons such as missing user-space UIM or broken communication between UIM and ST driver, then the ST attempts/retries to request for ldisc installation again.

---
 drivers/misc/ti-st/st_kim.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
drivers/misc/ti-st/st_kim.c +13 -0
index 1748a93..d8ca406 100644
@@ -473,6 +473,12 @@ long st_kim_start(void *kim_data)
 			pr_info("ldisc_install = 0");
 			sysfs_notify(&kim_gdata->kim_pdev->dev.kobj,
 					NULL, "install");
+			/* the following wait is never going to be completed,
+			 * since the ldisc was never installed, hence serving
+			 * as a mdelay of LDISC_TIME msecs */
+			err = wait_for_completion_timeout
+				(&kim_gdata->ldisc_installed,
+				 msecs_to_jiffies(LDISC_TIME));
 			err = -ETIMEDOUT;
 			continue;
 		} else {
@@ -485,6 +491,13 @@ long st_kim_start(void *kim_data)
 				pr_info("ldisc_install = 0");
 				sysfs_notify(&kim_gdata->kim_pdev->dev.kobj,
 						NULL, "install");
+				/* this wait might be completed, though in the
+				 * tty_close() since the ldisc is already
+				 * installed */
+				err = wait_for_completion_timeout
+					(&kim_gdata->ldisc_installed,
+					 msecs_to_jiffies(LDISC_TIME));
+				err = -EINVAL;
 				continue;
 			} else {	/* on success don't retry */
 				break;
Signature · 1 line
1.7.6.1
#12 lore raw

PATCH 12/13 drivers:misc: ti-st: free skb on firmware download

In reply to Greg Kroah-Hartman

From: Pavan Savoy <[email protected]>

If during validation of the firmware download the data doesn't match what is expected out of the chip, this calls for a firmware download failure and a retry.
Free the SKB which collects response during such scenarios.

---
 drivers/misc/ti-st/st_kim.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/misc/ti-st/st_kim.c +1 -0
index d8ca406..3a35805 100644
@@ -68,6 +68,7 @@ void validate_firmware_response(struct kim_data_s *kim_gdata)
 	if (unlikely(skb->data[5] != 0)) {
 		pr_err("no proper response during fw download");
 		pr_err("data6 %x", skb->data[5]);
+		kfree_skb(skb);
 		return;		/* keep waiting for the proper response */
 	}
 	/* becos of all the script being downloaded */
Signature · 1 line
1.7.6.1
#13 lore raw

PATCH 13/13 drivers:misc: ti-st: fix unexpected UART close

In reply to Greg Kroah-Hartman

From: Pavan Savoy <[email protected]>

If suppose the UIM were to die and hence UART were to close when the Bluetooth/FM or GPS is turned on, prep the ST for a state where-in if the UIM comes back up, Bluetooth/FM/GPS can be turned on.

---
 drivers/misc/ti-st/st_core.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/misc/ti-st/st_core.c +1 -0
index 1f973ce..ba168a7 100644
@@ -727,6 +727,7 @@ static void st_tty_close(struct tty_struct *tty)
 		if (st_gdata->is_registered[i] == true)
 			pr_err("%d not un-registered", i);
 		st_gdata->list[i] = NULL;
+		st_gdata->is_registered[i] = false;
 	}
 	st_gdata->protos_registered = 0;
 	spin_unlock_irqrestore(&st_gdata->lock, flags);
Signature · 1 line
1.7.6.1