Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ahci/ahci.c
Show All 33 Lines | |||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/bus.h> | #include <sys/bus.h> | ||||
#include <sys/conf.h> | #include <sys/conf.h> | ||||
#include <sys/endian.h> | #include <sys/endian.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/sbuf.h> | |||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <machine/stdarg.h> | #include <machine/stdarg.h> | ||||
#include <machine/resource.h> | #include <machine/resource.h> | ||||
#include <machine/bus.h> | #include <machine/bus.h> | ||||
#include <sys/rman.h> | #include <sys/rman.h> | ||||
#include "ahci.h" | #include "ahci.h" | ||||
#include <cam/cam.h> | #include <cam/cam.h> | ||||
▲ Show 20 Lines • Show All 642 Lines • ▼ Show 20 Lines | ahci_print_child(device_t dev, device_t child) | ||||
ivars = (intptr_t)device_get_ivars(child); | ivars = (intptr_t)device_get_ivars(child); | ||||
if ((ivars & AHCI_EM_UNIT) == 0) | if ((ivars & AHCI_EM_UNIT) == 0) | ||||
retval += printf(" at channel %d", (int)ivars & AHCI_UNIT); | retval += printf(" at channel %d", (int)ivars & AHCI_UNIT); | ||||
retval += bus_print_child_footer(dev, child); | retval += bus_print_child_footer(dev, child); | ||||
return (retval); | return (retval); | ||||
} | } | ||||
int | int | ||||
ahci_child_location_str(device_t dev, device_t child, char *buf, | ahci_child_location(device_t dev, device_t child, struct sbuf *sb) | ||||
size_t buflen) | |||||
{ | { | ||||
intptr_t ivars; | intptr_t ivars; | ||||
ivars = (intptr_t)device_get_ivars(child); | ivars = (intptr_t)device_get_ivars(child); | ||||
if ((ivars & AHCI_EM_UNIT) == 0) | if ((ivars & AHCI_EM_UNIT) == 0) | ||||
snprintf(buf, buflen, "channel=%d", (int)ivars & AHCI_UNIT); | sbuf_printf(sb, "channel=%d", (int)ivars & AHCI_UNIT); | ||||
rpokala: I rather hate that the return value from `sbuf_printf()` is being ignored, but the return value… | |||||
impAuthorUnsubmitted Done Inline ActionsAt least with sbuf, you can get an error status from it. and once the buffer is full, there's no harm in calling sbuf functions again. The caller can still extract the errors and decide what to do, so the client functions needn't worry about it. imp: At least with sbuf, you can get an error status from it. and once the buffer is full, there's… | |||||
return (0); | return (0); | ||||
} | } | ||||
bus_dma_tag_t | bus_dma_tag_t | ||||
ahci_get_dma_tag(device_t dev, device_t child) | ahci_get_dma_tag(device_t dev, device_t child) | ||||
{ | { | ||||
struct ahci_controller *ctlr = device_get_softc(dev); | struct ahci_controller *ctlr = device_get_softc(dev); | ||||
▲ Show 20 Lines • Show All 2,191 Lines • Show Last 20 Lines |
I rather hate that the return value from sbuf_printf() is being ignored, but the return value from snprintf() was _also_ being ignored, so... 😢