Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e520f4f4 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "USB: gadget: rndis: Allow reading of 'rx_trigger' attribute value"

parents dceb8c89 fffe6d0f
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -2269,19 +2269,30 @@ static ssize_t rndis_transports_store(struct device *dev,
static DEVICE_ATTR(rndis_transports, S_IRUGO | S_IWUSR, rndis_transports_show,
					       rndis_transports_store);

static ssize_t rndis_rx_trigger_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	bool write = false;
	int rx_trigger = rndis_rx_trigger(write);

	return snprintf(buf, PAGE_SIZE, "%d\n", rx_trigger);
}

static ssize_t rndis_rx_trigger_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t size)
{
	int value;
	bool write = true;

	if (sscanf(buf, "%d", &value) == 1) {
		rndis_rx_trigger();
		rndis_rx_trigger(write);
		return size;
	}
	return -EINVAL;
}

static DEVICE_ATTR(rx_trigger, S_IWUSR, NULL,
static DEVICE_ATTR(rx_trigger, S_IRUGO | S_IWUSR,
					 rndis_rx_trigger_show,
					 rndis_rx_trigger_store);

static ssize_t rndis_pkt_alignment_factor_show(struct device *dev,
+3 −1
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ struct f_rndis {
static struct f_rndis *__rndis;

int
rndis_rx_trigger(void)
rndis_rx_trigger(bool write)
{
	struct f_rndis *rndis = __rndis;

@@ -104,6 +104,8 @@ rndis_rx_trigger(void)
		pr_err("can't set rx trigger\n");
		return -EINVAL;
	}
	if (!write)
		return rndis->port.rx_triggered;

	if (rndis->port.rx_triggered)
		return 0;
+2 −2
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ int eem_bind_config(struct usb_configuration *c, struct eth_dev *dev);

int rndis_bind_config_vendor(struct usb_configuration *c, u8 ethaddr[ETH_ALEN],
		u32 vendorID, const char *manufacturer, struct eth_dev *dev);
int rndis_rx_trigger(void);
int rndis_rx_trigger(bool);

#else

@@ -150,7 +150,7 @@ rndis_bind_config_vendor(struct usb_configuration *c, u8 ethaddr[ETH_ALEN],
}

static inline int
rndis_rx_trigger(void)
rndis_rx_trigger(bool)
{
	return 0;
}