* [patch] parisc: delete some unused functions from firmware.c
@ 2016-07-14 10:47 Dan Carpenter
2016-07-14 21:16 ` Helge Deller
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-07-14 10:47 UTC (permalink / raw)
To: James E.J. Bottomley; +Cc: Helge Deller, linux-parisc, kernel-janitors
The pdc_pat_io_pci_cfg_read() is problematic because it's missing some
break statements so it copies 4 bytes regardless of whether you asked
for only 1 or 2. But since neither this nor the write function are
used, it means we can just delete the code.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/arch/parisc/include/asm/pdcpat.h b/arch/parisc/include/asm/pdcpat.h
index 47539f1..c89d8c0 100644
--- a/arch/parisc/include/asm/pdcpat.h
+++ b/arch/parisc/include/asm/pdcpat.h
@@ -293,11 +293,6 @@ extern int pdc_pat_cpu_get_number(struct pdc_pat_cpu_num *cpu_info, void *hpa);
extern int pdc_pat_pd_get_addr_map(unsigned long *actual_len, void *mem_addr, unsigned long count, unsigned long offset);
-
-extern int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *val);
-extern int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val);
-
-
/* Flag to indicate this is a PAT box...don't use this unless you
** really have to...it might go away some day.
*/
diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c
index 2239590..12545a2 100644
--- a/arch/parisc/kernel/firmware.c
+++ b/arch/parisc/kernel/firmware.c
@@ -1338,51 +1338,6 @@ int pdc_pat_pd_get_addr_map(unsigned long *actual_len, void *mem_addr,
return retval;
}
-/**
- * pdc_pat_io_pci_cfg_read - Read PCI configuration space.
- * @pci_addr: PCI configuration space address for which the read request is being made.
- * @pci_size: Size of read in bytes. Valid values are 1, 2, and 4.
- * @mem_addr: Pointer to return memory buffer.
- *
- */
-int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *mem_addr)
-{
- int retval;
- unsigned long flags;
-
- spin_lock_irqsave(&pdc_lock, flags);
- retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_PCI_CONFIG_READ,
- __pa(pdc_result), pci_addr, pci_size);
- switch(pci_size) {
- case 1: *(u8 *) mem_addr = (u8) pdc_result[0];
- case 2: *(u16 *)mem_addr = (u16) pdc_result[0];
- case 4: *(u32 *)mem_addr = (u32) pdc_result[0];
- }
- spin_unlock_irqrestore(&pdc_lock, flags);
-
- return retval;
-}
-
-/**
- * pdc_pat_io_pci_cfg_write - Retrieve information about memory address ranges.
- * @pci_addr: PCI configuration space address for which the write request is being made.
- * @pci_size: Size of write in bytes. Valid values are 1, 2, and 4.
- * @value: Pointer to 1, 2, or 4 byte value in low order end of argument to be
- * written to PCI Config space.
- *
- */
-int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val)
-{
- int retval;
- unsigned long flags;
-
- spin_lock_irqsave(&pdc_lock, flags);
- retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_PCI_CONFIG_WRITE,
- pci_addr, pci_size, val);
- spin_unlock_irqrestore(&pdc_lock, flags);
-
- return retval;
-}
#endif /* CONFIG_64BIT */
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] parisc: delete some unused functions from firmware.c
2016-07-14 10:47 [patch] parisc: delete some unused functions from firmware.c Dan Carpenter
@ 2016-07-14 21:16 ` Helge Deller
0 siblings, 0 replies; 2+ messages in thread
From: Helge Deller @ 2016-07-14 21:16 UTC (permalink / raw)
To: Dan Carpenter, James E.J. Bottomley
Cc: linux-parisc@vger.kernel.org, kernel-janitors@vger.kernel.org
Hi Dan,
thanks for noticing that!
On 14.07.2016 12:47, Dan Carpenter wrote:
> The pdc_pat_io_pci_cfg_read() is problematic because it's missing some
> break statements so it copies 4 bytes regardless of whether you asked
> for only 1 or 2. But since neither this nor the write function are
> used, it means we can just delete the code.
I would actually prefer if the code is fixed (e.g. with breaks)
and kept in the tree. We don't know yet if we will need it (and if we do
one would at least see that this PDC function actually exists).
Do you think you can send a fix-up patch instead?
Thanks,
Helge
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/arch/parisc/include/asm/pdcpat.h b/arch/parisc/include/asm/pdcpat.h
> index 47539f1..c89d8c0 100644
> --- a/arch/parisc/include/asm/pdcpat.h
> +++ b/arch/parisc/include/asm/pdcpat.h
> @@ -293,11 +293,6 @@ extern int pdc_pat_cpu_get_number(struct pdc_pat_cpu_num *cpu_info, void *hpa);
>
> extern int pdc_pat_pd_get_addr_map(unsigned long *actual_len, void *mem_addr, unsigned long count, unsigned long offset);
>
> -
> -extern int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *val);
> -extern int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val);
> -
> -
> /* Flag to indicate this is a PAT box...don't use this unless you
> ** really have to...it might go away some day.
> */
> diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c
> index 2239590..12545a2 100644
> --- a/arch/parisc/kernel/firmware.c
> +++ b/arch/parisc/kernel/firmware.c
> @@ -1338,51 +1338,6 @@ int pdc_pat_pd_get_addr_map(unsigned long *actual_len, void *mem_addr,
> return retval;
> }
>
> -/**
> - * pdc_pat_io_pci_cfg_read - Read PCI configuration space.
> - * @pci_addr: PCI configuration space address for which the read request is being made.
> - * @pci_size: Size of read in bytes. Valid values are 1, 2, and 4.
> - * @mem_addr: Pointer to return memory buffer.
> - *
> - */
> -int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *mem_addr)
> -{
> - int retval;
> - unsigned long flags;
> -
> - spin_lock_irqsave(&pdc_lock, flags);
> - retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_PCI_CONFIG_READ,
> - __pa(pdc_result), pci_addr, pci_size);
> - switch(pci_size) {
> - case 1: *(u8 *) mem_addr = (u8) pdc_result[0];
> - case 2: *(u16 *)mem_addr = (u16) pdc_result[0];
> - case 4: *(u32 *)mem_addr = (u32) pdc_result[0];
> - }
> - spin_unlock_irqrestore(&pdc_lock, flags);
> -
> - return retval;
> -}
> -
> -/**
> - * pdc_pat_io_pci_cfg_write - Retrieve information about memory address ranges.
> - * @pci_addr: PCI configuration space address for which the write request is being made.
> - * @pci_size: Size of write in bytes. Valid values are 1, 2, and 4.
> - * @value: Pointer to 1, 2, or 4 byte value in low order end of argument to be
> - * written to PCI Config space.
> - *
> - */
> -int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val)
> -{
> - int retval;
> - unsigned long flags;
> -
> - spin_lock_irqsave(&pdc_lock, flags);
> - retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_PCI_CONFIG_WRITE,
> - pci_addr, pci_size, val);
> - spin_unlock_irqrestore(&pdc_lock, flags);
> -
> - return retval;
> -}
> #endif /* CONFIG_64BIT */
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-07-14 21:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-14 10:47 [patch] parisc: delete some unused functions from firmware.c Dan Carpenter
2016-07-14 21:16 ` Helge Deller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).