[U-Boot] [PATCH] Fix checkpatch warnings about externs in *.c
Marek Vasut
marex at denx.de
Sun Sep 16 14:37:16 CEST 2012
Dear Pavel Herrmann,
> Move all extern declarations of sata_dev_desc into a single header file.
>
> Signed-off-by: Pavel Herrmann <morpheus.ibis at gmail.com>
> ---
> drivers/block/ata_piix.c | 4 +---
> drivers/block/dwc_ahsata.c | 1 +
> drivers/block/dwc_ahsata.h | 2 --
> drivers/block/fsl_sata.c | 3 +--
> drivers/block/pata_bfin.c | 1 +
> drivers/block/pata_bfin.h | 2 --
> drivers/block/sata_dwc.c | 3 +--
> drivers/block/sata_extern.h | 30 ++++++++++++++++++++++++++++++
> drivers/block/sata_sil.c | 1 +
> drivers/block/sata_sil.h | 2 --
> drivers/block/sata_sil3114.c | 2 +-
> 11 files changed, 37 insertions(+), 14 deletions(-)
> create mode 100644 drivers/block/sata_extern.h
Won't include/sata.h work just fine ?
> diff --git a/drivers/block/ata_piix.c b/drivers/block/ata_piix.c
> index c81d11a..de8d563 100644
> --- a/drivers/block/ata_piix.c
> +++ b/drivers/block/ata_piix.c
> @@ -34,9 +34,7 @@
> #include <part.h>
> #include <ide.h>
> #include <ata.h>
> -
> -extern block_dev_desc_t sata_dev_desc[CONFIG_SYS_SATA_MAX_DEVICE];
> -extern int sata_curr_device;
> +#include "sata_extern.h"
>
> #define DEBUG_SATA 0 /*For debug prints set DEBUG_SATA to 1 */
>
> diff --git a/drivers/block/dwc_ahsata.c b/drivers/block/dwc_ahsata.c
> index 2703d3d..4b32466 100644
> --- a/drivers/block/dwc_ahsata.c
> +++ b/drivers/block/dwc_ahsata.c
> @@ -33,6 +33,7 @@
> #include <linux/bitops.h>
> #include <asm/arch/clock.h>
> #include "dwc_ahsata.h"
> +#include "sata_extern.h"
>
> struct sata_port_regs {
> u32 clb;
> diff --git a/drivers/block/dwc_ahsata.h b/drivers/block/dwc_ahsata.h
> index 84860ea..4dac5dc 100644
> --- a/drivers/block/dwc_ahsata.h
> +++ b/drivers/block/dwc_ahsata.h
> @@ -330,6 +330,4 @@
> #define READ_CMD 0
> #define WRITE_CMD 1
>
> -extern block_dev_desc_t sata_dev_desc[CONFIG_SYS_SATA_MAX_DEVICE];
> -
> #endif /* __FSL_SATA_H__ */
> diff --git a/drivers/block/fsl_sata.c b/drivers/block/fsl_sata.c
> index 3026ade..9691f2e 100644
> --- a/drivers/block/fsl_sata.c
> +++ b/drivers/block/fsl_sata.c
> @@ -27,8 +27,7 @@
> #include <libata.h>
> #include <fis.h>
> #include "fsl_sata.h"
> -
> -extern block_dev_desc_t sata_dev_desc[CONFIG_SYS_SATA_MAX_DEVICE];
> +#include "sata_extern.h"
>
> #ifndef CONFIG_SYS_SATA1_FLAGS
> #define CONFIG_SYS_SATA1_FLAGS FLAGS_DMA
> diff --git a/drivers/block/pata_bfin.c b/drivers/block/pata_bfin.c
> index cce21fb..6aacde0 100644
> --- a/drivers/block/pata_bfin.c
> +++ b/drivers/block/pata_bfin.c
> @@ -19,6 +19,7 @@
> #include <ata.h>
> #include <libata.h>
> #include "pata_bfin.h"
> +#include "sata_extern.h"
>
> static struct ata_port port[CONFIG_SYS_SATA_MAX_DEVICE];
>
> diff --git a/drivers/block/pata_bfin.h b/drivers/block/pata_bfin.h
> index 2b3425b..2093cf0 100644
> --- a/drivers/block/pata_bfin.h
> +++ b/drivers/block/pata_bfin.h
> @@ -41,8 +41,6 @@ struct ata_port {
> unsigned char dev_mask;
> };
>
> -extern block_dev_desc_t sata_dev_desc[CONFIG_SYS_SATA_MAX_DEVICE];
> -
> #define DRV_NAME "pata-bfin"
> #define DRV_VERSION "0.9"
> #define __iomem
> diff --git a/drivers/block/sata_dwc.c b/drivers/block/sata_dwc.c
> index 75101b5..cc41316 100644
> --- a/drivers/block/sata_dwc.c
> +++ b/drivers/block/sata_dwc.c
> @@ -38,6 +38,7 @@
> #include <linux/ctype.h>
>
> #include "sata_dwc.h"
> +#include "sata_extern.h"
>
> #define DMA_NUM_CHANS 1
> #define DMA_NUM_CHAN_REGS 8
> @@ -268,8 +269,6 @@ static int ata_dev_read_id(struct ata_device *dev,
> unsigned int *p_class, unsigned int flags, u16 *id);
> static int check_sata_dev_state(void);
>
> -extern block_dev_desc_t sata_dev_desc[CONFIG_SYS_SATA_MAX_DEVICE];
> -
> static const struct ata_port_info sata_dwc_port_info[] = {
> {
> .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
> diff --git a/drivers/block/sata_extern.h b/drivers/block/sata_extern.h
> new file mode 100644
> index 0000000..3bf9df9
> --- /dev/null
> +++ b/drivers/block/sata_extern.h
> @@ -0,0 +1,30 @@
> +/*
> + * (C) Copyright 2012
> + * Pavel Herrmann <morpheus.ibis at gmail.com>
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +
> +#ifndef _BLOCK_SATA_EXTERN_H_
> +#define _BLOCK_SATA_EXTERN_H_
> +
> +extern block_dev_desc_t sata_dev_desc[CONFIG_SYS_SATA_MAX_DEVICE];
> +extern int sata_curr_device;
> +
> +#endif
> diff --git a/drivers/block/sata_sil.c b/drivers/block/sata_sil.c
> index fb7cd2a..ee9194c 100644
> --- a/drivers/block/sata_sil.c
> +++ b/drivers/block/sata_sil.c
> @@ -27,6 +27,7 @@
> #include <fis.h>
> #include <libata.h>
> #include "sata_sil.h"
> +#include "sata_extern.h"
>
> /* Convert sectorsize to wordsize */
> #define ATA_SECTOR_WORDS (ATA_SECT_SIZE/2)
> diff --git a/drivers/block/sata_sil.h b/drivers/block/sata_sil.h
> index 2dfd4a5..9f3a37f 100644
> --- a/drivers/block/sata_sil.h
> +++ b/drivers/block/sata_sil.h
> @@ -24,8 +24,6 @@
> #define READ_CMD 0
> #define WRITE_CMD 1
>
> -extern block_dev_desc_t sata_dev_desc[CONFIG_SYS_SATA_MAX_DEVICE];
> -
> /*
> * SATA device driver struct for each dev
> */
> diff --git a/drivers/block/sata_sil3114.c b/drivers/block/sata_sil3114.c
> index 34fe038..da55385 100644
> --- a/drivers/block/sata_sil3114.c
> +++ b/drivers/block/sata_sil3114.c
> @@ -30,6 +30,7 @@
> #include <ide.h>
> #include <libata.h>
> #include "sata_sil3114.h"
> +#include "sata_extern.h"
>
> /* Convert sectorsize to wordsize */
> #define ATA_SECTOR_WORDS (ATA_SECT_SIZE/2)
> @@ -48,7 +49,6 @@ static u8 sata_chk_status (struct sata_ioports *ioaddr,
> u8 usealtstatus); static void msleep (int count);
>
> static u32 iobase[6] = { 0, 0, 0, 0, 0, 0}; /* PCI BAR registers for
> device */ -extern block_dev_desc_t
> sata_dev_desc[CONFIG_SYS_SATA_MAX_DEVICE];
>
> static struct sata_port port[CONFIG_SYS_SATA_MAX_DEVICE];
More information about the U-Boot
mailing list