cs4281.c (d95502a8381196524939cc458b2ab90d76ac85a4) | cs4281.c (733a4ea771adb552fffe9b1e1d1d1ee654384dcf) |
---|---|
1/* 2 * Copyright (c) 2000 Orion Hodson <O.Hodson@cs.ucl.ac.uk> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 740 unchanged lines hidden (view full) --- 749static int 750cs4281_pci_attach(device_t dev) 751{ 752 struct sc_info *sc; 753 struct ac97_info *codec = NULL; 754 u_int32_t data; 755 char status[SND_STATUSLEN]; 756 | 1/* 2 * Copyright (c) 2000 Orion Hodson <O.Hodson@cs.ucl.ac.uk> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 740 unchanged lines hidden (view full) --- 749static int 750cs4281_pci_attach(device_t dev) 751{ 752 struct sc_info *sc; 753 struct ac97_info *codec = NULL; 754 u_int32_t data; 755 char status[SND_STATUSLEN]; 756 |
757 if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT)) == NULL) { | 757 if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { |
758 device_printf(dev, "cannot allocate softc\n"); 759 return ENXIO; 760 } 761 | 758 device_printf(dev, "cannot allocate softc\n"); 759 return ENXIO; 760 } 761 |
762 bzero(sc, sizeof(*sc)); | |
763 sc->dev = dev; 764 sc->type = pci_get_devid(dev); 765 766 data = pci_read_config(dev, PCIR_COMMAND, 2); 767 data |= (PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN); 768 pci_write_config(dev, PCIR_COMMAND, data, 2); 769 770#if __FreeBSD_version > 500000 --- 209 unchanged lines hidden --- | 762 sc->dev = dev; 763 sc->type = pci_get_devid(dev); 764 765 data = pci_read_config(dev, PCIR_COMMAND, 2); 766 data |= (PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN); 767 pci_write_config(dev, PCIR_COMMAND, data, 2); 768 769#if __FreeBSD_version > 500000 --- 209 unchanged lines hidden --- |