// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright 1998-2009 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
/* * There can only be one set of these, so there's no point in having * them be dynamically allocated...
*/ #define VIAFB_NUM_I2C 5 staticstruct via_i2c_stuff via_i2c_par[VIAFB_NUM_I2C]; staticstruct viafb_dev *i2c_vdev; /* Passed in from core */
/* * Allow other viafb subdevices to look up a specific adapter * by port name.
*/ struct i2c_adapter *viafb_find_i2c_adapter(enum viafb_i2c_adap which)
{ struct via_i2c_stuff *stuff = &via_i2c_par[which];
for (i = 0; i < VIAFB_NUM_PORTS; i++) { struct via_port_cfg *adap_cfg = configs++; struct via_i2c_stuff *i2c_stuff = &via_i2c_par[i];
i2c_stuff->is_active = 0; if (adap_cfg->type == 0 || adap_cfg->mode != VIA_MODE_I2C) continue;
ret = create_i2c_bus(&i2c_stuff->adapter,
&i2c_stuff->algo, adap_cfg,
NULL); /* FIXME: PCIDEV */ if (ret < 0) {
printk(KERN_ERR "viafb: cannot create i2c bus %u:%d\n",
i, ret); continue; /* Still try to make the rest */
}
i2c_stuff->is_active = 1;
}
return 0;
}
staticvoid viafb_i2c_remove(struct platform_device *platdev)
{ int i;
for (i = 0; i < VIAFB_NUM_PORTS; i++) { struct via_i2c_stuff *i2c_stuff = &via_i2c_par[i]; /* * Only remove those entries in the array that we've * actually used (and thus initialized algo_data)
*/ if (i2c_stuff->is_active)
i2c_del_adapter(&i2c_stuff->adapter);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.