* [pm-wip/uart][PATCH] Serial: Avoid using hwmod lookup using name string.
@ 2010-05-21 8:40 Govindraj.R
0 siblings, 0 replies; 3+ messages in thread
From: Govindraj.R @ 2010-05-21 8:40 UTC (permalink / raw)
To: linux-omap; +Cc: Kevin Hilman
Avoid using hwmod lookup using name string rather
retreive port info using the hwmod class interface.
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Govindraj.R <govindraj.raja@ti.com>
---
This patch is based on top the series posted earlier
http://marc.info/?l=linux-omap&m=127436267414492&w=2
arch/arm/mach-omap2/serial.c | 76 ++++++++++++++++++++----------------------
1 files changed, 36 insertions(+), 40 deletions(-)
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index da9fee6..8e3f929 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -55,8 +55,6 @@
*/
#define DEFAULT_TIMEOUT 0
-#define MAX_UART_HWMOD_NAME_LEN 16
-
struct omap_uart_state {
int num;
int can_sleep;
@@ -568,52 +566,50 @@ static void serial_out_override(struct uart_port *up, int offset, int value)
}
#endif
-void __init omap_serial_early_init(void)
+static int omap_serial_port_init(struct omap_hwmod *oh, void *user)
{
- int i = 0;
+ struct omap_uart_state *uart;
+ static int i;
- do {
- char oh_name[MAX_UART_HWMOD_NAME_LEN];
- struct omap_hwmod *oh;
- struct omap_uart_state *uart;
+ uart = kzalloc(sizeof(struct omap_uart_state), GFP_KERNEL);
+ if (WARN_ON(!uart))
+ return -ENOMEM;
- snprintf(oh_name, MAX_UART_HWMOD_NAME_LEN,
- "uart%d", i + 1);
- oh = omap_hwmod_lookup(oh_name);
- if (!oh)
- break;
+ uart->oh = oh;
+ uart->num = i++;
+ list_add_tail(&uart->node, &uart_list);
+ num_uarts++;
- uart = kzalloc(sizeof(struct omap_uart_state), GFP_KERNEL);
- if (WARN_ON(!uart))
- return;
+ /*
+ * NOTE: omap_hwmod_init() has not yet been called,
+ * so no hwmod functions will work yet.
+ */
- uart->oh = oh;
- uart->num = i++;
- list_add_tail(&uart->node, &uart_list);
- num_uarts++;
+ /*
+ * During UART early init, device need to be probed
+ * to determine SoC specific init before omap_device
+ * is ready. Therefore, don't allow idle here
+ */
- /*
- * NOTE: omap_hwmod_init() has not yet been called,
- * so no hwmod functions will work yet.
- */
+ uart->oh->flags |= HWMOD_INIT_NO_IDLE;
- /*
- * During UART early init, device need to be probed
- * to determine SoC specific init before omap_device
- * is ready. Therefore, don't allow idle here
- */
- uart->oh->flags |= HWMOD_INIT_NO_IDLE;
-
- /*
- * Since UART hwmod is idle/enabled inside the
- * idle loop, interrupts are already disabled and
- * thus no locking is needed. Since the mutex-based
- * locking in hwmod might sleep, allowing locking
- * may introduce problems.
- */
- uart->oh->flags |= HWMOD_NO_IDLE_LOCKING;
+ /*
+ * Since UART hwmod is idle/enabled inside the
+ * idle loop, interrupts are already disabled and
+ * thus no locking is needed. Since the mutex-based
+ * locking in hwmod might sleep, allowing locking
+ * may introduce problems.
+ */
+
+ uart->oh->flags |= HWMOD_NO_IDLE_LOCKING;
- } while (1);
+ return 0;
+}
+
+void __init omap_serial_early_init(void)
+{
+ omap_hwmod_for_each_by_class("uart",
+ omap_serial_port_init, NULL);
}
/**
--
1.6.3.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [pm-wip/uart][PATCH] Serial: Avoid using hwmod lookup using name string
[not found] <39979.192.168.10.88.1274431258.squirrel@dbdmail.itg.ti.com>
@ 2010-05-24 13:08 ` Govindraj.R
2010-05-25 16:23 ` Kevin Hilman
0 siblings, 1 reply; 3+ messages in thread
From: Govindraj.R @ 2010-05-24 13:08 UTC (permalink / raw)
To: linux-omap; +Cc: Kevin Hilman
[-- Attachment #1: Type: text/plain, Size: 3052 bytes --]
Rebased on latest pm/wip-uart branch.
--
Regards,
Govindraj.R
Avoid using hwmod lookup using name string rather
retreive port info using the hwmod class interface.
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Govindraj.R <govindraj.raja@ti.com>
---
arch/arm/mach-omap2/serial.c | 86 +++++++++++++++++++----------------------
1 files changed, 40 insertions(+), 46 deletions(-)
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index da9fee6..dc04139 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -55,8 +55,6 @@
*/
#define DEFAULT_TIMEOUT 0
-#define MAX_UART_HWMOD_NAME_LEN 16
-
struct omap_uart_state {
int num;
int can_sleep;
@@ -568,52 +566,48 @@ static void serial_out_override(struct uart_port *up, int offset, int value)
}
#endif
-void __init omap_serial_early_init(void)
+static int omap_serial_port_init(struct omap_hwmod *oh, void *user)
{
- int i = 0;
+ struct omap_uart_state *uart;
+ static int i;
- do {
- char oh_name[MAX_UART_HWMOD_NAME_LEN];
- struct omap_hwmod *oh;
- struct omap_uart_state *uart;
+ uart = kzalloc(sizeof(struct omap_uart_state), GFP_KERNEL);
+ if (WARN_ON(!uart))
+ return -ENOMEM;
- snprintf(oh_name, MAX_UART_HWMOD_NAME_LEN,
- "uart%d", i + 1);
- oh = omap_hwmod_lookup(oh_name);
- if (!oh)
- break;
+ uart->oh = oh;
+ uart->num = i++;
+ list_add_tail(&uart->node, &uart_list);
+ num_uarts++;
- uart = kzalloc(sizeof(struct omap_uart_state), GFP_KERNEL);
- if (WARN_ON(!uart))
- return;
+ /*
+ * NOTE: omap_hwmod_init() has not yet been called,
+ * so no hwmod functions will work yet.
+ */
- uart->oh = oh;
- uart->num = i++;
- list_add_tail(&uart->node, &uart_list);
- num_uarts++;
+ /*
+ * During UART early init, device need to be probed
+ * to determine SoC specific init before omap_device
+ * is ready. Therefore, don't allow idle here
+ */
+ uart->oh->flags |= HWMOD_INIT_NO_IDLE;
- /*
- * NOTE: omap_hwmod_init() has not yet been called,
- * so no hwmod functions will work yet.
- */
+ /*
+ * Since UART hwmod is idle/enabled inside the
+ * idle loop, interrupts are already disabled and
+ * thus no locking is needed. Since the mutex-based
+ * locking in hwmod might sleep, allowing locking
+ * may introduce problems.
+ */
+ uart->oh->flags |= HWMOD_NO_IDLE_LOCKING;
- /*
- * During UART early init, device need to be probed
- * to determine SoC specific init before omap_device
- * is ready. Therefore, don't allow idle here
- */
- uart->oh->flags |= HWMOD_INIT_NO_IDLE;
-
- /*
- * Since UART hwmod is idle/enabled inside the
- * idle loop, interrupts are already disabled and
- * thus no locking is needed. Since the mutex-based
- * locking in hwmod might sleep, allowing locking
- * may introduce problems.
- */
- uart->oh->flags |= HWMOD_NO_IDLE_LOCKING;
+ return 0;
+}
- } while (1);
+void __init omap_serial_early_init(void)
+{
+ omap_hwmod_for_each_by_class("uart",
+ omap_serial_port_init, NULL);
}
/**
--
1.6.3.3
[-- Attachment #2: 0001-Serial-Avoid-using-hwmod-lookup-using-name-string.zip --]
[-- Type: application/x-zip-compressed, Size: 1551 bytes --]
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [pm-wip/uart][PATCH] Serial: Avoid using hwmod lookup using name string
2010-05-24 13:08 ` [pm-wip/uart][PATCH] Serial: Avoid using hwmod lookup using name string Govindraj.R
@ 2010-05-25 16:23 ` Kevin Hilman
0 siblings, 0 replies; 3+ messages in thread
From: Kevin Hilman @ 2010-05-25 16:23 UTC (permalink / raw)
To: Govindraj.R; +Cc: linux-omap
"Govindraj.R" <govindraj.raja@ti.com> writes:
> Rebased on latest pm/wip-uart branch.
Still doesn't apply for me, either on pm-wip/uart or on top of your
series: [pm-wip/uart][PATCH 0/6]: Serial HWMOD updation and cleanup.
Please just include in your updates series which should include the
get_resource_byname() change as well as Sergio's UART fixes for 3630.
Thanks,
Kevin
> --
> Regards,
> Govindraj.R
>
>
> Avoid using hwmod lookup using name string rather
> retreive port info using the hwmod class interface.
>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> Signed-off-by: Govindraj.R <govindraj.raja@ti.com>
> ---
> arch/arm/mach-omap2/serial.c | 86 +++++++++++++++++++----------------------
> 1 files changed, 40 insertions(+), 46 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
> index da9fee6..dc04139 100644
> --- a/arch/arm/mach-omap2/serial.c
> +++ b/arch/arm/mach-omap2/serial.c
> @@ -55,8 +55,6 @@
> */
> #define DEFAULT_TIMEOUT 0
>
> -#define MAX_UART_HWMOD_NAME_LEN 16
> -
> struct omap_uart_state {
> int num;
> int can_sleep;
> @@ -568,52 +566,48 @@ static void serial_out_override(struct uart_port *up, int offset, int value)
> }
> #endif
>
> -void __init omap_serial_early_init(void)
> +static int omap_serial_port_init(struct omap_hwmod *oh, void *user)
> {
> - int i = 0;
> + struct omap_uart_state *uart;
> + static int i;
>
> - do {
> - char oh_name[MAX_UART_HWMOD_NAME_LEN];
> - struct omap_hwmod *oh;
> - struct omap_uart_state *uart;
> + uart = kzalloc(sizeof(struct omap_uart_state), GFP_KERNEL);
> + if (WARN_ON(!uart))
> + return -ENOMEM;
>
> - snprintf(oh_name, MAX_UART_HWMOD_NAME_LEN,
> - "uart%d", i + 1);
> - oh = omap_hwmod_lookup(oh_name);
> - if (!oh)
> - break;
> + uart->oh = oh;
> + uart->num = i++;
> + list_add_tail(&uart->node, &uart_list);
> + num_uarts++;
>
> - uart = kzalloc(sizeof(struct omap_uart_state), GFP_KERNEL);
> - if (WARN_ON(!uart))
> - return;
> + /*
> + * NOTE: omap_hwmod_init() has not yet been called,
> + * so no hwmod functions will work yet.
> + */
>
> - uart->oh = oh;
> - uart->num = i++;
> - list_add_tail(&uart->node, &uart_list);
> - num_uarts++;
> + /*
> + * During UART early init, device need to be probed
> + * to determine SoC specific init before omap_device
> + * is ready. Therefore, don't allow idle here
> + */
> + uart->oh->flags |= HWMOD_INIT_NO_IDLE;
>
> - /*
> - * NOTE: omap_hwmod_init() has not yet been called,
> - * so no hwmod functions will work yet.
> - */
> + /*
> + * Since UART hwmod is idle/enabled inside the
> + * idle loop, interrupts are already disabled and
> + * thus no locking is needed. Since the mutex-based
> + * locking in hwmod might sleep, allowing locking
> + * may introduce problems.
> + */
> + uart->oh->flags |= HWMOD_NO_IDLE_LOCKING;
>
> - /*
> - * During UART early init, device need to be probed
> - * to determine SoC specific init before omap_device
> - * is ready. Therefore, don't allow idle here
> - */
> - uart->oh->flags |= HWMOD_INIT_NO_IDLE;
> -
> - /*
> - * Since UART hwmod is idle/enabled inside the
> - * idle loop, interrupts are already disabled and
> - * thus no locking is needed. Since the mutex-based
> - * locking in hwmod might sleep, allowing locking
> - * may introduce problems.
> - */
> - uart->oh->flags |= HWMOD_NO_IDLE_LOCKING;
> + return 0;
> +}
>
> - } while (1);
> +void __init omap_serial_early_init(void)
> +{
> + omap_hwmod_for_each_by_class("uart",
> + omap_serial_port_init, NULL);
> }
>
> /**
> --
> 1.6.3.3
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-25 16:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <39979.192.168.10.88.1274431258.squirrel@dbdmail.itg.ti.com>
2010-05-24 13:08 ` [pm-wip/uart][PATCH] Serial: Avoid using hwmod lookup using name string Govindraj.R
2010-05-25 16:23 ` Kevin Hilman
2010-05-21 8:40 Govindraj.R
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.