[PATCH 3/3] staging: use inlines where it makes sense

From: Pavel Machek
Date: Sun Aug 10 2014 - 03:33:49 EST



Make some uart function static inline to reduce ammount of exported code.

Signed-off-by: Pavel Machek <pavel@xxxxxx>

diff --git a/drivers/staging/nokia_h4p/hci_h4p.h b/drivers/staging/nokia_h4p/hci_h4p.h
index b91e8b3..6c72ca5 100644
--- a/drivers/staging/nokia_h4p/hci_h4p.h
+++ b/drivers/staging/nokia_h4p/hci_h4p.h
@@ -26,6 +26,8 @@
#include <net/bluetooth/hci_core.h>
#include <net/bluetooth/hci.h>

+#include <linux/serial_reg.h>
+
#define UART_SYSC_OMAP_RESET 0x03
#define UART_SYSS_RESETDONE 0x01
#define UART_OMAP_SCR_EMPTY_THR 0x08
@@ -205,9 +207,28 @@ int hci_h4p_read_fw(struct hci_h4p_info *info, struct sk_buff_head *fw_queue);
int hci_h4p_send_fw(struct hci_h4p_info *info, struct sk_buff_head *fw_queue);
void hci_h4p_parse_fw_event(struct hci_h4p_info *info, struct sk_buff *skb);

-void hci_h4p_outb(struct hci_h4p_info *info, unsigned int offset, u8 val);
-u8 hci_h4p_inb(struct hci_h4p_info *info, unsigned int offset);
-void hci_h4p_set_rts(struct hci_h4p_info *info, int active);
+static inline void hci_h4p_outb(struct hci_h4p_info *info, unsigned int offset, u8 val)
+{
+ __raw_writeb(val, info->uart_base + (offset << 2));
+}
+
+static inline u8 hci_h4p_inb(struct hci_h4p_info *info, unsigned int offset)
+{
+ return __raw_readb(info->uart_base + (offset << 2));
+}
+
+static inline void hci_h4p_set_rts(struct hci_h4p_info *info, int active)
+{
+ u8 b;
+
+ b = hci_h4p_inb(info, UART_MCR);
+ if (active)
+ b |= UART_MCR_RTS;
+ else
+ b &= ~UART_MCR_RTS;
+ hci_h4p_outb(info, UART_MCR, b);
+}
+
int hci_h4p_wait_for_cts(struct hci_h4p_info *info, int active, int timeout_ms);
void __hci_h4p_set_auto_ctsrts(struct hci_h4p_info *info, int on, u8 which);
void hci_h4p_set_auto_ctsrts(struct hci_h4p_info *info, int on, u8 which);
diff --git a/drivers/staging/nokia_h4p/nokia_uart.c b/drivers/staging/nokia_h4p/nokia_uart.c
index 0fb57de..9aab7bb 100644
--- a/drivers/staging/nokia_h4p/nokia_uart.c
+++ b/drivers/staging/nokia_h4p/nokia_uart.c
@@ -19,7 +19,6 @@
*
*/

-#include <linux/serial_reg.h>
#include <linux/delay.h>
#include <linux/clk.h>

@@ -27,27 +26,7 @@

#include "hci_h4p.h"

-inline void hci_h4p_outb(struct hci_h4p_info *info, unsigned int offset, u8 val)
-{
- __raw_writeb(val, info->uart_base + (offset << 2));
-}
-
-inline u8 hci_h4p_inb(struct hci_h4p_info *info, unsigned int offset)
-{
- return __raw_readb(info->uart_base + (offset << 2));
-}

-void hci_h4p_set_rts(struct hci_h4p_info *info, int active)
-{
- u8 b;
-
- b = hci_h4p_inb(info, UART_MCR);
- if (active)
- b |= UART_MCR_RTS;
- else
- b &= ~UART_MCR_RTS;
- hci_h4p_outb(info, UART_MCR, b);
-}

int hci_h4p_wait_for_cts(struct hci_h4p_info *info, int active,
int timeout_ms)

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/