Skip to contentSkip to conversation

rsi: OS dependent functions

PATCH In review Jahnavi 2 participants 3 messages Jan 30, 2014 – Jan 31, 2014 Redpine wireless driver

lore
Share & tools
lore

Jahnavi

author
#0 lore raw

PATCH 2/9 rsi: OS dependent functions

From: Jahnavi Meher <[email protected]>

This file contains all the os related functions, like thread operations and file operations.

---

common/Makefile           |    9 
common/rsi_osd_ops.c      |  629 ++++++++++++++++++++++++++++++++++++++++++++++
include/rsi_boot_params.h |  183 +++++++++++++
include/rsi_common.h      |  302 ++++++++++++++++++++++
4 files changed, 1123 insertions(+)
drivers/net/wireless/rsi/common/Makefile +9 -0
diff -uprN a/drivers/net/wireless/rsi/common/Makefile b/drivers/net/wireless/rsi/common/Makefile
@@ -0,0 +1,9 @@
+rsi_common-y := rsi_core.o rsi_osd_ops.o
+ifeq ($(CONFIG_RSI_USB), y)
+	rsi_common-y += rsi_usb.o
+	ccflags-y =-DUSE_USB_INTF
+else
+	rsi_common-y += rsi_sdio.o
+	ccflags-y =-DUSE_SDIO_INTF
+endif
+obj-$(CONFIG_RSI_91x) := rsi_common.o
drivers/net/wireless/rsi/common/rsi_osd_ops.c +629 -0

629 lines not on this page · raw message

drivers/net/wireless/rsi/include/rsi_boot_params.h +183 -0

183 lines not on this page · raw message

drivers/net/wireless/rsi/include/rsi_common.h +302 -0

302 lines not on this page · raw message

#1 lore raw

drivers/net/wireless/rsi/common/Makefile line 8

Quoted 8 lines · Jahnavi
drivers/net/wireless/rsi/common/Makefile +8 -0
+rsi_common-y := rsi_core.o rsi_osd_ops.o
+ifeq ($(CONFIG_RSI_USB), y)
+	rsi_common-y += rsi_usb.o
+	ccflags-y =-DUSE_USB_INTF
+else
+	rsi_common-y += rsi_sdio.o
+	ccflags-y =-DUSE_SDIO_INTF
+endif

That can't be right - in the Kconfig you declared that it's valid to select both SDIO and USB at the same time. You can also use the syntax you used below:

Quoted 1 line

+obj-$(CONFIG_RSI_91x) := rsi_common.o

for ccflags to clean this up. But you should get rid of the -DUSE_XYZ_INTF anyway and use CONFIG_RSI_USB in the code.

Quoted 1 line

+static int rsi_proc_version_read(struct seq_file *seq, void *data)

/proc? really? definitely staging material from here on ...

Quoted 12 lines
drivers/net/wireless/rsi/common/rsi_osd_ops.c +12 -0
+/**
+ * This function is used to put the current execution in a queue
+ * and reschedules itself for execution on "timeout" or when a
+ * wakeup is generated.
+ *
+ * @param  event Pointer to the event structure.
+ * @param  timeout Timeout value in msecs.
+ * @return status: 0 on success, -1 on failure.
+ */
+int rsi_wait_event(struct rsi_event *event, unsigned int timeout)
+{
+	int status = 0;

drivers/net/wireless/rsi/common/rsi_osd_ops.c line 459

Quoted 10 lines
drivers/net/wireless/rsi/common/rsi_osd_ops.c +10 -0
+
+	if (!timeout)
+		status = wait_event_interruptible(event->event_queue,
+				(atomic_read(&event->event_condition) == 0));
+	else
+		status = wait_event_interruptible_timeout(event->event_queue,
+				(atomic_read(&event->event_condition) == 0),
+				timeout);
+	return status;
+}

That's probably better inlined.

Along with the rest of the event and thread functionality - doesn't really help readability to obscure things behind layers of "OS abstractions"...

