Ignore:
Timestamp:
Mar 18, 2021, 8:57:36 PM (4 years ago)
Author:
David Azarewicz
Message:

Merge changes from Paul's uniaud32next branch.

Location:
GPL/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/alsa-kernel/include/sound/info.h

    r598 r679  
     1/* SPDX-License-Identifier: GPL-2.0-or-later */
    12#ifndef __SOUND_INFO_H
    23#define __SOUND_INFO_H
     
    56 *  Header file for info interface
    67 *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
    7  *
    8  *
    9  *   This program is free software; you can redistribute it and/or modify
    10  *   it under the terms of the GNU General Public License as published by
    11  *   the Free Software Foundation; either version 2 of the License, or
    12  *   (at your option) any later version.
    13  *
    14  *   This program is distributed in the hope that it will be useful,
    15  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    16  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    17  *   GNU General Public License for more details.
    18  *
    19  *   You should have received a copy of the GNU General Public License
    20  *   along with this program; if not, write to the Free Software
    21  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    22  *
    238 */
    249
    2510#include <linux/poll.h>
     11#include <linux/seq_file.h>
     12#include <sound/core.h>
    2613
    2714/* buffer for information */
     
    6148                         void *file_private_data, struct file *file,
    6249                         loff_t offset, int orig);
    63         unsigned int (*poll)(struct snd_info_entry *entry,
     50        __poll_t (*poll)(struct snd_info_entry *entry,
    6451                             void *file_private_data, struct file *file,
    6552                             poll_table *wait);
     
    7360struct snd_info_entry {
    7461        const char *name;
    75         mode_t mode;
     62        umode_t mode;
    7663        long size;
    7764        unsigned short content;
    7865        union {
    7966                struct snd_info_entry_text text;
    80                 struct snd_info_entry_ops *ops;
     67                const struct snd_info_entry_ops *ops;
    8168        } c;
    8269        struct snd_info_entry *parent;
    83         struct snd_card *card;
    8470        struct module *module;
    8571        void *private_data;
     
    9177};
    9278
    93 #if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)
     79#if (defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_SND_PROC_FS)) || defined(TARGET_OS2)
    9480int snd_info_minor_register(void);
    95 int snd_info_minor_unregister(void);
    96 #else
    97 #define snd_info_minor_register() /* NOP */
    98 #define snd_info_minor_unregister() /* NOP */
    99 #endif
    100 
    101 
    102 #ifdef CONFIG_PROC_FS
     81#else
     82#define snd_info_minor_register()       0
     83#endif
     84
     85
     86#if defined(CONFIG_SND_PROC_FS)
    10387
    10488extern struct snd_info_entry *snd_seq_root;
     
    11195#endif
    11296
     97/**
     98 * snd_iprintf - printf on the procfs buffer
     99 * @buf: the procfs buffer
     100 * @fmt: the printf format
     101 *
     102 * Outputs the string on the procfs buffer just like printf().
     103 *
     104 * Return: zero for success, or a negative error code.
     105 */
    113106#ifndef TARGET_OS2
    114 int snd_iprintf(struct snd_info_buffer *buffer, const char *fmt, ...) \
    115                                 __attribute__ ((format (printf, 2, 3)));
    116 #else
    117 int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...);
    118 #endif
     107#define snd_iprintf(buf, fmt, args...) \
     108        seq_printf((struct seq_file *)(buf)->buffer, fmt, ##args)
     109#else
     110static inline int snd_iprintf(struct snd_info_buffer *buffer, char *fmt, ...) { return 0; }
     111#endif
     112
    119113int snd_info_init(void);
    120114int snd_info_done(void);
     
    140134
    141135/* for card drivers */
    142 int snd_card_proc_new(struct snd_card *card, const char *name,
    143                       struct snd_info_entry **entryp);
     136static inline int snd_card_proc_new(struct snd_card *card, const char *name,
     137                                    struct snd_info_entry **entryp)
     138{
     139        *entryp = snd_info_create_card_entry(card, name, card->proc_root);
     140        return *entryp ? 0 : -ENOMEM;
     141}
    144142
    145143static inline void snd_info_set_text_ops(struct snd_info_entry *entry,
     
    150148        entry->c.text.read = read;
    151149}
     150
     151int snd_card_rw_proc_new(struct snd_card *card, const char *name,
     152                         void *private_data,
     153                         void (*read)(struct snd_info_entry *,
     154                                      struct snd_info_buffer *),
     155                         void (*write)(struct snd_info_entry *entry,
     156                                       struct snd_info_buffer *buffer));
    152157
    153158int snd_info_check_reserved_words(const char *str);
     
    177182static inline int snd_card_proc_new(struct snd_card *card, const char *name,
    178183                                    struct snd_info_entry **entryp) { return -EINVAL; }
    179 static inline void snd_info_set_text_ops(struct snd_info_entry *entry __attribute__((unused)),
     184static inline void snd_info_set_text_ops(struct snd_info_entry *entry /*__attribute__((unused))*/,
    180185                                         void *private_data,
    181186                                         void (*read)(struct snd_info_entry *, struct snd_info_buffer *)) {}
    182 
     187static inline int snd_card_rw_proc_new(struct snd_card *card, const char *name,
     188                                       void *private_data,
     189                                       void (*read)(struct snd_info_entry *,
     190                                                    struct snd_info_buffer *),
     191                                       void (*write)(struct snd_info_entry *entry,
     192                                                     struct snd_info_buffer *buffer))
     193{
     194        return 0;
     195}
    183196static inline int snd_info_check_reserved_words(const char *str) { return 1; }
    184197
    185198#endif
     199
     200/**
     201 * snd_card_ro_proc_new - Create a read-only text proc file entry for the card
     202 * @card: the card instance
     203 * @name: the file name
     204 * @private_data: the arbitrary private data
     205 * @read: the read callback
     206 *
     207 * This proc file entry will be registered via snd_card_register() call, and
     208 * it will be removed automatically at the card removal, too.
     209 */
     210static inline int
     211snd_card_ro_proc_new(struct snd_card *card, const char *name,
     212                     void *private_data,
     213                     void (*read)(struct snd_info_entry *,
     214                                  struct snd_info_buffer *))
     215{
     216        return snd_card_rw_proc_new(card, name, private_data, read, NULL);
     217}
    186218
    187219/*
     
    189221 */
    190222
    191 #if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)
     223#if (defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_SND_PROC_FS)) || defined(TARGET_OS2)
    192224
    193225#define SNDRV_OSS_INFO_DEV_AUDIO        0
     
    202234#define snd_oss_info_unregister(dev, num) snd_oss_info_register(dev, num, NULL)
    203235
    204 #endif /* CONFIG_SND_OSSEMUL && CONFIG_PROC_FS */
     236#endif /* CONFIG_SND_OSSEMUL && CONFIG_SND_PROC_FS */
    205237
    206238#endif /* __SOUND_INFO_H */
Note: See TracChangeset for help on using the changeset viewer.