X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fscsi%2Fsym53c8xx_2%2Fsym_malloc.c;h=01f380a2d28f8bb7f6e1ca5ca0f264a984fbbbd3;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=6641f35f89a112f0506a98151cb3e07db2ee8a33;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/scsi/sym53c8xx_2/sym_malloc.c b/drivers/scsi/sym53c8xx_2/sym_malloc.c index 6641f35f8..01f380a2d 100644 --- a/drivers/scsi/sym53c8xx_2/sym_malloc.c +++ b/drivers/scsi/sym53c8xx_2/sym_malloc.c @@ -22,32 +22,19 @@ * *----------------------------------------------------------------------------- * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * Where this Software is combined with software released under the terms of - * the GNU Public License ("GPL") and the terms of the GPL would require the - * combined work to also be released under the terms of the GPL, the terms - * and conditions of this License will apply in addition to those of the - * GPL with the exception of any terms or conditions of this License that - * conflict with, or are expressly prohibited by, the GPL. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef __FreeBSD__ @@ -83,7 +70,7 @@ static void *___sym_malloc(m_pool_p mp, int size) m_link_p h = mp->h; if (size > SYM_MEM_CLUSTER_SIZE) - return 0; + return NULL; while (size > s) { s <<= 1; @@ -95,7 +82,7 @@ static void *___sym_malloc(m_pool_p mp, int size) if (s == SYM_MEM_CLUSTER_SIZE) { h[j].next = (m_link_p) M_GET_MEM_CLUSTER(); if (h[j].next) - h[j].next->next = 0; + h[j].next->next = NULL; break; } ++j; @@ -108,7 +95,7 @@ static void *___sym_malloc(m_pool_p mp, int size) j -= 1; s >>= 1; h[j].next = (m_link_p) (a+s); - h[j].next->next = 0; + h[j].next->next = NULL; } } #ifdef DEBUG @@ -183,7 +170,7 @@ static void *__sym_calloc2(m_pool_p mp, int size, char *name, int uflags) } if (p) - bzero(p, size); + memset(p, 0, size); else if (uflags & SYM_MEM_WARN) printf ("__sym_calloc2: failed to allocate %s[%d]\n", name, size); return p; @@ -225,10 +212,10 @@ static void ___mp0_free_mem_cluster(m_pool_p mp, m_addr_t m) #ifdef SYM_MEM_FREE_UNUSED static struct sym_m_pool mp0 = - {0, ___mp0_get_mem_cluster, ___mp0_free_mem_cluster}; + {NULL, ___mp0_get_mem_cluster, ___mp0_free_mem_cluster}; #else static struct sym_m_pool mp0 = - {0, ___mp0_get_mem_cluster}; + {NULL, ___mp0_get_mem_cluster}; #endif /* @@ -310,7 +297,7 @@ static __inline m_pool_p ___get_dma_pool(m_pool_ident_t dev_dmat) /* Create a new memory DMAable pool (when fetch failed) */ static m_pool_p ___cre_dma_pool(m_pool_ident_t dev_dmat) { - m_pool_p mp = 0; + m_pool_p mp = NULL; mp = __sym_calloc(&mp0, sizeof(*mp), "MPOOL"); if (mp) { @@ -327,7 +314,7 @@ static m_pool_p ___cre_dma_pool(m_pool_ident_t dev_dmat) } if (mp) __sym_mfree(&mp0, mp, sizeof(*mp), "MPOOL"); - return 0; + return NULL; } #ifdef SYM_MEM_FREE_UNUSED @@ -352,7 +339,7 @@ static void ___del_dma_pool(m_pool_p p) void *__sym_calloc_dma_unlocked(m_pool_ident_t dev_dmat, int size, char *name) { m_pool_p mp; - void *m = 0; + void *m = NULL; mp = ___get_dma_pool(dev_dmat); if (!mp) @@ -392,7 +379,7 @@ u32 __vtobus_unlocked(m_pool_ident_t dev_dmat, void *m) { m_pool_p mp; int hc = VTOB_HASH_CODE(m); - m_vtob_p vp = 0; + m_vtob_p vp = NULL; m_addr_t a = ((m_addr_t) m) & ~SYM_MEM_CLUSTER_MASK; mp = ___get_dma_pool(dev_dmat);