Quoted 7 lines
drivers/net/wireless/rsi/common/rsi_osd_ops.c +7 -0
+void rsi_print(int zone, unsigned char *vdata, int len)
+{
+	unsigned short ii;
+
+	if (!(zone & rsi_zone_enabled))
+		return;
+

drivers/net/wireless/rsi/common/rsi_osd_ops.c line 509

Quoted 10 lines
drivers/net/wireless/rsi/common/rsi_osd_ops.c +10 -0
+	if (!vdata)
+		return;
+
+	for (ii = 0; ii < len; ii++) {
+		if (!(ii % 16))
+			pr_info("\n");
+		pr_info("%02x ", (vdata[ii]));
+	}
+	pr_info("\n");
+}

Yeah, umm, see above.

drivers/net/wireless/rsi/include/rsi_boot_params.h line 145

Quoted 1 line
drivers/net/wireless/rsi/include/rsi_boot_params.h +1 -0
+	unsigned int bbp_lmac_clk_reg_val:16;

16 bit bitfields? Is there anything wrong with u16 (aka unsigned short) on your compiler version?

johannes

#2 lore raw

Will change to build both SDIO and USB modules
simultaneously, as suggested by Dan.

Regards,
Jahnavi

Quoted 76 lines · Jahnavi

drivers/net/wireless/rsi/common/Makefile line 8

Quoted 9 lines
drivers/net/wireless/rsi/common/Makefile +8 -0
+rsi_common-y := rsi_core.o rsi_osd_ops.o
+ifeq ($(CONFIG_RSI_USB), y)
+	rsi_common-y += rsi_usb.o
+	ccflags-y =-DUSE_USB_INTF
+else
+	rsi_common-y += rsi_sdio.o
+	ccflags-y =-DUSE_SDIO_INTF
+endif

That can't be right - in the Kconfig you declared that it's valid to select both SDIO and USB at the same time. You can also use the syntax you used below:

Quoted 1 line

+obj-$(CONFIG_RSI_91x) := rsi_common.o

for ccflags to clean this up. But you should get rid of the -DUSE_XYZ_INTF anyway and use CONFIG_RSI_USB in the code.

Quoted 1 line

+static int rsi_proc_version_read(struct seq_file *seq, void *data)

/proc? really? definitely staging material from here on ...

Quoted 12 lines
drivers/net/wireless/rsi/common/rsi_osd_ops.c +12 -0
+/**
+ * This function is used to put the current execution in a queue
+ * and reschedules itself for execution on "timeout" or when a
+ * wakeup is generated.
+ *
+ * @param  event Pointer to the event structure.
+ * @param  timeout Timeout value in msecs.
+ * @return status: 0 on success, -1 on failure.
+ */
+int rsi_wait_event(struct rsi_event *event, unsigned int timeout)
+{
+	int status = 0;

drivers/net/wireless/rsi/common/rsi_osd_ops.c line 459

Quoted 10 lines
drivers/net/wireless/rsi/common/rsi_osd_ops.c +10 -0
+
+	if (!timeout)
+		status = wait_event_interruptible(event->event_queue,
+				(atomic_read(&event->event_condition) == 0));
+	else
+		status = wait_event_interruptible_timeout(event->event_queue,
+				(atomic_read(&event->event_condition) == 0),
+				timeout);
+	return status;
+}

That's probably better inlined.

Along with the rest of the event and thread functionality - doesn't really help readability to obscure things behind layers of "OS abstractions"...

Quoted 7 lines
drivers/net/wireless/rsi/common/rsi_osd_ops.c +7 -0
+void rsi_print(int zone, unsigned char *vdata, int len)
+{
+	unsigned short ii;
+
+	if (!(zone & rsi_zone_enabled))
+		return;
+

drivers/net/wireless/rsi/common/rsi_osd_ops.c line 509

Quoted 10 lines
drivers/net/wireless/rsi/common/rsi_osd_ops.c +10 -0
+	if (!vdata)
+		return;
+
+	for (ii = 0; ii < len; ii++) {
+		if (!(ii % 16))
+			pr_info("\n");
+		pr_info("%02x ", (vdata[ii]));
+	}
+	pr_info("\n");
+}

Yeah, umm, see above.

drivers/net/wireless/rsi/include/rsi_boot_params.h line 145

Quoted 1 line
drivers/net/wireless/rsi/include/rsi_boot_params.h +1 -0
+	unsigned int bbp_lmac_clk_reg_val:16;

16 bit bitfields? Is there anything wrong with u16 (aka unsigned short) on your compiler version?

johannes