Changeset 732


Ignore:
Timestamp:
Sep 11, 2022, 3:09:04 AM (3 years ago)
Author:
Paul Smedley
Message:

Code cleanups

Location:
GPL/branches/uniaud32-next
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-next/alsa-kernel/core/control.c

    r725 r732  
    14331433        size_t buf_len, name_len;
    14341434        unsigned int i;
    1435 //      const
    1436 uintptr_t user_ptrval = ue->info.value.enumerated.names_ptr;
     1435        const uintptr_t user_ptrval = ue->info.value.enumerated.names_ptr;
    14371436
    14381437        buf_len = ue->info.value.enumerated.names_length;
  • GPL/branches/uniaud32-next/alsa-kernel/core/init.c

    r716 r732  
    239239                return err;
    240240        }
     241
    241242        devres_add(parent, card);
    242 
    243243        *card_ret = card;
    244244        return 0;
  • GPL/branches/uniaud32-next/alsa-kernel/pci/ens1370.c

    r720 r732  
    20432043                return err;
    20442044        ensoniq->port = pci_resource_start(pci, 0);
    2045 #ifndef TARGET_OS2
    20462045        if (devm_request_irq(&pci->dev, pci->irq, snd_audiopci_interrupt,
    20472046                             IRQF_SHARED, KBUILD_MODNAME, ensoniq)) {
     
    20492048                return -EBUSY;
    20502049        }
    2051 #else
    2052         if (request_irq(pci->irq, snd_audiopci_interrupt, IRQF_SHARED,
    2053                         KBUILD_MODNAME, ensoniq)) {
    2054                 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
    2055                 snd_ensoniq_free(card);
    2056                 return -EBUSY;
    2057         }
    2058 #endif
    20592050        ensoniq->irq = pci->irq;
    20602051        card->sync_irq = ensoniq->irq;
  • GPL/branches/uniaud32-next/alsa-kernel/pci/hda/hda_intel.c

    r711 r732  
    18021802        *rchip = NULL;
    18031803
    1804         err = pci_enable_device(pci);
     1804        err = pcim_enable_device(pci);
    18051805        if (err < 0)
    18061806                return err;
    18071807
    1808 #ifndef TARGET_OS2
    18091808        hda = devm_kzalloc(&pci->dev, sizeof(*hda), GFP_KERNEL);
    1810 #else
    1811         hda = kzalloc(sizeof(*hda), GFP_KERNEL);
    1812 #endif
    18131809        if (!hda)
    18141810                return -ENOMEM;
  • GPL/branches/uniaud32-next/alsa-kernel/pci/maestro3.c

    r711 r732  
    25652565
    25662566        chip->num_substreams = NR_DSPS;
    2567 #ifndef TARGET_OS2
    25682567        chip->substreams = devm_kcalloc(&pci->dev, chip->num_substreams,
    25692568                                        sizeof(struct m3_dma), GFP_KERNEL);
    2570 #else
    2571         chip->substreams = kcalloc(chip->num_substreams, sizeof(struct m3_dma),
    2572                                    GFP_KERNEL);
    2573 #endif
    25742569        if (!chip->substreams)
    25752570                return -ENOMEM;
     
    26032598        snd_m3_hv_init(chip);
    26042599
    2605 #ifndef TARGET_OS2
    26062600        if (devm_request_irq(&pci->dev, pci->irq, snd_m3_interrupt, IRQF_SHARED,
    26072601                             KBUILD_MODNAME, chip)) {
     
    26092603                return -ENOMEM;
    26102604        }
    2611 #else
    2612         if (request_irq(pci->irq, snd_m3_interrupt, IRQF_SHARED,
    2613                         KBUILD_MODNAME, chip)) {
    2614                 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
    2615                 return -ENOMEM;
    2616         }
    2617 #endif
    26182605        chip->irq = pci->irq;
    26192606        card->sync_irq = chip->irq;
  • GPL/branches/uniaud32-next/include/linux/pci.h

    r730 r732  
    4343#define  PCI_COMMAND_SERR 0x100 /* Enable SERR */
    4444#define  PCI_COMMAND_FAST_BACK  0x200 /* Enable back-to-back writes */
     45#define  PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */
    4546
    4647#define PCI_STATUS    0x06  /* 16 bits */
     
    363364  struct resource dma_resource[DEVICE_COUNT_DMA];
    364365  struct resource irq_resource[DEVICE_COUNT_IRQ];
     366        unsigned int    is_managed:1;
    365367
    366368  char    name[48]; /* Device name */
     
    692694}
    693695
    694 /* pci_intx() wrapper */
    695 #define pci_intx(pci,x)
    696 
    697696/* MSI */
    698697extern int snd_pci_enable_msi(struct pci_dev *dev);
     
    784783#define pcim_iomap pci_iomap
    785784int pcim_iomap_regions(struct pci_dev *pdev, int mask, const char *name);
     785
     786static inline int pci_is_managed(struct pci_dev *pdev)
     787{
     788        return pdev->is_managed;
     789}
     790void pci_intx(struct pci_dev *pdev, int enable);
     791
    786792#endif /* LINUX_PCI_H */
  • GPL/branches/uniaud32-next/lib32/pci.c

    r730 r732  
    11561156}
    11571157EXPORT_SYMBOL(__devm_request_region);
     1158
     1159/*
     1160 * Managed PCI resources.  This manages device on/off, INTx/MSI/MSI-X
     1161 * on/off and BAR regions.  pci_dev itself records MSI/MSI-X status, so
     1162 * there's no need to track it separately.  pci_devres is initialized
     1163 * when a device is enabled using managed PCI device enable interface.
     1164 */
     1165struct pci_devres {
     1166        unsigned int enabled:1;
     1167        unsigned int pinned:1;
     1168        unsigned int orig_intx:1;
     1169        unsigned int restore_intx:1;
     1170        unsigned int mwi:1;
     1171        u32 region_mask;
     1172};
     1173
     1174static void pcim_release(struct device *gendev, void *res)
     1175{
     1176}
     1177
     1178static struct pci_devres *find_pci_dr(struct pci_dev *pdev)
     1179{
     1180        if (pci_is_managed(pdev))
     1181                return devres_find(&pdev->dev, pcim_release, NULL, NULL);
     1182        return NULL;
     1183}
     1184
     1185/**
     1186 * pci_intx - enables/disables PCI INTx for device dev
     1187 * @pdev: the PCI device to operate on
     1188 * @enable: boolean: whether to enable or disable PCI INTx
     1189 *
     1190 * Enables/disables PCI INTx for device @pdev
     1191 */
     1192void pci_intx(struct pci_dev *pdev, int enable)
     1193{
     1194        u16 pci_command, new;
     1195
     1196        pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
     1197
     1198        if (enable)
     1199                new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
     1200        else
     1201                new = pci_command | PCI_COMMAND_INTX_DISABLE;
     1202
     1203        if (new != pci_command) {
     1204                struct pci_devres *dr;
     1205
     1206                pci_write_config_word(pdev, PCI_COMMAND, new);
     1207
     1208                dr = find_pci_dr(pdev);
     1209                if (dr && !dr->restore_intx) {
     1210                        dr->restore_intx = 1;
     1211                        dr->orig_intx = !enable;
     1212                }
     1213        }
     1214}
     1215EXPORT_SYMBOL_GPL(pci_intx);
Note: See TracChangeset for help on using the changeset viewer.