You are not logged in.

#1 2013-09-30 08:31:52

valantin
Member
Registered: 2013-09-30
Posts: 7

Issue on compile rt3290/rt3298 Bluetooth module rtbth

Hi all, I'm trying to build the bluetooth module for ralink 3290 wifi+BT mpcie module.

I need some clarification to the change in kernel 3.11, the source require daemonize((PSTRING)&pOSTask->taskName[0]); but it isn't present in kernel 3.11, how can I workaround the problem?

Offline

#2 2013-09-30 12:39:30

valantin
Member
Registered: 2013-09-30
Posts: 7

Re: Issue on compile rt3290/rt3298 Bluetooth module rtbth

this is the patch for all build error (not for warning) except for deamonize kenel 3.8 code.

--- rtbth_core_bluez.c.orig	2012-08-10 07:44:50.000000000 +0200
+++ rtbth_core_bluez.c	2013-09-30 14:13:18.462179696 +0200
@@ -86,7 +86,11 @@
 int rtbt_hci_dev_send(struct sk_buff *skb)
 {
 	struct hci_dev *hdev = (struct hci_dev *)skb->dev;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
 	struct rtbt_os_ctrl *os_ctrl = (struct rtbt_os_ctrl *)hdev->driver_data;
+#else
+	struct rtbt_os_ctrl *os_ctrl = (struct rtbt_os_ctrl *)hci_get_drvdata(hdev);
+#endif
 	struct rtbt_hps_ops *hps_ops;
 	unsigned char pkt_type;
 	int status;
@@ -136,7 +140,11 @@
 			
 		case HCI_SCODATA_PKT:
 			printk("-->%s():sco len=%d,time=0x%lx\n", __FUNCTION__, skb->len, jiffies);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
 			os_ctrl->sco_tx_seq = bt_cb(skb)->tx_seq;
+#else
+			os_ctrl->sco_tx_seq = bt_cb(skb)->control.txseq;
+#endif
 			os_ctrl->sco_time_hci = jiffies;
 			
 			status = hps_ops->hci_sco_data(os_ctrl->dev_ctrl, skb->data, skb->len);
@@ -223,7 +231,11 @@
 int rtbt_hci_dev_open(struct hci_dev *hdev)
 {
 	NTSTATUS status = STATUS_FAILURE;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
 	struct rtbt_os_ctrl *os_ctrl = (struct rtbt_os_ctrl *)hdev->driver_data;
+#else
+	struct rtbt_os_ctrl *os_ctrl = (struct rtbt_os_ctrl *)hci_get_drvdata(hdev);
+#endif
 	//struct rtbt_hps_ops *hps_ops;
 
 	printk("-->%s()\n", __FUNCTION__);
@@ -251,7 +263,11 @@
 int rtbt_hci_dev_close(struct hci_dev *hdev)
 {
 	NTSTATUS status = STATUS_FAILURE;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
 	struct rtbt_os_ctrl *os_ctrl = (struct rtbt_os_ctrl *)hdev->driver_data;
+#else
+	struct rtbt_os_ctrl *os_ctrl = (struct rtbt_os_ctrl *)hci_get_drvdata(hdev);
+#endif
 	
 	printk("--->%s()\n", __FUNCTION__);
 
@@ -295,7 +311,11 @@
 
 	printk("--->%s()\n", __FUNCTION__);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
     __hci_dev_hold(hdev);
+#else
+	hci_dev_hold(hdev);
+#endif
 
     //rtbt_hci_dev_close(hciDev);
 	/* un-register HCI device */
@@ -304,10 +324,18 @@
 		return -1;
 	}
 		
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
 	if (hci_unregister_dev(hdev) < 0)
 		printk("Can't unregister HCI device %s\n", hdev->name);
+#else
+	hci_unregister_dev(hdev);
+#endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
     __hci_dev_put(hdev);
+#else
+	hci_dev_put(hdev);
+#endif
 
 	printk("<---%s():Success\n", __FUNCTION__);
 	return 0;
@@ -319,7 +347,11 @@
 
 	printk("--->%s()\n", __FUNCTION__);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
     __hci_dev_hold(hdev);
+#else
+	hci_dev_hold(hdev);
+#endif
     
 	/* Register HCI device */
 	if (hci_register_dev(hdev) < 0) {
@@ -327,7 +359,11 @@
 		return -ENODEV;
 	}
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
 	__hci_dev_put(hdev);
+#else
+	hci_dev_put(hdev);
+#endif
 
 	printk("<---%s():Success\n", __FUNCTION__);
 	return 0;
@@ -396,15 +432,23 @@
 	os_ctrl->if_dev = if_dev;
 	os_ctrl->hps_ops->recv = rtbt_hci_dev_receive;
 	
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
 	hdev->driver_data = os_ctrl;
+#else
+	hci_set_drvdata(hdev, os_ctrl);
+#endif
 	hdev->open = rtbt_hci_dev_open;
 	hdev->close = rtbt_hci_dev_close;
 	hdev->flush = rtbt_hci_dev_flush;
 	hdev->send = rtbt_hci_dev_send;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
 	hdev->destruct = rtbt_hci_dev_destruct;
+#endif
 	hdev->ioctl = rtbt_hci_dev_ioctl;
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
 	hdev->owner = THIS_MODULE;
+#endif
 
 	printk("<--%s():alloc hdev(0x%lx) done\n", __FUNCTION__, (ULONG)hdev);
 	
--- rtbth_core_pci.c.orig	2012-08-10 07:34:24.000000000 +0200
+++ rtbth_core_pci.c	2013-09-30 14:02:02.312140518 +0200
@@ -35,7 +35,12 @@
 #ifdef OS_ABL_SUPPORT
 /* struct pci_device_id *rtbt_pci_ids = NULL; */
 #else
-static struct pci_device_id rtbt_pci_ids[] __devinitdata = {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
+static struct pci_device_id rtbt_pci_ids[] __devinitdata = 
+#else
+static struct pci_device_id rtbt_pci_ids[]= 
+#endif
+{
 	{PCI_DEVICE(0x1814, 0x3298)},
 	{}
 };
@@ -57,7 +62,11 @@
 		return -1;
 	}
 	
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
 	os_ctrl = (struct rtbt_os_ctrl *)(hci_dev->driver_data);
+#else
+	os_ctrl = (struct rtbt_os_ctrl *)hci_get_drvdata(hci_dev);
+#endif
 	if (os_ctrl == NULL) {
 		printk("%s(): hci_dev->driver_data is NULL!\n", __FUNCTION__);
 		return -1;
@@ -84,7 +93,11 @@
         return -1;
     }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
     os_ctrl = (struct rtbt_os_ctrl *)(hci_dev->driver_data);
+#else
+    os_ctrl = (struct rtbt_os_ctrl *)hci_get_drvdata(hci_dev);
+#endif
     if (os_ctrl == NULL) {
         printk("%s(): hci_dev->driver_data is NULL!\n", __FUNCTION__);
         return -1;
@@ -98,8 +111,13 @@
 }
 #endif /* CONFIG_PM */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
 static int __devinit rtbt_pci_probe(struct pci_dev *pdev,
 					const struct pci_device_id *id)
+#else
+static int rtbt_pci_probe(struct pci_dev *pdev,
+					const struct pci_device_id *id)
+#endif
 {
 	const char *print_name;
 	struct rtbt_os_ctrl *os_ctrl;
@@ -225,7 +243,11 @@
 	return -1;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
 static void __devexit rtbt_pci_remove(struct pci_dev *pdev)
+#else
+static void rtbt_pci_remove(struct pci_dev *pdev)
+#endif
 {
 	struct hci_dev *hci_dev = (struct hci_dev *)pci_get_drvdata(pdev);
 	struct rtbt_os_ctrl *os_ctrl;
@@ -237,7 +259,11 @@
 		return;
 	}
 	
-	os_ctrl = (struct rtbt_os_ctrl *)(hci_dev->driver_data);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
+	os_ctrl = (struct rtbt_os_ctrl *)hci_dev->driver_data;
+#else
+	os_ctrl = (struct rtbt_os_ctrl *)hci_get_drvdata(hci_dev);
+#endif
 	if (os_ctrl == NULL) {
 		printk("%s(): hci_dev->driver_data is NULL!\n", __FUNCTION__);
 		return;
@@ -289,8 +315,12 @@
 #endif /* OS_ABL_SUPPORT */
 	.probe = rtbt_pci_probe,
 #if LINUX_VERSION_CODE >= 0x20412
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
 	.remove = __devexit_p(rtbt_pci_remove),
 #else
+	.remove = rtbt_pci_remove,
+#endif
+#else
 	.remove = __devexit(rtbt_pci_remove),
 #endif
 #ifdef CONFIG_PM
@@ -343,7 +373,11 @@
 	}
 	
 	if (hdev){
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
 		os_ctrl = (struct rtbt_os_ctrl *)hdev->driver_data;
+#else
+		os_ctrl = (struct rtbt_os_ctrl *)hci_get_drvdata(hdev);
+#endif
 		ASSERT(os_ctrl);
 		if (os_ctrl && os_ctrl->if_ops.pci_ops.isr) {
 			retval = (os_ctrl->if_ops.pci_ops.isr)(os_ctrl->dev_ctrl);
--- rtbth_hlpr_linux.c.orig	2012-07-06 11:08:02.000000000 +0200
+++ rtbth_hlpr_linux.c	2013-09-30 14:17:23.772193912 +0200
@@ -572,12 +572,16 @@
 	
 #ifndef KTHREAD_SUPPORT
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
 	daemonize((PSTRING)&pOSTask->taskName[0]);
 
 	allow_signal(SIGTERM);
 	allow_signal(SIGKILL);
 	current->flags |= PF_NOFREEZE;
 #else
+//kernel 3.8 code
+#endif
+#else
 	unsigned long flags;
 
 	daemonize();

EDIT:
OK I think daemonize was substituted by kthread_run, can someone explain me how to use it instead of daemonize?

Last edited by valantin (2013-09-30 17:09:19)

Offline

Board footer

Powered by FluxBB