[Patch] Removing legacy method from arm csb337
Vipul Nayyar
nayyar_vipul at yahoo.com
Sat Jul 6 17:06:00 UTC 2013
Hello,
Thanks for the advice. In fact I removed most of the warnings with the help of Google only in my earlier patch.
I've checked and removed functions at91rm9200_emac_isr_off() & at91rm9200_emac_isr_is_on() since they're defined but not used.
I've made phywrite() & phyread() static since they're not used anywhere else.
But still I'm getting a warning saying : 'phyread' defined but not used [-Wunused-function] . Although it is used a couple of times in the file, but still I'm getting this warning. Maybe it has something to do with being a static function. Please try this patch.
commit 43c2a6852c1474f7e5877f590181a47d277c914a
Author: Vipul Nayyar <nayyar_vipul at yahoo.com>
Date: Sat Jul 6 22:26:06 2013 +0530
Updated Legacy code in arm csb337
diff --git a/c/src/lib/libbsp/arm/csb337/network/network.c b/c/src/lib/libbsp/arm/csb337/network/network.c
index e31bcc0..2a39db2 100644
--- a/c/src/lib/libbsp/arm/csb337/network/network.c
+++ b/c/src/lib/libbsp/arm/csb337/network/network.c
@@ -22,6 +22,7 @@
#include <errno.h>
#include <rtems/error.h>
+#include <assert.h>
#include <sys/param.h>
#include <sys/mbuf.h>
@@ -83,20 +84,7 @@
#define START_TRANSMIT_EVENT RTEMS_EVENT_2
static void at91rm9200_emac_isr (rtems_irq_hdl_param unused);
-static void at91rm9200_emac_isr_on(const rtems_irq_connect_data *unused);
-static void at91rm9200_emac_isr_off(const rtems_irq_connect_data *unused);
-static int at91rm9200_emac_isr_is_on(const rtems_irq_connect_data *irq);
-
-/* Replace the first value with the clock's interrupt name. */
-rtems_irq_connect_data at91rm9200_emac_isr_data = {
- AT91RM9200_INT_EMAC,
- at91rm9200_emac_isr,
- NULL,
- at91rm9200_emac_isr_on,
- at91rm9200_emac_isr_off,
- at91rm9200_emac_isr_is_on
-};
-
+static void at91rm9200_emac_isr_on(void);
/* use the values defined in linkcmds for our use of SRAM */
extern void * at91rm9200_emac_rxbuf_hdrs;
@@ -208,12 +196,13 @@ void at91rm9200_emac_stats (at91rm9200_emac_softc_t *sc);
static int at91rm9200_emac_ioctl (struct ifnet *ifp,
ioctl_command_t command,
caddr_t data);
-
+static void phywrite(uint8_t reg, uint16_t data);
+static uint32_t phyread(uint8_t reg);
/*
* phyread(): Read the PHY
*/
-uint32_t phyread(uint8_t reg)
+static uint32_t phyread(uint8_t reg)
{
EMAC_REG(EMAC_MAN) = (0x01 << 30 /* Start of Frame Delimiter */
| 0x02 << 28 /* Operation, 0x01 = Write, 0x02 = Read */
@@ -238,7 +227,7 @@ uint32_t phyread(uint8_t reg)
/*
* phywrite(): Write the PHY
*/
-void phywrite(uint8_t reg, uint16_t data)
+static void phywrite(uint8_t reg, uint16_t data)
{
EMAC_REG(EMAC_MAN) = (0x01 << 30 /* Start of Frame Delimiter */
| 0x01 << 28 /* Operation, 0x01 = Write, 0x02 = Read */
@@ -358,6 +347,7 @@ void at91rm9200_emac_init(void *arg)
{
at91rm9200_emac_softc_t *sc = arg;
struct ifnet *ifp = &sc->arpcom.ac_if;
+ rtems_status_code status = RTEMS_SUCCESSFUL;
/*
*This is for stuff that only gets done once (at91rm9200_emac_init()
@@ -382,7 +372,15 @@ void at91rm9200_emac_init(void *arg)
AIC_SMR_REG(AIC_SMR_EMAC) = AIC_SMR_PRIOR(EMAC_INT_PRIORITY);
/* install the interrupt handler */
- BSP_install_rtems_irq_handler(&at91rm9200_emac_isr_data);
+ status = rtems_interrupt_handler_install(
+ AT91RM9200_INT_EMAC,
+ "Network",
+ RTEMS_INTERRUPT_UNIQUE,
+ at91rm9200_emac_isr,
+ NULL
+ );
+ assert(status == RTEMS_SUCCESSFUL);
+ at91rm9200_emac_isr_on();
/* EMAC doesn't support promiscuous, so ignore requests */
if (ifp->if_flags & IFF_PROMISC) {
@@ -767,7 +765,7 @@ void at91rm9200_emac_stats (at91rm9200_emac_softc_t *sc)
/* Enables at91rm9200_emac interrupts. */
-static void at91rm9200_emac_isr_on(const rtems_irq_connect_data *unused)
+static void at91rm9200_emac_isr_on()
{
/* Enable various TX/RX interrupts */
EMAC_REG(EMAC_IER) = (EMAC_INT_RCOM | /* Receive complete */
@@ -779,23 +777,6 @@ static void at91rm9200_emac_isr_on(const rtems_irq_connect_data *unused)
return;
}
-/* Disables at91rm9200_emac interrupts */
-static void at91rm9200_emac_isr_off(const rtems_irq_connect_data *unused)
-{
- /* disable all various TX/RX interrupts */
- EMAC_REG(EMAC_IDR) = 0xffffffff;
- return;
-}
-
-/* Tests to see if at91rm9200_emac interrupts are enabled, and
- * returns non-0 if so.
- * If interrupt is not enabled, returns 0.
- */
-static int at91rm9200_emac_isr_is_on(const rtems_irq_connect_data *irq)
-{
- return EMAC_REG(EMAC_IMR); /* any interrupts enabled? */
-}
-
/* Driver ioctl handler */
static int
at91rm9200_emac_ioctl (struct ifnet *ifp, ioctl_command_t command, caddr_t data)
Regards
Vipul Nayyar
________________________________
From: Sebastian Huber <sebastian.huber at embedded-brains.de>
To: Vipul Nayyar <nayyar_vipul at yahoo.com>
Cc: "rtems-devel at rtems.org" <rtems-devel at rtems.org>
Sent: Saturday, 6 July 2013 2:03 AM
Subject: Re: [Patch] Removing legacy method from arm csb337
Hello,
if you encounter a warning and you don't know how to get rid of it, then
don't ignore it. You can for example ask on the mailing list how to
deal with it. Before this ask a search engine.
On 05/07/13 18:58, Sebastian Huber wrote:
> gmake[6]: Entering directory
> `/home/sh/git-build/b-csb337/arm-rtems4.11/c/csb337/lib/libbsp/arm/csb337'
> arm-rtems4.11-gcc --pipe -B../../../../../.././lib/
> -B../../../../../.././csb337/lib/ -specs bsp_specs -qrtems
> -DHAVE_CONFIG_H -isystem ../../../../../.././csb337/lib/include
> -D__INSIDE_RTEMS_BSD_TCPIP_STACK__ -mstructure-size-boundary=8
> -mcpu=arm920 -mfpu=vfp -mfloat-abi=soft -O2 -g -Wall
> -Wmissing-prototypes -Wimplicit-function-declaration
> -Wstrict-prototypes -Wnested-externs -MT network_rel-network.o -MD -MP
> -MF .deps/network_rel-network.Tpo -c -o network_rel-network.o `test -f
> 'network/network.c' || echo
> '/home/sh/rtems-4.11/c/src/lib/libbsp/arm/csb337/'`network/network.c
> /home/sh/rtems-4.11/c/src/lib/libbsp/arm/csb337/network/network.c:87:1: warning:
> function declaration isn't a prototype [-Wstrict-prototypes]
> static void at91rm9200_emac_isr_on();
> ^
This is the first hit with Google:
http://stackoverflow.com/questions/42125/function-declaration-isnt-a-prototype
[...]
> ^
> /home/sh/rtems-4.11/c/src/lib/libbsp/arm/csb337/network/network.c:207:10:
> warning: no previous prototype for 'phyread' [-Wmissing-prototypes]
> uint32_t phyread(uint8_t reg)
> ^
> /home/sh/rtems-4.11/c/src/lib/libbsp/arm/csb337/network/network.c:232:6:
> warning: no previous prototype for 'phywrite' [-Wmissing-prototypes]
> void phywrite(uint8_t reg, uint16_t data)
Here we have global functions without a prototype in a header file. This
is very bad. In case you see this, then search if this function is used
in other places. If yes, then ask on the mailing list. If no, then make
it static.
[...]
> /home/sh/rtems-4.11/c/src/lib/libbsp/arm/csb337/network/network.c:784:13:
> warning: 'at91rm9200_emac_isr_off' defined but not used
> [-Wunused-function]
> static void at91rm9200_emac_isr_off()
> ^
> /home/sh/rtems-4.11/c/src/lib/libbsp/arm/csb337/network/network.c:795:12:
> warning: 'at91rm9200_emac_isr_is_on' defined but not used
> [-Wunused-function]
> static int at91rm9200_emac_isr_is_on()
In case you get this warning, then you have to determine if it is really
unused. If yes, then delete this function (and its prototype). If no,
then use it.
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber at embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20130707/e381295f/attachment-0001.html>
More information about the devel
mailing list