Skip to content

Commit

Permalink
Do pass removing some write-only variables from the kernel.
Browse files Browse the repository at this point in the history
This reduces noise when kernel is compiled by newer GCC versions,
such as one used by external toolchain ports.

Reviewed by: kib, andrew(sys/arm and sys/arm64), emaste(partial), erj(partial)
Reviewed by: jhb (sys/dev/pci/* sys/kern/vfs_aio.c and sys/kern/kern_synch.c)
Differential Revision: https://reviews.freebsd.org/D10385
  • Loading branch information
akabaev committed Dec 25, 2017
1 parent 1bd48ad commit c8da6fa
Show file tree
Hide file tree
Showing 84 changed files with 68 additions and 313 deletions.
3 changes: 0 additions & 3 deletions sys/arm/allwinner/aw_wdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ static void aw_wdog_shutdown_fn(void *, int);
static int
aw_wdog_probe(device_t dev)
{
struct aw_wdog_softc *sc;

sc = device_get_softc(dev);

if (!ofw_bus_status_okay(dev))
return (ENXIO);
Expand Down
2 changes: 0 additions & 2 deletions sys/arm/allwinner/axp81x.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,11 @@ axp81x_shutdown(void *devp, int howto)
static void
axp81x_intr(void *arg)
{
struct axp81x_softc *sc;
device_t dev;
uint8_t val;
int error;

dev = arg;
sc = device_get_softc(dev);

error = axp81x_read(dev, AXP_IRQSTAT5, &val, 1);
if (error != 0)
Expand Down
4 changes: 1 addition & 3 deletions sys/arm/allwinner/clk/aw_pll.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ h3_pll1_set_freq(struct aw_pll_sc *sc, uint64_t fin, uint64_t *fout,
int flags)
{
struct aw_pll_factor *f;
uint32_t val, n, k, m, p;
uint32_t val, m, p;
int i;

f = NULL;
Expand All @@ -884,8 +884,6 @@ h3_pll1_set_freq(struct aw_pll_sc *sc, uint64_t fin, uint64_t *fout,
DEVICE_LOCK(sc);
PLL_READ(sc, &val);

n = (val & A23_PLL1_FACTOR_N) >> A23_PLL1_FACTOR_N_SHIFT;
k = (val & A23_PLL1_FACTOR_K) >> A23_PLL1_FACTOR_K_SHIFT;
m = (val & A23_PLL1_FACTOR_M) >> A23_PLL1_FACTOR_M_SHIFT;
p = (val & A23_PLL1_FACTOR_P) >> A23_PLL1_FACTOR_P_SHIFT;

Expand Down
4 changes: 0 additions & 4 deletions sys/arm/allwinner/if_awg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1266,12 +1266,10 @@ awg_setup_extres(device_t dev)
hwreset_t rst_ahb, rst_ephy;
clk_t clk_ahb, clk_ephy;
regulator_t reg;
phandle_t node;
uint64_t freq;
int error, div;

sc = device_get_softc(dev);
node = ofw_bus_get_node(dev);
rst_ahb = rst_ephy = NULL;
clk_ahb = clk_ephy = NULL;
reg = NULL;
Expand Down Expand Up @@ -1713,13 +1711,11 @@ awg_attach(device_t dev)
{
uint8_t eaddr[ETHER_ADDR_LEN];
struct awg_softc *sc;
phandle_t node;
int error;

sc = device_get_softc(dev);
sc->dev = dev;
sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
node = ofw_bus_get_node(dev);

if (bus_alloc_resources(dev, awg_spec, sc->res) != 0) {
device_printf(dev, "cannot allocate resources for device\n");
Expand Down
2 changes: 0 additions & 2 deletions sys/arm/arm/gic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1384,11 +1384,9 @@ int
arm_gicv2m_attach(device_t dev)
{
struct arm_gicv2m_softc *sc;
struct arm_gic_softc *psc;
uint32_t typer;
int rid;

psc = device_get_softc(device_get_parent(dev));
sc = device_get_softc(dev);

rid = 0;
Expand Down
10 changes: 6 additions & 4 deletions sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1386,9 +1386,6 @@ bcm2835_cpufreq_attach(device_t dev)
static int
bcm2835_cpufreq_detach(device_t dev)
{
struct bcm2835_cpufreq_softc *sc;

sc = device_get_softc(dev);

sema_destroy(&vc_sema);

Expand All @@ -1400,7 +1397,10 @@ bcm2835_cpufreq_set(device_t dev, const struct cf_setting *cf)
{
struct bcm2835_cpufreq_softc *sc;
uint32_t rate_hz, rem;
int cur_freq, resp_freq, arm_freq, min_freq, core_freq;
int resp_freq, arm_freq, min_freq, core_freq;
#ifdef DEBUG
int cur_freq;
#endif

if (cf == NULL || cf->freq < 0)
return (EINVAL);
Expand All @@ -1425,8 +1425,10 @@ bcm2835_cpufreq_set(device_t dev, const struct cf_setting *cf)

/* set new value and verify it */
VC_LOCK(sc);
#ifdef DEBUG
cur_freq = bcm2835_cpufreq_get_clock_rate(sc,
BCM2835_MBOX_CLOCK_ID_ARM);
#endif
resp_freq = bcm2835_cpufreq_set_clock_rate(sc,
BCM2835_MBOX_CLOCK_ID_ARM, rate_hz);
DELAY(TRANSITION_LATENCY);
Expand Down
3 changes: 1 addition & 2 deletions sys/arm/broadcom/bcm2835/bcm2835_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ bcm_gpio_pic_map_fdt(struct bcm_gpio_softc *sc, struct intr_map_data_fdt *daf,
u_int *irqp, uint32_t *modep)
{
u_int irq;
uint32_t mode, bank;
uint32_t mode;

/*
* The first cell is the interrupt number.
Expand All @@ -1036,7 +1036,6 @@ bcm_gpio_pic_map_fdt(struct bcm_gpio_softc *sc, struct intr_map_data_fdt *daf,
return (EINVAL);

/* Only reasonable modes are supported. */
bank = BCM_GPIO_BANK(irq);
if (daf->cells[1] == 1)
mode = GPIO_INTR_EDGE_RISING;
else if (daf->cells[1] == 2)
Expand Down
4 changes: 4 additions & 0 deletions sys/arm/broadcom/bcm2835/bcm2835_mbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,18 @@ static struct ofw_compat_data compat_data[] = {
static int
bcm_mbox_read_msg(struct bcm_mbox_softc *sc, int *ochan)
{
#ifdef DEBUG
uint32_t data;
#endif
uint32_t msg;
int chan;

msg = mbox_read_4(sc, REG_READ);
dprintf("bcm_mbox_intr: raw data %08x\n", msg);
chan = MBOX_CHAN(msg);
#ifdef DEBUG
data = MBOX_DATA(msg);
#endif
if (sc->msg[chan]) {
printf("bcm_mbox_intr: channel %d oveflow\n", chan);
return (1);
Expand Down
2 changes: 0 additions & 2 deletions sys/arm64/arm64/gic_v3.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,7 @@ arm_gic_v3_intr(void *arg)
struct intr_pic *pic;
uint64_t active_irq;
struct trapframe *tf;
bool first;

first = true;
pic = sc->gic_pic;

while (1) {
Expand Down
6 changes: 0 additions & 6 deletions sys/arm64/arm64/gicv3_its.c
Original file line number Diff line number Diff line change
Expand Up @@ -1105,12 +1105,10 @@ static int
gicv3_its_release_msi(device_t dev, device_t child, int count,
struct intr_irqsrc **isrc)
{
struct gicv3_its_softc *sc;
struct gicv3_its_irqsrc *girq;
struct its_dev *its_dev;
int i;

sc = device_get_softc(dev);
its_dev = its_device_find(dev, child);

KASSERT(its_dev != NULL,
Expand Down Expand Up @@ -1165,11 +1163,9 @@ gicv3_its_alloc_msix(device_t dev, device_t child, device_t *pic,
static int
gicv3_its_release_msix(device_t dev, device_t child, struct intr_irqsrc *isrc)
{
struct gicv3_its_softc *sc;
struct gicv3_its_irqsrc *girq;
struct its_dev *its_dev;

sc = device_get_softc(dev);
its_dev = its_device_find(dev, child);

KASSERT(its_dev != NULL,
Expand Down Expand Up @@ -1405,9 +1401,7 @@ its_cmd_prepare(struct its_cmd *cmd, struct its_cmd_desc *desc)
uint64_t target;
uint8_t cmd_type;
u_int size;
boolean_t error;

error = FALSE;
cmd_type = desc->cmd_type;
target = ITS_TARGET_NONE;

Expand Down
3 changes: 1 addition & 2 deletions sys/arm64/arm64/machdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,14 +630,13 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
struct sigframe *fp, frame;
struct sigacts *psp;
struct sysentvec *sysent;
int code, onstack, sig;
int onstack, sig;

td = curthread;
p = td->td_proc;
PROC_LOCK_ASSERT(p, MA_OWNED);

sig = ksi->ksi_signo;
code = ksi->ksi_code;
psp = p->p_sigacts;
mtx_assert(&psp->ps_mtx, MA_OWNED);

Expand Down
3 changes: 1 addition & 2 deletions sys/arm64/arm64/pmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ pmap_bootstrap_l2(vm_offset_t l1pt, vm_offset_t va, vm_offset_t l2_start)
static vm_offset_t
pmap_bootstrap_l3(vm_offset_t l1pt, vm_offset_t va, vm_offset_t l3_start)
{
vm_offset_t l2pt, l3pt;
vm_offset_t l3pt;
vm_paddr_t pa;
pd_entry_t *l2;
u_int l2_slot;
Expand All @@ -630,7 +630,6 @@ pmap_bootstrap_l3(vm_offset_t l1pt, vm_offset_t va, vm_offset_t l3_start)

l2 = pmap_l2(kernel_pmap, va);
l2 = (pd_entry_t *)rounddown2((uintptr_t)l2, PAGE_SIZE);
l2pt = (vm_offset_t)l2;
l2_slot = pmap_l2_index(va);
l3pt = l3_start;

Expand Down
5 changes: 1 addition & 4 deletions sys/cam/ata/ata_da.c
Original file line number Diff line number Diff line change
Expand Up @@ -2631,10 +2631,8 @@ adaprobedone(struct cam_periph *periph, union ccb *ccb)
static void
adazonedone(struct cam_periph *periph, union ccb *ccb)
{
struct ada_softc *softc;
struct bio *bp;

softc = periph->softc;
bp = (struct bio *)ccb->ccb_h.ccb_bp;

switch (bp->bio_zone.zone_cmd) {
Expand All @@ -2649,7 +2647,7 @@ adazonedone(struct cam_periph *periph, union ccb *ccb)
struct scsi_report_zones_hdr *hdr;
struct scsi_report_zones_desc *desc;
struct disk_zone_rep_entry *entry;
uint32_t num_alloced, hdr_len, num_avail;
uint32_t hdr_len, num_avail;
uint32_t num_to_fill, i;

rep = &bp->bio_zone.zone_params.report;
Expand All @@ -2664,7 +2662,6 @@ adazonedone(struct cam_periph *periph, union ccb *ccb)
* be different than the amount of data transferred to
* the user.
*/
num_alloced = rep->entries_allocated;
hdr = (struct scsi_report_zones_hdr *)ccb->ataio.data_ptr;
if (avail_len < sizeof(*hdr)) {
/*
Expand Down
9 changes: 3 additions & 6 deletions sys/cam/scsi/scsi_da.c
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,6 @@ daclose(struct disk *dp)
struct cam_periph *periph;
struct da_softc *softc;
union ccb *ccb;
int error;

periph = (struct cam_periph *)dp->d_drv1;
softc = (struct da_softc *)periph->softc;
Expand All @@ -1544,7 +1543,7 @@ daclose(struct disk *dp)
/*cbfcnp*/dadone, MSG_SIMPLE_Q_TAG,
/*begin_lba*/0, /*lb_count*/0, SSD_FULL_SIZE,
5 * 60 * 1000);
error = cam_periph_runccb(ccb, daerror, /*cam_flags*/0,
cam_periph_runccb(ccb, daerror, /*cam_flags*/0,
/*sense_flags*/SF_RETRY_UA | SF_QUIET_IR,
softc->disk->d_devstat);
softc->flags &= ~DA_FLAG_DIRTY;
Expand Down Expand Up @@ -2311,7 +2310,7 @@ dadeletemethodsysctl(SYSCTL_HANDLER_ARGS)
char buf[16];
const char *p;
struct da_softc *softc;
int i, error, methods, value;
int i, error, value;

softc = (struct da_softc *)arg1;

Expand All @@ -2324,7 +2323,6 @@ dadeletemethodsysctl(SYSCTL_HANDLER_ARGS)
error = sysctl_handle_string(oidp, buf, sizeof(buf), req);
if (error != 0 || req->newptr == NULL)
return (error);
methods = softc->delete_available | (1 << DA_DELETE_DISABLE);
for (i = 0; i <= DA_DELETE_MAX; i++) {
if (strcmp(buf, da_delete_method_names[i]) == 0)
break;
Expand Down Expand Up @@ -3970,7 +3968,7 @@ dazonedone(struct cam_periph *periph, union ccb *ccb)
struct scsi_report_zones_hdr *hdr;
struct scsi_report_zones_desc *desc;
struct disk_zone_rep_entry *entry;
uint32_t num_alloced, hdr_len, num_avail;
uint32_t hdr_len, num_avail;
uint32_t num_to_fill, i;
int ata;

Expand All @@ -3987,7 +3985,6 @@ dazonedone(struct cam_periph *periph, union ccb *ccb)
* the user.
*/
bp->bio_resid = ccb->csio.resid;
num_alloced = rep->entries_allocated;
hdr = (struct scsi_report_zones_hdr *)ccb->csio.data_ptr;
if (avail_len < sizeof(*hdr)) {
/*
Expand Down
2 changes: 0 additions & 2 deletions sys/cam/scsi/scsi_pass.c
Original file line number Diff line number Diff line change
Expand Up @@ -1699,13 +1699,11 @@ static int
passmemdone(struct cam_periph *periph, struct pass_io_req *io_req)
{
struct pass_softc *softc;
union ccb *ccb;
int error;
int i;

error = 0;
softc = (struct pass_softc *)periph->softc;
ccb = &io_req->ccb;

switch (io_req->data_flags) {
case CAM_DATA_VADDR:
Expand Down
3 changes: 0 additions & 3 deletions sys/dev/al_eth/al_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ al_probe(device_t dev)
static int
al_attach(device_t dev)
{
struct al_eth_lm_context *lm_context;
struct al_eth_adapter *adapter;
struct sysctl_oid_list *child;
struct sysctl_ctx_list *ctx;
Expand Down Expand Up @@ -305,8 +304,6 @@ al_attach(device_t dev)

g_adapters[g_adapters_count] = adapter;

lm_context = &adapter->lm_context;

bar_udma = PCIR_BAR(AL_ETH_UDMA_BAR);
adapter->udma_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
&bar_udma, RF_ACTIVE);
Expand Down
5 changes: 1 addition & 4 deletions sys/dev/axgbe/xgbe-drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget)
struct xgbe_packet_data *packet;
struct ifnet *ifp = pdata->netdev;
struct mbuf *m;
unsigned int incomplete, context_next, context;
unsigned int incomplete, context_next;
unsigned int received = 0;
int packet_count = 0;

Expand Down Expand Up @@ -992,9 +992,6 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget)
context_next = XGMAC_GET_BITS(packet->attributes,
RX_PACKET_ATTRIBUTES,
CONTEXT_NEXT);
context = XGMAC_GET_BITS(packet->attributes,
RX_PACKET_ATTRIBUTES,
CONTEXT);

/* Earlier error, just drain the remaining data */
if (incomplete || context_next) {
Expand Down
6 changes: 0 additions & 6 deletions sys/dev/axgbe/xgbe-mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,36 +752,30 @@ static void xgbe_an_init(struct xgbe_prv_data *pdata)

static void xgbe_phy_adjust_link(struct xgbe_prv_data *pdata)
{
int new_state = 0;

if (pdata->phy.link) {
/* Flow control support */
pdata->pause_autoneg = pdata->phy.pause_autoneg;

if (pdata->tx_pause != pdata->phy.tx_pause) {
new_state = 1;
pdata->hw_if.config_tx_flow_control(pdata);
pdata->tx_pause = pdata->phy.tx_pause;
}

if (pdata->rx_pause != pdata->phy.rx_pause) {
new_state = 1;
pdata->hw_if.config_rx_flow_control(pdata);
pdata->rx_pause = pdata->phy.rx_pause;
}

/* Speed support */
if (pdata->phy_speed != pdata->phy.speed) {
new_state = 1;
pdata->phy_speed = pdata->phy.speed;
}

if (pdata->phy_link != pdata->phy.link) {
new_state = 1;
pdata->phy_link = pdata->phy.link;
}
} else if (pdata->phy_link) {
new_state = 1;
pdata->phy_link = 0;
pdata->phy_speed = SPEED_UNKNOWN;
}
Expand Down
Loading

0 comments on commit c8da6fa

Please sign in to comment.