Lines Matching refs:ds

86 	struct dsa_switch *ds = dev_get_drvdata(dev);  in temp1_input_show()  local
89 ret = ds->drv->get_temp(ds, &temp); in temp1_input_show()
100 struct dsa_switch *ds = dev_get_drvdata(dev); in temp1_max_show() local
103 ret = ds->drv->get_temp_limit(ds, &temp); in temp1_max_show()
114 struct dsa_switch *ds = dev_get_drvdata(dev); in temp1_max_store() local
121 ret = ds->drv->set_temp_limit(ds, DIV_ROUND_CLOSEST(temp, 1000)); in temp1_max_store()
132 struct dsa_switch *ds = dev_get_drvdata(dev); in temp1_max_alarm_show() local
136 ret = ds->drv->get_temp_alarm(ds, &alarm); in temp1_max_alarm_show()
155 struct dsa_switch *ds = dev_get_drvdata(dev); in dsa_hwmon_attrs_visible() local
156 struct dsa_switch_driver *drv = ds->drv; in dsa_hwmon_attrs_visible()
179 static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent) in dsa_switch_setup_one() argument
181 struct dsa_switch_driver *drv = ds->drv; in dsa_switch_setup_one()
182 struct dsa_switch_tree *dst = ds->dst; in dsa_switch_setup_one()
183 struct dsa_chip_data *pd = ds->pd; in dsa_switch_setup_one()
185 int index = ds->index; in dsa_switch_setup_one()
208 ds->dsa_port_mask |= 1 << i; in dsa_switch_setup_one()
210 ds->phys_port_mask |= 1 << i; in dsa_switch_setup_one()
223 ds->phys_mii_mask = ds->phys_port_mask; in dsa_switch_setup_one()
231 switch (ds->tag_protocol) { in dsa_switch_setup_one()
259 dst->tag_protocol = ds->tag_protocol; in dsa_switch_setup_one()
265 ret = drv->setup(ds); in dsa_switch_setup_one()
269 ret = drv->set_addr(ds, dst->master_netdev->dev_addr); in dsa_switch_setup_one()
273 ds->slave_mii_bus = mdiobus_alloc(); in dsa_switch_setup_one()
274 if (ds->slave_mii_bus == NULL) { in dsa_switch_setup_one()
278 dsa_slave_mii_bus_init(ds); in dsa_switch_setup_one()
280 ret = mdiobus_register(ds->slave_mii_bus); in dsa_switch_setup_one()
289 if (!(ds->phys_port_mask & (1 << i))) in dsa_switch_setup_one()
292 ret = dsa_slave_create(ds, parent, i, pd->port_names[i]); in dsa_switch_setup_one()
316 scnprintf(ds->hwmon_name, sizeof(ds->hwmon_name), "%s_dsa%d", in dsa_switch_setup_one()
318 ds->hwmon_dev = hwmon_device_register_with_groups(NULL, in dsa_switch_setup_one()
319 ds->hwmon_name, ds, dsa_hwmon_groups); in dsa_switch_setup_one()
320 if (IS_ERR(ds->hwmon_dev)) in dsa_switch_setup_one()
321 ds->hwmon_dev = NULL; in dsa_switch_setup_one()
328 mdiobus_free(ds->slave_mii_bus); in dsa_switch_setup_one()
330 kfree(ds); in dsa_switch_setup_one()
340 struct dsa_switch *ds; in dsa_switch_setup() local
360 ds = kzalloc(sizeof(*ds) + drv->priv_size, GFP_KERNEL); in dsa_switch_setup()
361 if (ds == NULL) in dsa_switch_setup()
364 ds->dst = dst; in dsa_switch_setup()
365 ds->index = index; in dsa_switch_setup()
366 ds->pd = pd; in dsa_switch_setup()
367 ds->drv = drv; in dsa_switch_setup()
368 ds->tag_protocol = drv->tag_protocol; in dsa_switch_setup()
369 ds->master_dev = host_dev; in dsa_switch_setup()
371 ret = dsa_switch_setup_one(ds, parent); in dsa_switch_setup()
375 return ds; in dsa_switch_setup()
378 static void dsa_switch_destroy(struct dsa_switch *ds) in dsa_switch_destroy() argument
381 if (ds->hwmon_dev) in dsa_switch_destroy()
382 hwmon_device_unregister(ds->hwmon_dev); in dsa_switch_destroy()
387 static int dsa_switch_suspend(struct dsa_switch *ds) in dsa_switch_suspend() argument
393 if (!dsa_is_port_initialized(ds, i)) in dsa_switch_suspend()
396 ret = dsa_slave_suspend(ds->ports[i]); in dsa_switch_suspend()
401 if (ds->drv->suspend) in dsa_switch_suspend()
402 ret = ds->drv->suspend(ds); in dsa_switch_suspend()
407 static int dsa_switch_resume(struct dsa_switch *ds) in dsa_switch_resume() argument
411 if (ds->drv->resume) in dsa_switch_resume()
412 ret = ds->drv->resume(ds); in dsa_switch_resume()
419 if (!dsa_is_port_initialized(ds, i)) in dsa_switch_resume()
422 ret = dsa_slave_resume(ds->ports[i]); in dsa_switch_resume()
441 struct dsa_switch *ds = dst->ds[i]; in dsa_link_poll_work() local
443 if (ds != NULL && ds->drv->poll_link != NULL) in dsa_link_poll_work()
444 ds->drv->poll_link(ds); in dsa_link_poll_work()
716 struct dsa_switch *ds; in dsa_setup_dst() local
718 ds = dsa_switch_setup(dst, i, parent, pd->chip[i].host_dev); in dsa_setup_dst()
719 if (IS_ERR(ds)) { in dsa_setup_dst()
721 i, PTR_ERR(ds)); in dsa_setup_dst()
725 dst->ds[i] = ds; in dsa_setup_dst()
726 if (ds->drv->poll_link != NULL) in dsa_setup_dst()
815 struct dsa_switch *ds = dst->ds[i]; in dsa_remove_dst() local
817 if (ds != NULL) in dsa_remove_dst()
818 dsa_switch_destroy(ds); in dsa_remove_dst()
866 struct dsa_switch *ds = dst->ds[i]; in dsa_suspend() local
868 if (ds != NULL) in dsa_suspend()
869 ret = dsa_switch_suspend(ds); in dsa_suspend()
882 struct dsa_switch *ds = dst->ds[i]; in dsa_resume() local
884 if (ds != NULL) in dsa_resume()
885 ret = dsa_switch_resume(ds); in dsa_resume()