Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/mxge/if_mxge.c
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
#include <sys/kdb.h> | #include <sys/kdb.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/module.h> | #include <sys/module.h> | ||||
#include <sys/socket.h> | #include <sys/socket.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/sx.h> | #include <sys/sx.h> | ||||
#include <sys/taskqueue.h> | #include <sys/taskqueue.h> | ||||
#include <sys/zlib.h> | #include <zlib.h> | ||||
ota_j.email.ne.jp: I've seen the header file ordering policy somewhere and stating to order by alphabetic order. | |||||
#include <net/if.h> | #include <net/if.h> | ||||
#include <net/if_var.h> | #include <net/if_var.h> | ||||
#include <net/if_arp.h> | #include <net/if_arp.h> | ||||
#include <net/ethernet.h> | #include <net/ethernet.h> | ||||
#include <net/if_dl.h> | #include <net/if_dl.h> | ||||
#include <net/if_media.h> | #include <net/if_media.h> | ||||
▲ Show 20 Lines • Show All 620 Lines • ▼ Show 20 Lines | device_printf(sc->dev, "Driver needs %d.%d\n", | ||||
MXGEFW_VERSION_MAJOR, MXGEFW_VERSION_MINOR); | MXGEFW_VERSION_MAJOR, MXGEFW_VERSION_MINOR); | ||||
return EINVAL; | return EINVAL; | ||||
} | } | ||||
return 0; | return 0; | ||||
} | } | ||||
static void * | static void * | ||||
z_alloc(void *nil, u_int items, u_int size) | mxge_zalloc(void *nil, u_int items, u_int size) | ||||
{ | { | ||||
void *ptr; | void *ptr; | ||||
ptr = malloc(items * size, M_TEMP, M_NOWAIT); | ptr = malloc(items * size, M_TEMP, M_NOWAIT); | ||||
return ptr; | return ptr; | ||||
} | } | ||||
static void | static void | ||||
z_free(void *nil, void *ptr) | mxge_zfree(void *nil, void *ptr) | ||||
{ | { | ||||
free(ptr, M_TEMP); | free(ptr, M_TEMP); | ||||
} | } | ||||
static int | static int | ||||
mxge_load_firmware_helper(mxge_softc_t *sc, uint32_t *limit) | mxge_load_firmware_helper(mxge_softc_t *sc, uint32_t *limit) | ||||
{ | { | ||||
Show All 13 Lines | device_printf(sc->dev, "Could not find firmware image %s\n", | ||||
sc->fw_name); | sc->fw_name); | ||||
return ENOENT; | return ENOENT; | ||||
} | } | ||||
/* setup zlib and decompress f/w */ | /* setup zlib and decompress f/w */ | ||||
bzero(&zs, sizeof (zs)); | bzero(&zs, sizeof (zs)); | ||||
zs.zalloc = z_alloc; | zs.zalloc = mxge_zalloc; | ||||
zs.zfree = z_free; | zs.zfree = mxge_zfree; | ||||
status = inflateInit(&zs); | status = z_inflateInit(&zs); | ||||
if (status != Z_OK) { | if (status != Z_OK) { | ||||
status = EIO; | status = EIO; | ||||
goto abort_with_fw; | goto abort_with_fw; | ||||
} | } | ||||
/* the uncompressed size is stored as the firmware version, | /* the uncompressed size is stored as the firmware version, | ||||
which would otherwise go unused */ | which would otherwise go unused */ | ||||
fw_len = (size_t) fw->version; | fw_len = (size_t) fw->version; | ||||
▲ Show 20 Lines • Show All 4,357 Lines • Show Last 20 Lines |
I've seen the header file ordering policy somewhere and stating to order by alphabetic order.
Should I move zlib.h lower?