Created
February 2, 2018 18:40
-
-
Save jvsalo/507b0b1e575a7d4fbf34a53b1f7fc3c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/drivers/bluetooth/btwilink.c b/drivers/bluetooth/btwilink.c | |
index cc6f4b7194b2..a557749a509a 100644 | |
--- a/drivers/bluetooth/btwilink.c | |
+++ b/drivers/bluetooth/btwilink.c | |
@@ -304,6 +304,9 @@ static int bt_ti_probe(struct platform_device *pdev) | |
struct hci_dev *hdev; | |
int err; | |
+ if (!st_is_initialized()) | |
+ return -EPROBE_DEFER; | |
+ | |
hst = devm_kzalloc(&pdev->dev, sizeof(struct ti_st), GFP_KERNEL); | |
if (!hst) | |
return -ENOMEM; | |
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c | |
index b9508426a129..dd4408f706cd 100644 | |
--- a/drivers/misc/ti-st/st_core.c | |
+++ b/drivers/misc/ti-st/st_core.c | |
@@ -514,6 +514,19 @@ void kim_st_list_protocols(struct st_data_s *st_gdata, void *buf) | |
st_gdata->is_registered[0x09] == true ? 'R' : 'U'); | |
} | |
+int st_is_initialized() | |
+{ | |
+ struct st_data_s *st_gdata; | |
+ st_kim_ref(&st_gdata, 0); | |
+ | |
+ if (st_gdata == NULL) | |
+ return 0; | |
+ | |
+ return 1; | |
+} | |
+ | |
+EXPORT_SYMBOL_GPL(st_is_initialized); | |
+ | |
/********************************************************************/ | |
/* | |
* functions called from protocol stack drivers | |
diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h | |
index b7c44253ea31..3285f6d3c159 100644 | |
--- a/include/linux/ti_wilink_st.h | |
+++ b/include/linux/ti_wilink_st.h | |
@@ -83,6 +83,7 @@ struct st_proto_s { | |
unsigned char reserve; | |
}; | |
+extern int st_is_initialized(void); | |
extern long st_register(struct st_proto_s *); | |
extern long st_unregister(struct st_proto_s *); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment