als4000.c (d95502a8381196524939cc458b2ab90d76ac85a4) | als4000.c (733a4ea771adb552fffe9b1e1d1d1ee654384dcf) |
---|---|
1/* 2 * Copyright (c) 2001 Orion Hodson <oho@acm.org> 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 --- 741 unchanged lines hidden (view full) --- 750 751static int 752als_pci_attach(device_t dev) 753{ 754 struct sc_info *sc; 755 u_int32_t data; 756 char status[SND_STATUSLEN]; 757 | 1/* 2 * Copyright (c) 2001 Orion Hodson <oho@acm.org> 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 --- 741 unchanged lines hidden (view full) --- 750 751static int 752als_pci_attach(device_t dev) 753{ 754 struct sc_info *sc; 755 u_int32_t data; 756 char status[SND_STATUSLEN]; 757 |
758 if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT)) == NULL) { | 758 if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { |
759 device_printf(dev, "cannot allocate softc\n"); 760 return ENXIO; 761 } 762 | 759 device_printf(dev, "cannot allocate softc\n"); 760 return ENXIO; 761 } 762 |
763 bzero(sc, sizeof(*sc)); | |
764 sc->dev = 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 * By default the power to the various components on the 771 * ALS4000 is entirely controlled by the pci powerstate. We --- 125 unchanged lines hidden --- | 763 sc->dev = 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 * By default the power to the various components on the 770 * ALS4000 is entirely controlled by the pci powerstate. We --- 125 unchanged lines hidden --- |