Message ID | 2beb81fdd7592a94329e3c9a6ba56959f6094019.1709326528.git.geert+renesas@glider.be (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | sh: Fix missing prototypes | expand |
Hi Geert, On Fri, 2024-03-01 at 22:02 +0100, Geert Uytterhoeven wrote: > dma_extend(), get_dma_info_by_name(), register_chan_caps(), and > request_dma_bycap() are unused. Remove them, and all related code. > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> > --- > arch/sh/drivers/dma/dma-api.c | 116 ---------------------------------- > arch/sh/include/asm/dma.h | 7 -- > 2 files changed, 123 deletions(-) > > diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c > index f49097fa634c36d4..87e5a892887360f5 100644 > --- a/arch/sh/drivers/dma/dma-api.c > +++ b/arch/sh/drivers/dma/dma-api.c > @@ -41,21 +41,6 @@ struct dma_info *get_dma_info(unsigned int chan) > } > EXPORT_SYMBOL(get_dma_info); > > -struct dma_info *get_dma_info_by_name(const char *dmac_name) > -{ > - struct dma_info *info; > - > - list_for_each_entry(info, ®istered_dmac_list, list) { > - if (dmac_name && (strcmp(dmac_name, info->name) != 0)) > - continue; > - else > - return info; > - } > - > - return NULL; > -} > -EXPORT_SYMBOL(get_dma_info_by_name); > - > static unsigned int get_nr_channels(void) > { > struct dma_info *info; > @@ -101,66 +86,6 @@ int get_dma_residue(unsigned int chan) > } > EXPORT_SYMBOL(get_dma_residue); > > -static int search_cap(const char **haystack, const char *needle) > -{ > - const char **p; > - > - for (p = haystack; *p; p++) > - if (strcmp(*p, needle) == 0) > - return 1; > - > - return 0; > -} > - > -/** > - * request_dma_bycap - Allocate a DMA channel based on its capabilities > - * @dmac: List of DMA controllers to search > - * @caps: List of capabilities > - * > - * Search all channels of all DMA controllers to find a channel which > - * matches the requested capabilities. The result is the channel > - * number if a match is found, or %-ENODEV if no match is found. > - * > - * Note that not all DMA controllers export capabilities, in which > - * case they can never be allocated using this API, and so > - * request_dma() must be used specifying the channel number. > - */ > -int request_dma_bycap(const char **dmac, const char **caps, const char *dev_id) > -{ > - unsigned int found = 0; > - struct dma_info *info; > - const char **p; > - int i; > - > - BUG_ON(!dmac || !caps); > - > - list_for_each_entry(info, ®istered_dmac_list, list) > - if (strcmp(*dmac, info->name) == 0) { > - found = 1; > - break; > - } > - > - if (!found) > - return -ENODEV; > - > - for (i = 0; i < info->nr_channels; i++) { > - struct dma_channel *channel = &info->channels[i]; > - > - if (unlikely(!channel->caps)) > - continue; > - > - for (p = caps; *p; p++) { > - if (!search_cap(channel->caps, *p)) > - break; > - if (request_dma(channel->chan, dev_id) == 0) > - return channel->chan; > - } > - } > - > - return -EINVAL; > -} > -EXPORT_SYMBOL(request_dma_bycap); > - > int request_dma(unsigned int chan, const char *dev_id) > { > struct dma_channel *channel = { 0 }; > @@ -213,35 +138,6 @@ void dma_wait_for_completion(unsigned int chan) > } > EXPORT_SYMBOL(dma_wait_for_completion); > > -int register_chan_caps(const char *dmac, struct dma_chan_caps *caps) > -{ > - struct dma_info *info; > - unsigned int found = 0; > - int i; > - > - list_for_each_entry(info, ®istered_dmac_list, list) > - if (strcmp(dmac, info->name) == 0) { > - found = 1; > - break; > - } > - > - if (unlikely(!found)) > - return -ENODEV; > - > - for (i = 0; i < info->nr_channels; i++, caps++) { > - struct dma_channel *channel; > - > - if ((info->first_channel_nr + i) != caps->ch_num) > - return -EINVAL; > - > - channel = &info->channels[i]; > - channel->caps = caps->caplist; > - } > - > - return 0; > -} > -EXPORT_SYMBOL(register_chan_caps); > - > void dma_configure_channel(unsigned int chan, unsigned long flags) > { > struct dma_info *info = get_dma_info(chan); > @@ -267,18 +163,6 @@ int dma_xfer(unsigned int chan, unsigned long from, > } > EXPORT_SYMBOL(dma_xfer); > > -int dma_extend(unsigned int chan, unsigned long op, void *param) > -{ > - struct dma_info *info = get_dma_info(chan); > - struct dma_channel *channel = get_dma_channel(chan); > - > - if (info->ops->extend) > - return info->ops->extend(channel, op, param); > - > - return -ENOSYS; > -} > -EXPORT_SYMBOL(dma_extend); > - > static int dma_proc_show(struct seq_file *m, void *v) > { > struct dma_info *info = v; > diff --git a/arch/sh/include/asm/dma.h b/arch/sh/include/asm/dma.h > index c8bee3f985a29393..6b6d409956d17f09 100644 > --- a/arch/sh/include/asm/dma.h > +++ b/arch/sh/include/asm/dma.h > @@ -56,7 +56,6 @@ struct dma_ops { > int (*get_residue)(struct dma_channel *chan); > int (*xfer)(struct dma_channel *chan); > int (*configure)(struct dma_channel *chan, unsigned long flags); > - int (*extend)(struct dma_channel *chan, unsigned long op, void *param); > }; > > struct dma_channel { > @@ -118,8 +117,6 @@ extern int dma_xfer(unsigned int chan, unsigned long from, > #define dma_read_page(chan, from, to) \ > dma_read(chan, from, to, PAGE_SIZE) > > -extern int request_dma_bycap(const char **dmac, const char **caps, > - const char *dev_id); > extern int get_dma_residue(unsigned int chan); > extern struct dma_info *get_dma_info(unsigned int chan); > extern struct dma_channel *get_dma_channel(unsigned int chan); > @@ -128,10 +125,6 @@ extern void dma_configure_channel(unsigned int chan, unsigned long flags); > > extern int register_dmac(struct dma_info *info); > extern void unregister_dmac(struct dma_info *info); > -extern struct dma_info *get_dma_info_by_name(const char *dmac_name); > - > -extern int dma_extend(unsigned int chan, unsigned long op, void *param); > -extern int register_chan_caps(const char *dmac, struct dma_chan_caps *capslist); > > /* arch/sh/drivers/dma/dma-sysfs.c */ > extern int dma_create_sysfs_files(struct dma_channel *, struct dma_info *); I assume we could re-add these again in case we need them, but it would be good if Yoshinori could comment on whether we should keep these functions or not. Adrian
Hi Geert, On Wed, 2024-05-01 at 11:12 +0200, John Paul Adrian Glaubitz wrote: > Hi Geert, > > On Fri, 2024-03-01 at 22:02 +0100, Geert Uytterhoeven wrote: > > dma_extend(), get_dma_info_by_name(), register_chan_caps(), and > > request_dma_bycap() are unused. Remove them, and all related code. > > > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> > > --- > > arch/sh/drivers/dma/dma-api.c | 116 ---------------------------------- > > arch/sh/include/asm/dma.h | 7 -- > > 2 files changed, 123 deletions(-) > > > > diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c > > index f49097fa634c36d4..87e5a892887360f5 100644 > > --- a/arch/sh/drivers/dma/dma-api.c > > +++ b/arch/sh/drivers/dma/dma-api.c > > @@ -41,21 +41,6 @@ struct dma_info *get_dma_info(unsigned int chan) > > } > > EXPORT_SYMBOL(get_dma_info); > > > > -struct dma_info *get_dma_info_by_name(const char *dmac_name) > > -{ > > - struct dma_info *info; > > - > > - list_for_each_entry(info, ®istered_dmac_list, list) { > > - if (dmac_name && (strcmp(dmac_name, info->name) != 0)) > > - continue; > > - else > > - return info; > > - } > > - > > - return NULL; > > -} > > -EXPORT_SYMBOL(get_dma_info_by_name); > > - > > static unsigned int get_nr_channels(void) > > { > > struct dma_info *info; > > @@ -101,66 +86,6 @@ int get_dma_residue(unsigned int chan) > > } > > EXPORT_SYMBOL(get_dma_residue); > > > > -static int search_cap(const char **haystack, const char *needle) > > -{ > > - const char **p; > > - > > - for (p = haystack; *p; p++) > > - if (strcmp(*p, needle) == 0) > > - return 1; > > - > > - return 0; > > -} > > - > > -/** > > - * request_dma_bycap - Allocate a DMA channel based on its capabilities > > - * @dmac: List of DMA controllers to search > > - * @caps: List of capabilities > > - * > > - * Search all channels of all DMA controllers to find a channel which > > - * matches the requested capabilities. The result is the channel > > - * number if a match is found, or %-ENODEV if no match is found. > > - * > > - * Note that not all DMA controllers export capabilities, in which > > - * case they can never be allocated using this API, and so > > - * request_dma() must be used specifying the channel number. > > - */ > > -int request_dma_bycap(const char **dmac, const char **caps, const char *dev_id) > > -{ > > - unsigned int found = 0; > > - struct dma_info *info; > > - const char **p; > > - int i; > > - > > - BUG_ON(!dmac || !caps); > > - > > - list_for_each_entry(info, ®istered_dmac_list, list) > > - if (strcmp(*dmac, info->name) == 0) { > > - found = 1; > > - break; > > - } > > - > > - if (!found) > > - return -ENODEV; > > - > > - for (i = 0; i < info->nr_channels; i++) { > > - struct dma_channel *channel = &info->channels[i]; > > - > > - if (unlikely(!channel->caps)) > > - continue; > > - > > - for (p = caps; *p; p++) { > > - if (!search_cap(channel->caps, *p)) > > - break; > > - if (request_dma(channel->chan, dev_id) == 0) > > - return channel->chan; > > - } > > - } > > - > > - return -EINVAL; > > -} > > -EXPORT_SYMBOL(request_dma_bycap); > > - > > int request_dma(unsigned int chan, const char *dev_id) > > { > > struct dma_channel *channel = { 0 }; > > @@ -213,35 +138,6 @@ void dma_wait_for_completion(unsigned int chan) > > } > > EXPORT_SYMBOL(dma_wait_for_completion); > > > > -int register_chan_caps(const char *dmac, struct dma_chan_caps *caps) > > -{ > > - struct dma_info *info; > > - unsigned int found = 0; > > - int i; > > - > > - list_for_each_entry(info, ®istered_dmac_list, list) > > - if (strcmp(dmac, info->name) == 0) { > > - found = 1; > > - break; > > - } > > - > > - if (unlikely(!found)) > > - return -ENODEV; > > - > > - for (i = 0; i < info->nr_channels; i++, caps++) { > > - struct dma_channel *channel; > > - > > - if ((info->first_channel_nr + i) != caps->ch_num) > > - return -EINVAL; > > - > > - channel = &info->channels[i]; > > - channel->caps = caps->caplist; > > - } > > - > > - return 0; > > -} > > -EXPORT_SYMBOL(register_chan_caps); > > - > > void dma_configure_channel(unsigned int chan, unsigned long flags) > > { > > struct dma_info *info = get_dma_info(chan); > > @@ -267,18 +163,6 @@ int dma_xfer(unsigned int chan, unsigned long from, > > } > > EXPORT_SYMBOL(dma_xfer); > > > > -int dma_extend(unsigned int chan, unsigned long op, void *param) > > -{ > > - struct dma_info *info = get_dma_info(chan); > > - struct dma_channel *channel = get_dma_channel(chan); > > - > > - if (info->ops->extend) > > - return info->ops->extend(channel, op, param); > > - > > - return -ENOSYS; > > -} > > -EXPORT_SYMBOL(dma_extend); > > - > > static int dma_proc_show(struct seq_file *m, void *v) > > { > > struct dma_info *info = v; > > diff --git a/arch/sh/include/asm/dma.h b/arch/sh/include/asm/dma.h > > index c8bee3f985a29393..6b6d409956d17f09 100644 > > --- a/arch/sh/include/asm/dma.h > > +++ b/arch/sh/include/asm/dma.h > > @@ -56,7 +56,6 @@ struct dma_ops { > > int (*get_residue)(struct dma_channel *chan); > > int (*xfer)(struct dma_channel *chan); > > int (*configure)(struct dma_channel *chan, unsigned long flags); > > - int (*extend)(struct dma_channel *chan, unsigned long op, void *param); > > }; > > > > struct dma_channel { > > @@ -118,8 +117,6 @@ extern int dma_xfer(unsigned int chan, unsigned long from, > > #define dma_read_page(chan, from, to) \ > > dma_read(chan, from, to, PAGE_SIZE) > > > > -extern int request_dma_bycap(const char **dmac, const char **caps, > > - const char *dev_id); > > extern int get_dma_residue(unsigned int chan); > > extern struct dma_info *get_dma_info(unsigned int chan); > > extern struct dma_channel *get_dma_channel(unsigned int chan); > > @@ -128,10 +125,6 @@ extern void dma_configure_channel(unsigned int chan, unsigned long flags); > > > > extern int register_dmac(struct dma_info *info); > > extern void unregister_dmac(struct dma_info *info); > > -extern struct dma_info *get_dma_info_by_name(const char *dmac_name); > > - > > -extern int dma_extend(unsigned int chan, unsigned long op, void *param); > > -extern int register_chan_caps(const char *dmac, struct dma_chan_caps *capslist); > > > > /* arch/sh/drivers/dma/dma-sysfs.c */ > > extern int dma_create_sysfs_files(struct dma_channel *, struct dma_info *); > > I assume we could re-add these again in case we need them, but it would be good > if Yoshinori could comment on whether we should keep these functions or not. I was wondering: Could there be any userland tools using these DMA functions? Adrian
Hi Adrian, On Wed, May 1, 2024 at 3:58 PM John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> wrote: > On Wed, 2024-05-01 at 11:12 +0200, John Paul Adrian Glaubitz wrote: > > On Fri, 2024-03-01 at 22:02 +0100, Geert Uytterhoeven wrote: > > > dma_extend(), get_dma_info_by_name(), register_chan_caps(), and > > > request_dma_bycap() are unused. Remove them, and all related code. > > > > > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> > > I assume we could re-add these again in case we need them, but it would be good > > if Yoshinori could comment on whether we should keep these functions or not. > > I was wondering: Could there be any userland tools using these DMA functions? They cannot be called from userspace, as there is no API for that. They can only be called from inside the kernel, or from a kernel module (possibly out-of-tree). Gr{oetje,eeting}s, Geert
Hi Geert, On Thu, 2024-05-02 at 09:03 +0200, Geert Uytterhoeven wrote: > On Wed, May 1, 2024 at 3:58 PM John Paul Adrian Glaubitz > <glaubitz@physik.fu-berlin.de> wrote: > > On Wed, 2024-05-01 at 11:12 +0200, John Paul Adrian Glaubitz wrote: > > > On Fri, 2024-03-01 at 22:02 +0100, Geert Uytterhoeven wrote: > > > > dma_extend(), get_dma_info_by_name(), register_chan_caps(), and > > > > request_dma_bycap() are unused. Remove them, and all related code. > > > > > > > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> > > > > I assume we could re-add these again in case we need them, but it would be good > > > if Yoshinori could comment on whether we should keep these functions or not. > > > > I was wondering: Could there be any userland tools using these DMA functions? > > They cannot be called from userspace, as there is no API for that. > They can only be called from inside the kernel, or from a kernel module > (possibly out-of-tree). OK, thanks for the confirmation. Then I think it's safe to remove them. I will apply both your series tonight and the rest of the patches except for the one that moves the paging_init() around as it turns out the current positioning is intentional. Adrian
diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c index f49097fa634c36d4..87e5a892887360f5 100644 --- a/arch/sh/drivers/dma/dma-api.c +++ b/arch/sh/drivers/dma/dma-api.c @@ -41,21 +41,6 @@ struct dma_info *get_dma_info(unsigned int chan) } EXPORT_SYMBOL(get_dma_info); -struct dma_info *get_dma_info_by_name(const char *dmac_name) -{ - struct dma_info *info; - - list_for_each_entry(info, ®istered_dmac_list, list) { - if (dmac_name && (strcmp(dmac_name, info->name) != 0)) - continue; - else - return info; - } - - return NULL; -} -EXPORT_SYMBOL(get_dma_info_by_name); - static unsigned int get_nr_channels(void) { struct dma_info *info; @@ -101,66 +86,6 @@ int get_dma_residue(unsigned int chan) } EXPORT_SYMBOL(get_dma_residue); -static int search_cap(const char **haystack, const char *needle) -{ - const char **p; - - for (p = haystack; *p; p++) - if (strcmp(*p, needle) == 0) - return 1; - - return 0; -} - -/** - * request_dma_bycap - Allocate a DMA channel based on its capabilities - * @dmac: List of DMA controllers to search - * @caps: List of capabilities - * - * Search all channels of all DMA controllers to find a channel which - * matches the requested capabilities. The result is the channel - * number if a match is found, or %-ENODEV if no match is found. - * - * Note that not all DMA controllers export capabilities, in which - * case they can never be allocated using this API, and so - * request_dma() must be used specifying the channel number. - */ -int request_dma_bycap(const char **dmac, const char **caps, const char *dev_id) -{ - unsigned int found = 0; - struct dma_info *info; - const char **p; - int i; - - BUG_ON(!dmac || !caps); - - list_for_each_entry(info, ®istered_dmac_list, list) - if (strcmp(*dmac, info->name) == 0) { - found = 1; - break; - } - - if (!found) - return -ENODEV; - - for (i = 0; i < info->nr_channels; i++) { - struct dma_channel *channel = &info->channels[i]; - - if (unlikely(!channel->caps)) - continue; - - for (p = caps; *p; p++) { - if (!search_cap(channel->caps, *p)) - break; - if (request_dma(channel->chan, dev_id) == 0) - return channel->chan; - } - } - - return -EINVAL; -} -EXPORT_SYMBOL(request_dma_bycap); - int request_dma(unsigned int chan, const char *dev_id) { struct dma_channel *channel = { 0 }; @@ -213,35 +138,6 @@ void dma_wait_for_completion(unsigned int chan) } EXPORT_SYMBOL(dma_wait_for_completion); -int register_chan_caps(const char *dmac, struct dma_chan_caps *caps) -{ - struct dma_info *info; - unsigned int found = 0; - int i; - - list_for_each_entry(info, ®istered_dmac_list, list) - if (strcmp(dmac, info->name) == 0) { - found = 1; - break; - } - - if (unlikely(!found)) - return -ENODEV; - - for (i = 0; i < info->nr_channels; i++, caps++) { - struct dma_channel *channel; - - if ((info->first_channel_nr + i) != caps->ch_num) - return -EINVAL; - - channel = &info->channels[i]; - channel->caps = caps->caplist; - } - - return 0; -} -EXPORT_SYMBOL(register_chan_caps); - void dma_configure_channel(unsigned int chan, unsigned long flags) { struct dma_info *info = get_dma_info(chan); @@ -267,18 +163,6 @@ int dma_xfer(unsigned int chan, unsigned long from, } EXPORT_SYMBOL(dma_xfer); -int dma_extend(unsigned int chan, unsigned long op, void *param) -{ - struct dma_info *info = get_dma_info(chan); - struct dma_channel *channel = get_dma_channel(chan); - - if (info->ops->extend) - return info->ops->extend(channel, op, param); - - return -ENOSYS; -} -EXPORT_SYMBOL(dma_extend); - static int dma_proc_show(struct seq_file *m, void *v) { struct dma_info *info = v; diff --git a/arch/sh/include/asm/dma.h b/arch/sh/include/asm/dma.h index c8bee3f985a29393..6b6d409956d17f09 100644 --- a/arch/sh/include/asm/dma.h +++ b/arch/sh/include/asm/dma.h @@ -56,7 +56,6 @@ struct dma_ops { int (*get_residue)(struct dma_channel *chan); int (*xfer)(struct dma_channel *chan); int (*configure)(struct dma_channel *chan, unsigned long flags); - int (*extend)(struct dma_channel *chan, unsigned long op, void *param); }; struct dma_channel { @@ -118,8 +117,6 @@ extern int dma_xfer(unsigned int chan, unsigned long from, #define dma_read_page(chan, from, to) \ dma_read(chan, from, to, PAGE_SIZE) -extern int request_dma_bycap(const char **dmac, const char **caps, - const char *dev_id); extern int get_dma_residue(unsigned int chan); extern struct dma_info *get_dma_info(unsigned int chan); extern struct dma_channel *get_dma_channel(unsigned int chan); @@ -128,10 +125,6 @@ extern void dma_configure_channel(unsigned int chan, unsigned long flags); extern int register_dmac(struct dma_info *info); extern void unregister_dmac(struct dma_info *info); -extern struct dma_info *get_dma_info_by_name(const char *dmac_name); - -extern int dma_extend(unsigned int chan, unsigned long op, void *param); -extern int register_chan_caps(const char *dmac, struct dma_chan_caps *capslist); /* arch/sh/drivers/dma/dma-sysfs.c */ extern int dma_create_sysfs_files(struct dma_channel *, struct dma_info *);
dma_extend(), get_dma_info_by_name(), register_chan_caps(), and request_dma_bycap() are unused. Remove them, and all related code. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> --- arch/sh/drivers/dma/dma-api.c | 116 ---------------------------------- arch/sh/include/asm/dma.h | 7 -- 2 files changed, 123 deletions(-)