Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 102725
b: refs/heads/master
c: b679aeb
h: refs/heads/master
i:
  102723: 5fc774e
v: v3
  • Loading branch information
Javier Cardona authored and John W. Linville committed May 22, 2008
1 parent 3501395 commit 8344239
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: edf5dabfa86163d589041cccf607b41a7033e9b0
refs/heads/master: b679aeb304e3070626750c15e043a40da0e942fc
45 changes: 45 additions & 0 deletions trunk/drivers/net/wireless/libertas/persistcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,49 @@ static ssize_t boottime_set(struct device *dev,
return strlen(buf);
}

/**
* @brief Get function for sysfs attribute channel
*/
static ssize_t channel_get(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct mrvl_mesh_defaults defs;
int ret;

ret = mesh_get_default_parameters(dev, &defs);

if (ret)
return ret;

return snprintf(buf, 12, "0x%x\n", le16_to_cpu(defs.channel));
}

/**
* @brief Set function for sysfs attribute channel
*/
static ssize_t channel_set(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct lbs_private *priv = to_net_dev(dev)->priv;
struct cmd_ds_mesh_config cmd;
uint16_t datum;
int ret;

memset(&cmd, 0, sizeof(cmd));
ret = sscanf(buf, "%hx", &datum);
if (ret != 1 || datum < 1 || datum > 11)
return -EINVAL;

*((__le16 *)&cmd.data[0]) = cpu_to_le16(datum);
cmd.length = cpu_to_le16(sizeof(uint16_t));
ret = lbs_mesh_config_send(priv, &cmd, CMD_ACT_MESH_CONFIG_SET,
CMD_TYPE_MESH_SET_DEF_CHANNEL);
if (ret)
return ret;

return strlen(buf);
}

/**
* @brief Get function for sysfs attribute mesh_id
*/
Expand Down Expand Up @@ -365,6 +408,7 @@ static ssize_t capability_set(struct device *dev, struct device_attribute *attr,

static DEVICE_ATTR(bootflag, 0644, bootflag_get, bootflag_set);
static DEVICE_ATTR(boottime, 0644, boottime_get, boottime_set);
static DEVICE_ATTR(channel, 0644, channel_get, channel_set);
static DEVICE_ATTR(mesh_id, 0644, mesh_id_get, mesh_id_set);
static DEVICE_ATTR(protocol_id, 0644, protocol_id_get, protocol_id_set);
static DEVICE_ATTR(metric_id, 0644, metric_id_get, metric_id_set);
Expand All @@ -373,6 +417,7 @@ static DEVICE_ATTR(capability, 0644, capability_get, capability_set);
static struct attribute *boot_opts_attrs[] = {
&dev_attr_bootflag.attr,
&dev_attr_boottime.attr,
&dev_attr_channel.attr,
NULL
};

Expand Down

0 comments on commit 8344239

Please sign in to comment.