[PATCH 1/2 resend] staging: et131x: Audit and update comments
Many of the functions and variables in the driver have been renamed and are now more understandable, as well as defines added for various constants. Update / remove some comments to reflect this. Also many comments were unnecessary dialogue describing what is evident from the code, or comments were just plain incorrect. Remove these too. Signed-off-by: Mark Einon --- Resending after refresh against current head of staging-next, as previous patch only applied with fuzz. drivers/staging/et131x/et131x.c | 328 +++ 1 file changed, 21 insertions(+), 307 deletions(-) diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index c15eb6e..4973e64 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -293,7 +293,6 @@ struct rx_ring { struct rx_status_block *rx_status_block; dma_addr_t rx_status_bus; - /* RECV */ struct list_head recv_list; u32 num_ready_recv; @@ -363,12 +362,7 @@ struct tx_ring { struct tcb *tcb_qhead; struct tcb *tcb_qtail; - /* list of TCBs that are currently being sent. NOTE that access to all -* three of these (including used) are controlled via the -* TCBSendQLock. This lock should be secured prior to incementing / -* decrementing used, or any queue manipulation on send_head / -* tail -*/ + /* list of TCBs that are currently being sent. */ struct tcb *send_head; struct tcb *send_tail; int used; @@ -420,16 +414,9 @@ struct rfd { /* Struct to define some device statistics */ struct ce_stats { - /* MIB II variables -* -* NOTE: atomic_t types are only guaranteed to store 24-bits; if we -* MUST have 32, then we'll need another way to perform atomic -* operations -*/ u32 multicast_pkts_rcvd; u32 rcvd_pkts_dropped; - /* Tx Statistics. */ u32 tx_underflows; u32 tx_collisions; u32 tx_excessive_collisions; @@ -438,7 +425,6 @@ struct ce_stats { u32 tx_max_pkt_errs; u32 tx_deferred; - /* Rx Statistics. */ u32 rx_overflows; u32 rx_length_errs; u32 rx_align_errs; @@ -504,7 +490,6 @@ struct et131x_adapter { /* Rx Memory Variables */ struct rx_ring rx_ring; - /* Stats */ struct ce_stats stats; }; @@ -519,7 +504,6 @@ static int eeprom_wait_ready(struct pci_dev *pdev, u32 *status) *to 1 prior to starting a single byte read/write */ for (i = 0; i < MAX_NUM_REGISTER_POLLS; i++) { - /* Read registers grouped in DWORD1 */ if (pci_read_config_dword(pdev, LBCIF_DWORD1_GROUP, ®)) return -EIO; @@ -533,13 +517,6 @@ static int eeprom_wait_ready(struct pci_dev *pdev, u32 *status) return -ETIMEDOUT; } -/* eeprom_write - Write a byte to the ET1310's EEPROM - * @adapter: pointer to our private adapter structure - * @addr: the address to write - * @data: the value to write - * - * Returns 1 for a successful write. - */ static int eeprom_write(struct et131x_adapter *adapter, u32 addr, u8 data) { struct pci_dev *pdev = adapter->pdev; @@ -573,7 +550,6 @@ static int eeprom_write(struct et131x_adapter *adapter, u32 addr, u8 data) /* Prepare EEPROM address for Step 3 */ for (retries = 0; retries < MAX_NUM_WRITE_RETRIES; retries++) { - /* Write the address to the LBCIF Address Register */ if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER, addr)) break; /* Write the data to the LBCIF Data Register (the I2C write @@ -621,8 +597,6 @@ static int eeprom_write(struct et131x_adapter *adapter, u32 addr, u8 data) break; } - /* Set bit 6 of the LBCIF Control Register = 0. -*/ udelay(10); while (1) { @@ -651,15 +625,6 @@ static int eeprom_write(struct et131x_adapter *adapter, u32 addr, u8 data) return writeok ? 0 : -EIO; } -/* eeprom_read - Read a byte from the ET1310's EEPROM - * @adapter: pointer to our private adapter structure - * @addr: the address from which to read - * @pdata: a pointer to a byte in which to store the value of the read - * @eeprom_id: the ID of the EEPROM - * @addrmode: how the EEPROM is to be accessed - * - * Returns 1 for a successful read - */ static int eeprom_read(struct et131x_adapter *adapter, u32 addr, u8 *pdata) { struct pci_dev *pdev = adapter->pdev; @@ -696,9 +661,7 @@ static int eeprom_read(struct et131x_adapter *adapter, u32 addr, u8 *pdata) * Register. */ *pdata = err; - /* Check bit 2 of the LBCIF Status Register. If = 1, -* then an error has occurred. -
[PATCH 2/2 resend] staging: et131x: Simplify for loop in et131x_init_send()
The for loop in this function increments two variables and has an unusual starting index of 1 (not 0). Make it look more familiar. Reported-by: Dan Carpenter Signed-off-by: Mark Einon --- drivers/staging/et131x/et131x.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index 4973e64..384dc16 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -1751,7 +1751,7 @@ static void et131x_disable_txrx(struct net_device *netdev) static void et131x_init_send(struct et131x_adapter *adapter) { - u32 ct; + int i; struct tx_ring *tx_ring = &adapter->tx_ring; struct tcb *tcb = tx_ring->tcb_ring; @@ -1759,8 +1759,10 @@ static void et131x_init_send(struct et131x_adapter *adapter) memset(tcb, 0, sizeof(struct tcb) * NUM_TCB); - for (ct = 0; ct++ < NUM_TCB; tcb++) + for (i = 0; i < NUM_TCB; i++) { tcb->next = tcb + 1; + tcb++; + } tcb--; tx_ring->tcb_qtail = tcb; -- 1.7.10.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 0/8] Add of-graph helpers to loop over endpoints and find ports by id
Hi, in theory, I'd like the first five patches to go in together through Grant's tree, but in practice that might not be necessary; changes in of_node reference counting are only relevant if CONFIG_OF_DYNAMIC is enabled. Since patch 2 depends on (or would trivially conflict with) 30e94a564d07 in the staging tree, it might be better to merge this one through staging. What do you think? The three 'use for_each_endpoint_of_node macro in ...' patches can be resent later, separately. This series converts all existing users of of_graph_get_next_endpoint that pass a non-NULL prev argument to the function and decrement its refcount themselves to stop doing that. The of_node_put is moved into of_graph_get_next_endpoint instead. This allows to add a for_each_endpoint_of_node helper macro to loop over all endpoints in a device tree node. The third of patch adds a of_graph_get_port_by_id function to retrieve a port by its known port id from the device tree. Finally, the last three patches convert functions in drm_of.c and imx-drm-core.c to use the for_each_endpoint_of_node macro instead of of_graph_get_next_endpoint. Changes since v3: - Moved of_node_put for the break case after the loop in patch 1 and 8 - Rebased patch 2 on top of 30e94a564d07 (staging: imx-drm: Lines over 80 characters fixed.), which added a blank line in the function we remove, imx_drm_of_get_next_endpoint. The previous version can be found here: https://lkml.org/lkml/2014/9/11/696 regards Philipp Philipp Zabel (8): [media] soc_camera: Do not decrement endpoint node refcount in the loop imx-drm: Do not decrement endpoint node refcount in the loop of: Decrement refcount of previous endpoint in of_graph_get_next_endpoint of: Add for_each_endpoint_of_node helper macro of: Add of_graph_get_port_by_id function drm: use for_each_endpoint_of_node macro in drm_of_find_possible_crtcs imx-drm: use for_each_endpoint_of_node macro in imx_drm_encoder_get_mux_id imx-drm: use for_each_endpoint_of_node macro in imx_drm_encoder_parse_of drivers/gpu/drm/drm_of.c | 8 ++ drivers/media/platform/soc_camera/soc_camera.c | 3 ++- drivers/of/base.c | 35 -- drivers/staging/imx-drm/imx-drm-core.c | 29 ++--- include/linux/of_graph.h | 18 + 5 files changed, 56 insertions(+), 37 deletions(-) -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 2/8] imx-drm: Do not decrement endpoint node refcount in the loop
In preparation for the following patch, stop decrementing the endpoint node refcount in the loop. This temporarily leaks a reference to the endpoint node, which will be fixed by having of_graph_get_next_endpoint decrement the refcount of its prev argument instead. Signed-off-by: Philipp Zabel --- Changes since v3: - Rebased on top of 30e94a564d079f71f53368733720caa0c7c413c8 (staging: imx-drm: Lines over 80 characters fixed.), which added a blank line in imx_drm_of_get_next_endpoint. --- drivers/staging/imx-drm/imx-drm-core.c | 13 ++--- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c index 4289cc8..fab79ad 100644 --- a/drivers/staging/imx-drm/imx-drm-core.c +++ b/drivers/staging/imx-drm/imx-drm-core.c @@ -435,15 +435,6 @@ static uint32_t imx_drm_find_crtc_mask(struct imx_drm_device *imxdrm, return 0; } -static struct device_node *imx_drm_of_get_next_endpoint( - const struct device_node *parent, struct device_node *prev) -{ - struct device_node *node = of_graph_get_next_endpoint(parent, prev); - - of_node_put(prev); - return node; -} - int imx_drm_encoder_parse_of(struct drm_device *drm, struct drm_encoder *encoder, struct device_node *np) { @@ -455,7 +446,7 @@ int imx_drm_encoder_parse_of(struct drm_device *drm, for (i = 0; ; i++) { u32 mask; - ep = imx_drm_of_get_next_endpoint(np, ep); + ep = of_graph_get_next_endpoint(np, ep); if (!ep) break; @@ -503,7 +494,7 @@ int imx_drm_encoder_get_mux_id(struct device_node *node, return -EINVAL; do { - ep = imx_drm_of_get_next_endpoint(node, ep); + ep = of_graph_get_next_endpoint(node, ep); if (!ep) break; -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 4/8] of: Add for_each_endpoint_of_node helper macro
Note that while of_graph_get_next_endpoint decrements the reference count of the child node passed to it, of_node_put(child) still has to be called manually when breaking out of the loop. Signed-off-by: Philipp Zabel Acked-by: Laurent Pinchart --- include/linux/of_graph.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h index befef42..e43442e 100644 --- a/include/linux/of_graph.h +++ b/include/linux/of_graph.h @@ -26,6 +26,17 @@ struct of_endpoint { const struct device_node *local_node; }; +/** + * for_each_endpoint_of_node - iterate over every endpoint in a device node + * @parent: parent device node containing ports and endpoints + * @child: loop variable pointing to the current endpoint node + * + * When breaking out of the loop, of_node_put(child) has to be called manually. + */ +#define for_each_endpoint_of_node(parent, child) \ + for (child = of_graph_get_next_endpoint(parent, NULL); child != NULL; \ +child = of_graph_get_next_endpoint(parent, child)) + #ifdef CONFIG_OF int of_graph_parse_endpoint(const struct device_node *node, struct of_endpoint *endpoint); -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 1/8] [media] soc_camera: Do not decrement endpoint node refcount in the loop
In preparation for a following patch, stop decrementing the endpoint node refcount in the loop. This temporarily leaks a reference to the endpoint node, which will be fixed by having of_graph_get_next_endpoint decrement the refcount of its prev argument instead. Signed-off-by: Philipp Zabel --- Changes since v3: - Moved of_node_put for the break case after the loop --- drivers/media/platform/soc_camera/soc_camera.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index f4308fe..619b2d4 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -1696,7 +1696,6 @@ static void scan_of_host(struct soc_camera_host *ici) if (!i) soc_of_bind(ici, epn, ren->parent); - of_node_put(epn); of_node_put(ren); if (i) { @@ -1704,6 +1703,8 @@ static void scan_of_host(struct soc_camera_host *ici) break; } } + + of_node_put(epn); } #else -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 5/8] of: Add of_graph_get_port_by_id function
This patch adds a function to get a port device tree node by port id, or reg property value. Signed-off-by: Philipp Zabel Acked-by: Laurent Pinchart --- drivers/of/base.c| 26 ++ include/linux/of_graph.h | 7 +++ 2 files changed, 33 insertions(+) diff --git a/drivers/of/base.c b/drivers/of/base.c index a49b5628..76e2651 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -2053,6 +2053,32 @@ int of_graph_parse_endpoint(const struct device_node *node, EXPORT_SYMBOL(of_graph_parse_endpoint); /** + * of_graph_get_port_by_id() - get the port matching a given id + * @parent: pointer to the parent device node + * @id: id of the port + * + * Return: A 'port' node pointer with refcount incremented. The caller + * has to use of_node_put() on it when done. + */ +struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id) +{ + struct device_node *port; + + for_each_child_of_node(node, port) { + u32 port_id = 0; + + if (of_node_cmp(port->name, "port") != 0) + continue; + of_property_read_u32(port, "reg", &port_id); + if (id == port_id) + return port; + } + + return NULL; +} +EXPORT_SYMBOL(of_graph_get_port_by_id); + +/** * of_graph_get_next_endpoint() - get next endpoint node * @parent: pointer to the parent device node * @prev: previous endpoint node, or NULL to get first diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h index e43442e..3c1c95a 100644 --- a/include/linux/of_graph.h +++ b/include/linux/of_graph.h @@ -40,6 +40,7 @@ struct of_endpoint { #ifdef CONFIG_OF int of_graph_parse_endpoint(const struct device_node *node, struct of_endpoint *endpoint); +struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id); struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, struct device_node *previous); struct device_node *of_graph_get_remote_port_parent( @@ -53,6 +54,12 @@ static inline int of_graph_parse_endpoint(const struct device_node *node, return -ENOSYS; } +static inline struct device_node *of_graph_get_port_by_id( + struct device_node *node, u32 id) +{ + return NULL; +} + static inline struct device_node *of_graph_get_next_endpoint( const struct device_node *parent, struct device_node *previous) -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 7/8] imx-drm: use for_each_endpoint_of_node macro in imx_drm_encoder_get_mux_id
Using the for_each_... macro should make the code bit shorter and easier to read. This patch also properly decrements the endpoint node reference count before returning out of the loop. Signed-off-by: Philipp Zabel --- drivers/staging/imx-drm/imx-drm-core.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c index fab79ad..69e7194 100644 --- a/drivers/staging/imx-drm/imx-drm-core.c +++ b/drivers/staging/imx-drm/imx-drm-core.c @@ -493,18 +493,15 @@ int imx_drm_encoder_get_mux_id(struct device_node *node, if (!node || !imx_crtc) return -EINVAL; - do { - ep = of_graph_get_next_endpoint(node, ep); - if (!ep) - break; - + for_each_endpoint_of_node(node, ep) { port = of_graph_get_remote_port(ep); of_node_put(port); if (port == imx_crtc->port) { ret = of_graph_parse_endpoint(ep, &endpoint); + of_node_put(ep); return ret ? ret : endpoint.port; } - } while (ep); + } return -EINVAL; } -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 6/8] drm: use for_each_endpoint_of_node macro in drm_of_find_possible_crtcs
Using the for_each_... macro should make the code a bit shorter and easier to read. Signed-off-by: Philipp Zabel Acked-by: Laurent Pinchart --- drivers/gpu/drm/drm_of.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 16150a0..024fa77 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -46,11 +46,7 @@ uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, struct device_node *remote_port, *ep = NULL; uint32_t possible_crtcs = 0; - do { - ep = of_graph_get_next_endpoint(port, ep); - if (!ep) - break; - + for_each_endpoint_of_node(port, ep) { remote_port = of_graph_get_remote_port(ep); if (!remote_port) { of_node_put(ep); @@ -60,7 +56,7 @@ uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, possible_crtcs |= drm_crtc_port_mask(dev, remote_port); of_node_put(remote_port); - } while (1); + } return possible_crtcs; } -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 3/8] of: Decrement refcount of previous endpoint in of_graph_get_next_endpoint
Decrementing the reference count of the previous endpoint node allows to use the of_graph_get_next_endpoint function in a for_each_... style macro. Prior to this patch, all current users of this function that actually pass a non-NULL prev parameter should be changed to not decrement the passed prev argument's refcount themselves. Signed-off-by: Philipp Zabel Acked-by: Laurent Pinchart --- drivers/of/base.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index d8574ad..a49b5628 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -2058,8 +2058,7 @@ EXPORT_SYMBOL(of_graph_parse_endpoint); * @prev: previous endpoint node, or NULL to get first * * Return: An 'endpoint' node pointer with refcount incremented. Refcount - * of the passed @prev node is not decremented, the caller have to use - * of_node_put() on it when done. + * of the passed @prev node is decremented. */ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, struct device_node *prev) @@ -2095,12 +2094,6 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, if (WARN_ONCE(!port, "%s(): endpoint %s has no parent node\n", __func__, prev->full_name)) return NULL; - - /* -* Avoid dropping prev node refcount to 0 when getting the next -* child below. -*/ - of_node_get(prev); } while (1) { -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 8/8] imx-drm: use for_each_endpoint_of_node macro in imx_drm_encoder_parse_of
Using the for_each_... macro should make the code bit shorter and easier to read. Since we can break out of the loop, we keep the call to of_node_put after the loop. Signed-off-by: Philipp Zabel --- Changes since v3: - Kept of_node_put after the loop, as in the earlier soc_camera patch. This reduces the line count and is safe to do since of_node_put(NULL) is a no-op. --- drivers/staging/imx-drm/imx-drm-core.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c index 69e7194..43285dc 100644 --- a/drivers/staging/imx-drm/imx-drm-core.c +++ b/drivers/staging/imx-drm/imx-drm-core.c @@ -439,17 +439,13 @@ int imx_drm_encoder_parse_of(struct drm_device *drm, struct drm_encoder *encoder, struct device_node *np) { struct imx_drm_device *imxdrm = drm->dev_private; - struct device_node *ep = NULL; + struct device_node *ep; uint32_t crtc_mask = 0; - int i; + int i = 0; - for (i = 0; ; i++) { + for_each_endpoint_of_node(np, ep) { u32 mask; - ep = of_graph_get_next_endpoint(np, ep); - if (!ep) - break; - mask = imx_drm_find_crtc_mask(imxdrm, ep); /* @@ -462,6 +458,7 @@ int imx_drm_encoder_parse_of(struct drm_device *drm, return -EPROBE_DEFER; crtc_mask |= mask; + i++; } of_node_put(ep); -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4 1/8] [media] soc_camera: Do not decrement endpoint node refcount in the loop
On Mon, Sep 29, 2014 at 10:15:44AM +0200, Philipp Zabel wrote: > In preparation for a following patch, stop decrementing the endpoint node > refcount in the loop. This temporarily leaks a reference to the endpoint node, > which will be fixed by having of_graph_get_next_endpoint decrement the > refcount > of its prev argument instead. Don't do this... My understanding (and I haven't invested much time into trying to understand this beyond glancing at the change) is that patch 1 and 2, introduce small bugs that are fixed in patch 3? Just fold all three patches into one patch. We need an Ack from Mauro and Greg and then send the patch through Grant's tree. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
From Daniel Klimowicz
Dear Sir, I am requesting for your help, to assist me in getting £42,000,000.00 to your account. please do indicate your interest for more information's. REPLY ( klimowi...@yahoo.com.hk ) Yours Truly, From Daniel Klimowicz ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4 1/8] [media] soc_camera: Do not decrement endpoint node refcount in the loop
Am Montag, den 29.09.2014, 12:13 +0300 schrieb Dan Carpenter: > On Mon, Sep 29, 2014 at 10:15:44AM +0200, Philipp Zabel wrote: > > In preparation for a following patch, stop decrementing the endpoint node > > refcount in the loop. This temporarily leaks a reference to the endpoint > > node, > > which will be fixed by having of_graph_get_next_endpoint decrement the > > refcount > > of its prev argument instead. > > Don't do this... > > My understanding (and I haven't invested much time into trying to > understand this beyond glancing at the change) is that patch 1 and 2, > introduce small bugs that are fixed in patch 3? > > Just fold all three patches into one patch. We need an Ack from Mauro > and Greg and then send the patch through Grant's tree. Yes. Patches 1 and 2 leak a reference on of_nodes touched by the loop. As far as I am aware, all users of this code don't use the reference counting (CONFIG_OF_DYNAMIC is disabled), so this bug should be theoretical. I'd be happy do as you suggest if Mauro and Greg agree. regards Philipp ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: r8821ae: Remove driver from staging
On 09/29/2014 01:17 AM, Greg KH wrote: On Sun, Sep 28, 2014 at 08:39:51PM -0500, Larry Finger wrote: A new version of this driver has been merged into the wireless-testing tree as commit 21e4b0726dc671c423e2dc9a85364716219c4502. It is both possible and desirable to delete the staging version to avoid build errors in linux-next. Signed-off-by: Larry Finger --- Greg, This removal patch was generated after commit 368c75b98bdfdfad54e7f165016819ef344e3587. It should apply to your tree unless further modifications have been made to the staging driver. Wonderful! So, this should be done for 3.18-rc1, right? Or does wireless-testing take longer to get to Linus than that? Yes, it should be for 3.18-rc1. Sorry that I did not make that more clear. It is also likely that I will be sending a similar delete patch for r8192ee. John has the patch to add a new version to wireless-testing, but has not yet merged it. Larry ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4 1/8] [media] soc_camera: Do not decrement endpoint node refcount in the loop
On Mon, Sep 29, 2014 at 11:45:23AM +0200, Philipp Zabel wrote: > Am Montag, den 29.09.2014, 12:13 +0300 schrieb Dan Carpenter: > > On Mon, Sep 29, 2014 at 10:15:44AM +0200, Philipp Zabel wrote: > > > In preparation for a following patch, stop decrementing the endpoint node > > > refcount in the loop. This temporarily leaks a reference to the endpoint > > > node, > > > which will be fixed by having of_graph_get_next_endpoint decrement the > > > refcount > > > of its prev argument instead. > > > > Don't do this... > > > > My understanding (and I haven't invested much time into trying to > > understand this beyond glancing at the change) is that patch 1 and 2, > > introduce small bugs that are fixed in patch 3? > > > > Just fold all three patches into one patch. We need an Ack from Mauro > > and Greg and then send the patch through Grant's tree. > > Yes. Patches 1 and 2 leak a reference on of_nodes touched by the loop. > As far as I am aware, all users of this code don't use the reference > counting (CONFIG_OF_DYNAMIC is disabled), so this bug should be > theoretical. > > I'd be happy do as you suggest if Mauro and Greg agree. Let's see the correct patch, don't break things and then later on fix them... thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: r8821ae: Remove driver from staging
On Sun, Sep 28, 2014 at 08:39:51PM -0500, Larry Finger wrote: > A new version of this driver has been merged into the wireless-testing tree > as commit 21e4b0726dc671c423e2dc9a85364716219c4502. It is both possible and > desirable to delete the staging version to avoid build errors in linux-next. > > Signed-off-by: Larry Finger > --- > > Greg, > > This removal patch was generated after commit > 368c75b98bdfdfad54e7f165016819ef344e3587. > It should apply to your tree unless further modifications have been made to > the staging driver. Something is odd with this patch, it doesn't apply, even against that commit id: Applying: staging: r8821ae: Remove driver from staging error: patch failed: drivers/staging/rtl8821ae/btcoexist/HalBtc8812a1Ant.c:1 error: drivers/staging/rtl8821ae/btcoexist/HalBtc8812a1Ant.c: patch does not apply Patch failed at 0001 staging: r8821ae: Remove driver from staging The copy of the patch that failed is found in: /home/gregkh/linux/work/staging/.git/rebase-apply/patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". Can you refresh against the staging-next branch of staging.git and try it again? Or I can just delete it "by hand" which is fine with me, and might be easier fro you, just let me know. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v5 0/6] Add of-graph helpers to loop over endpoints and find ports by id
Hi, now the first three patches of the previous series are combined into one. This patch touches of, media, and staging. Since it is rebased onto Grant's tree, it now trivially conflicts with 30e94a564d07 (staging: imx-drm: Lines over 80 characters fixed.) This series converts all existing users of of_graph_get_next_endpoint that pass a non-NULL prev argument to the function and decrement its refcount themselves to stop doing that. The of_node_put is moved into of_graph_get_next_endpoint instead. This allows to add a for_each_endpoint_of_node helper macro to loop over all endpoints in a device tree node. The third of patch adds a of_graph_get_port_by_id function to retrieve a port by its known port id from the device tree. Finally, the last three patches convert functions in drm_of.c and imx-drm-core.c to use the for_each_endpoint_of_node macro instead of of_graph_get_next_endpoint. Changes since v4: - Combined patches 1-3 into one The previous version can be found here: https://lkml.org/lkml/2014/9/29/78 regards Philipp Philipp Zabel (6): of: Decrement refcount of previous endpoint in of_graph_get_next_endpoint of: Add for_each_endpoint_of_node helper macro of: Add of_graph_get_port_by_id function drm: use for_each_endpoint_of_node macro in drm_of_find_possible_crtcs imx-drm: use for_each_endpoint_of_node macro in imx_drm_encoder_get_mux_id imx-drm: use for_each_endpoint_of_node macro in imx_drm_encoder_parse_of drivers/gpu/drm/drm_of.c | 8 ++ drivers/media/platform/soc_camera/soc_camera.c | 3 ++- drivers/of/base.c | 35 -- drivers/staging/imx-drm/imx-drm-core.c | 28 ++--- include/linux/of_graph.h | 18 + 5 files changed, 56 insertions(+), 36 deletions(-) -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v5 3/6] of: Add of_graph_get_port_by_id function
This patch adds a function to get a port device tree node by port id, or reg property value. Signed-off-by: Philipp Zabel Acked-by: Laurent Pinchart --- drivers/of/base.c| 26 ++ include/linux/of_graph.h | 7 +++ 2 files changed, 33 insertions(+) diff --git a/drivers/of/base.c b/drivers/of/base.c index f7a9aa8..e17e534 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -2065,6 +2065,32 @@ int of_graph_parse_endpoint(const struct device_node *node, EXPORT_SYMBOL(of_graph_parse_endpoint); /** + * of_graph_get_port_by_id() - get the port matching a given id + * @parent: pointer to the parent device node + * @id: id of the port + * + * Return: A 'port' node pointer with refcount incremented. The caller + * has to use of_node_put() on it when done. + */ +struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id) +{ + struct device_node *port; + + for_each_child_of_node(node, port) { + u32 port_id = 0; + + if (of_node_cmp(port->name, "port") != 0) + continue; + of_property_read_u32(port, "reg", &port_id); + if (id == port_id) + return port; + } + + return NULL; +} +EXPORT_SYMBOL(of_graph_get_port_by_id); + +/** * of_graph_get_next_endpoint() - get next endpoint node * @parent: pointer to the parent device node * @prev: previous endpoint node, or NULL to get first diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h index e43442e..3c1c95a 100644 --- a/include/linux/of_graph.h +++ b/include/linux/of_graph.h @@ -40,6 +40,7 @@ struct of_endpoint { #ifdef CONFIG_OF int of_graph_parse_endpoint(const struct device_node *node, struct of_endpoint *endpoint); +struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id); struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, struct device_node *previous); struct device_node *of_graph_get_remote_port_parent( @@ -53,6 +54,12 @@ static inline int of_graph_parse_endpoint(const struct device_node *node, return -ENOSYS; } +static inline struct device_node *of_graph_get_port_by_id( + struct device_node *node, u32 id) +{ + return NULL; +} + static inline struct device_node *of_graph_get_next_endpoint( const struct device_node *parent, struct device_node *previous) -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v5 5/6] imx-drm: use for_each_endpoint_of_node macro in imx_drm_encoder_get_mux_id
Using the for_each_... macro should make the code bit shorter and easier to read. This patch also properly decrements the endpoint node reference count before returning out of the loop. Signed-off-by: Philipp Zabel --- drivers/staging/imx-drm/imx-drm-core.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c index 12303b3..9b5222c 100644 --- a/drivers/staging/imx-drm/imx-drm-core.c +++ b/drivers/staging/imx-drm/imx-drm-core.c @@ -493,18 +493,15 @@ int imx_drm_encoder_get_mux_id(struct device_node *node, if (!node || !imx_crtc) return -EINVAL; - do { - ep = of_graph_get_next_endpoint(node, ep); - if (!ep) - break; - + for_each_endpoint_of_node(node, ep) { port = of_graph_get_remote_port(ep); of_node_put(port); if (port == imx_crtc->port) { ret = of_graph_parse_endpoint(ep, &endpoint); + of_node_put(ep); return ret ? ret : endpoint.port; } - } while (ep); + } return -EINVAL; } -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v5 2/6] of: Add for_each_endpoint_of_node helper macro
Note that while of_graph_get_next_endpoint decrements the reference count of the child node passed to it, of_node_put(child) still has to be called manually when breaking out of the loop. Signed-off-by: Philipp Zabel Acked-by: Laurent Pinchart --- include/linux/of_graph.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h index befef42..e43442e 100644 --- a/include/linux/of_graph.h +++ b/include/linux/of_graph.h @@ -26,6 +26,17 @@ struct of_endpoint { const struct device_node *local_node; }; +/** + * for_each_endpoint_of_node - iterate over every endpoint in a device node + * @parent: parent device node containing ports and endpoints + * @child: loop variable pointing to the current endpoint node + * + * When breaking out of the loop, of_node_put(child) has to be called manually. + */ +#define for_each_endpoint_of_node(parent, child) \ + for (child = of_graph_get_next_endpoint(parent, NULL); child != NULL; \ +child = of_graph_get_next_endpoint(parent, child)) + #ifdef CONFIG_OF int of_graph_parse_endpoint(const struct device_node *node, struct of_endpoint *endpoint); -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v5 4/6] drm: use for_each_endpoint_of_node macro in drm_of_find_possible_crtcs
Using the for_each_... macro should make the code a bit shorter and easier to read. Signed-off-by: Philipp Zabel Acked-by: Laurent Pinchart --- drivers/gpu/drm/drm_of.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 16150a0..024fa77 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -46,11 +46,7 @@ uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, struct device_node *remote_port, *ep = NULL; uint32_t possible_crtcs = 0; - do { - ep = of_graph_get_next_endpoint(port, ep); - if (!ep) - break; - + for_each_endpoint_of_node(port, ep) { remote_port = of_graph_get_remote_port(ep); if (!remote_port) { of_node_put(ep); @@ -60,7 +56,7 @@ uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, possible_crtcs |= drm_crtc_port_mask(dev, remote_port); of_node_put(remote_port); - } while (1); + } return possible_crtcs; } -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v5 6/6] imx-drm: use for_each_endpoint_of_node macro in imx_drm_encoder_parse_of
Using the for_each_... macro should make the code bit shorter and easier to read. Since we can break out of the loop, we keep the call to of_node_put after the loop. Signed-off-by: Philipp Zabel --- drivers/staging/imx-drm/imx-drm-core.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c index 9b5222c..8f2a802 100644 --- a/drivers/staging/imx-drm/imx-drm-core.c +++ b/drivers/staging/imx-drm/imx-drm-core.c @@ -438,17 +438,13 @@ int imx_drm_encoder_parse_of(struct drm_device *drm, struct drm_encoder *encoder, struct device_node *np) { struct imx_drm_device *imxdrm = drm->dev_private; - struct device_node *ep = NULL; + struct device_node *ep; uint32_t crtc_mask = 0; - int i; + int i = 0; - for (i = 0; ; i++) { + for_each_endpoint_of_node(np, ep) { u32 mask; - ep = of_graph_get_next_endpoint(np, ep); - if (!ep) - break; - mask = imx_drm_find_crtc_mask(imxdrm, ep); /* @@ -461,6 +457,7 @@ int imx_drm_encoder_parse_of(struct drm_device *drm, return -EPROBE_DEFER; crtc_mask |= mask; + i++; } if (ep) -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v5 1/6] of: Decrement refcount of previous endpoint in of_graph_get_next_endpoint
Decrementing the reference count of the previous endpoint node allows to use the of_graph_get_next_endpoint function in a for_each_... style macro. All current users of this function that pass a non-NULL prev parameter (that is, soc_camera and imx-drm) are changed to not decrement the passed prev argument's refcount themselves. Signed-off-by: Philipp Zabel --- Changes since v4: - Folded patches 1-3 into this one --- drivers/media/platform/soc_camera/soc_camera.c | 3 ++- drivers/of/base.c | 9 + drivers/staging/imx-drm/imx-drm-core.c | 12 ++-- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index f4308fe..619b2d4 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -1696,7 +1696,6 @@ static void scan_of_host(struct soc_camera_host *ici) if (!i) soc_of_bind(ici, epn, ren->parent); - of_node_put(epn); of_node_put(ren); if (i) { @@ -1704,6 +1703,8 @@ static void scan_of_host(struct soc_camera_host *ici) break; } } + + of_node_put(epn); } #else diff --git a/drivers/of/base.c b/drivers/of/base.c index 293ed4b..f7a9aa8 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -2070,8 +2070,7 @@ EXPORT_SYMBOL(of_graph_parse_endpoint); * @prev: previous endpoint node, or NULL to get first * * Return: An 'endpoint' node pointer with refcount incremented. Refcount - * of the passed @prev node is not decremented, the caller have to use - * of_node_put() on it when done. + * of the passed @prev node is decremented. */ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, struct device_node *prev) @@ -2107,12 +2106,6 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, if (WARN_ONCE(!port, "%s(): endpoint %s has no parent node\n", __func__, prev->full_name)) return NULL; - - /* -* Avoid dropping prev node refcount to 0 when getting the next -* child below. -*/ - of_node_get(prev); } while (1) { diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c index 6b22106..12303b3 100644 --- a/drivers/staging/imx-drm/imx-drm-core.c +++ b/drivers/staging/imx-drm/imx-drm-core.c @@ -434,14 +434,6 @@ static uint32_t imx_drm_find_crtc_mask(struct imx_drm_device *imxdrm, return 0; } -static struct device_node *imx_drm_of_get_next_endpoint( - const struct device_node *parent, struct device_node *prev) -{ - struct device_node *node = of_graph_get_next_endpoint(parent, prev); - of_node_put(prev); - return node; -} - int imx_drm_encoder_parse_of(struct drm_device *drm, struct drm_encoder *encoder, struct device_node *np) { @@ -453,7 +445,7 @@ int imx_drm_encoder_parse_of(struct drm_device *drm, for (i = 0; ; i++) { u32 mask; - ep = imx_drm_of_get_next_endpoint(np, ep); + ep = of_graph_get_next_endpoint(np, ep); if (!ep) break; @@ -502,7 +494,7 @@ int imx_drm_encoder_get_mux_id(struct device_node *node, return -EINVAL; do { - ep = imx_drm_of_get_next_endpoint(node, ep); + ep = of_graph_get_next_endpoint(node, ep); if (!ep) break; -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: r8821ae: Remove driver from staging
On 09/29/2014 12:05 PM, Greg KH wrote: On Sun, Sep 28, 2014 at 08:39:51PM -0500, Larry Finger wrote: A new version of this driver has been merged into the wireless-testing tree as commit 21e4b0726dc671c423e2dc9a85364716219c4502. It is both possible and desirable to delete the staging version to avoid build errors in linux-next. Signed-off-by: Larry Finger --- Greg, This removal patch was generated after commit 368c75b98bdfdfad54e7f165016819ef344e3587. It should apply to your tree unless further modifications have been made to the staging driver. Something is odd with this patch, it doesn't apply, even against that commit id: Applying: staging: r8821ae: Remove driver from staging error: patch failed: drivers/staging/rtl8821ae/btcoexist/HalBtc8812a1Ant.c:1 error: drivers/staging/rtl8821ae/btcoexist/HalBtc8812a1Ant.c: patch does not apply Patch failed at 0001 staging: r8821ae: Remove driver from staging The copy of the patch that failed is found in: /home/gregkh/linux/work/staging/.git/rebase-apply/patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". Can you refresh against the staging-next branch of staging.git and try it again? Or I can just delete it "by hand" which is fine with me, and might be easier fro you, just let me know. I was on the staging-next branch, but when I pulled after receiving this mail, I got a conflict due to some change in drivers/staging/rtl8821ae/pci.c. That one must have been in your local copy, but not yet pushed when I pulled. If you don't mind doing the delete there, the traffic on the Cc sites will be reduced. I'm sure you know what is needed, but just in case, delete the files in drivers/staging/rtl8821ae/ and the Makefile and Kconfig entries in drivers/staging/. Thanks, Larry Larry ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: gdm72xx: fix coding style
This patch remove a checkstyle warning in netlink_k.c. Note: This is my homework of the day. Signed-off-by: Thibaut Robert --- drivers/staging/gdm72xx/netlink_k.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/staging/gdm72xx/netlink_k.c b/drivers/staging/gdm72xx/netlink_k.c index 9bf00e6..0a5831a 100644 --- a/drivers/staging/gdm72xx/netlink_k.c +++ b/drivers/staging/gdm72xx/netlink_k.c @@ -147,12 +147,11 @@ int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len) if (!ret) { return len; - } else { - if (ret != -ESRCH) { - pr_err("netlink_broadcast g=%d, t=%d, l=%d, r=%d\n", - group, type, len, ret); - } - ret = 0; } - return ret; + + if (ret != -ESRCH) { + pr_err("netlink_broadcast g=%d, t=%d, l=%d, r=%d\n", + group, type, len, ret); + } + return 0; } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net 1/1 V2] hyperv: Fix a bug in netvsc_start_xmit()
On Sun, Sep 28, 2014 at 10:16:43PM -0700, K. Y. Srinivasan wrote: > After the packet is successfully sent, we should not touch the skb > as it may have been freed. This patch is based on the work done by > Long Li . > > In this version of the patch I have fixed issues pointed out by David. > David, please queue this up for stable. This patch resolves the following panic I privately reported to KY on September 3rd 2014: BUG: unable to handle kernel paging request at 8800edeb8068 IP: [] netvsc_start_xmit+0x6ac/0x7c0 PGD 2db0067 PUD 2075be067 PMD 20744e067 PTE 8000edeb8060 Oops: [#1] SMP DEBUG_PAGEALLOC CPU: 0 PID: 3 Comm: ksoftirqd/0 Not tainted 3.17.0-rc2.x86_64-00099-g92578ea #139 Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS 090006 05/23/2012 task: 8801fb1b1350 ti: 8801fb248000 task.ti: 8801fb248000 RIP: 0010:[] [] netvsc_start_xmit+0x6ac/0x7c0 RSP: 0018:8801fb24b808 EFLAGS: 00010246 RAX: RBX: 8800efb437c8 RCX: 0007f000 RDX: 000782a0 RSI: e880 RDI: 0007eee8 RBP: 8801fb24b850 R08: R09: R10: 0001 R11: 0001 R12: R13: 8800edeb8000 R14: 8800f11b22a0 R15: 8800efb47d0e FS: () GS:880206c0() knlGS: CS: 0010 DS: ES: CR0: 80050033 CR2: 8800edeb8068 CR3: 0001f6d3d000 CR4: 000406f0 Stack: 8800efb43834 0042 8800f11b22a0 81d23300 0042 8800f11b22a0 0002 8801f4866a60 8800edeb8000 8801fb24b8a8 815ce528 8800f1164f40 Call Trace: [] dev_hard_start_xmit+0x348/0x630 [] sch_direct_xmit+0x7a/0x290 [] __dev_queue_xmit+0x30c/0x690 [] ? __dev_queue_xmit+0x58/0x690 [] dev_queue_xmit+0x10/0x20 [] ip_finish_output+0xaa7/0xc70 [] ? ip_output+0x98/0xf0 [] ip_output+0x98/0xf0 [] ip_local_out_sk+0x71/0xa0 [] ip_queue_xmit+0x38a/0x480 [] ? ip_queue_xmit+0x5/0x480 [] tcp_transmit_skb+0x7e9/0x880 [] tcp_send_ack+0x117/0x120 [] __tcp_ack_snd_check+0x58/0xc0 [] tcp_rcv_established+0x3f2/0x6e0 [] tcp_v4_do_rcv+0xb4/0x350 [] tcp_v4_rcv+0x631/0xc30 [] ? ip_local_deliver_finish+0x40/0x2d0 [] ip_local_deliver_finish+0x158/0x2d0 [] ? ip_local_deliver_finish+0x40/0x2d0 [] ip_local_deliver+0x51/0x90 [] ip_rcv_finish+0x3ae/0x480 [] ip_rcv+0x31c/0x3a0 [] __netif_receive_skb_core+0x681/0x790 [] ? __netif_receive_skb_core+0xac/0x790 [] __netif_receive_skb+0x57/0x80 [] process_backlog+0xca/0x190 [] net_rx_action+0x88/0x210 [] __do_softirq+0x183/0x320 [] run_ksoftirqd+0x29/0x80 [] smpboot_thread_fn+0x1e7/0x210 [] ? schedule+0x65/0x70 [] ? in_egroup_p+0x40/0x40 [] kthread+0xf8/0x100 [] ? __kthread_unpark+0x50/0x50 [] ret_from_fork+0x7c/0xb0 [] ? __kthread_unpark+0x50/0x50 Code: 4b f2 ff ff 41 01 c6 44 39 7d d4 7f c2 44 89 73 58 4c 8b 75 c8 48 89 de 49 8b be 40 0a 00 00 e8 8b 11 00 00 85 c0 41 89 c4 75 1c <41> 8b 45 68 49 83 86 10 01 00 00 01 49 01 86 20 01 00 00 eb 3f RIP [] netvsc_start_xmit+0x6ac/0x7c0 RSP CR2: 8800edeb8068 ---[ end trace 62e7c6df1a71f4a8 ]--- Kernel panic - not syncing: Fatal exception in interrupt Kernel Offset: 0x0 from 0x8100 (relocation range: 0x8000-0x9fff) ---[ end Kernel panic - not syncing: Fatal exception in interrupt So Tested-by: Sitsofe Wheeler But I'm still seeing oopses like the following: BUG: unable to handle kernel paging request at 8800ec0b9073 IP: [] netvsc_select_queue+0x53/0x160 PGD 2db3067 PUD 2075be067 PMD 20745d067 PTE 8000ec0b9060 Oops: [#1] SMP DEBUG_PAGEALLOC CPU: 6 PID: 556 Comm: arping Not tainted 3.17.0-rc7.x86_64-00012-gb6beb72-dirty #145 Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS 090006 05/23/2012 task: 8801f3619350 ti: 8801f99ac000 task.ti: 8801f99ac000 RIP: 0010:[] [] netvsc_select_queue+0x53/0x160 RSP: 0018:8801f99afc60 EFLAGS: 00010202 RAX: RBX: 8800f1231160 RCX: RDX: 8800ec0a9068 RSI: 8801f357f3c0 RDI: 8800f1231160 RBP: 8801f99afc88 R08: 002a R09: R10: 8800f12333d8 R11: 0008 R12: 8801f357f3c0 R13: R14: 8801f97b6f60 R15: 8801f357f3c0 FS: 7fb7a6fbb740() GS:880206cc() knlGS: CS: 0010 DS: ES: CR0: 80050033 CR2: 8800ec0b9073 CR3: 0001f3518000 CR4: 000406e0 Stack: 81698f81 8800f1231160 001c 8801f97b6f60 8801f99afd48 8169ccec 8801f99afcb0 816bbf87 0001 8801f99afdb8 001c Call Trace: [] ? packet_pick_tx_queue+0x31/0xa0 [] packet_sendmsg+0xc1c/0xdd0 [] ? _raw_spin_unlock+0x27/0x40 [] ? prepare_creds+0x3a/0x170 [] sock_sendmsg+0x88/0xb0 [] ? might_fault+0xa3/0xb0 [] ? might_fault+0x5a/
Re: [PATCH] Staging: gdm72xx: fix coding style
On Mon, 2014-09-29 at 20:15 +0200, Thibaut Robert wrote: > This patch remove a checkstyle warning in netlink_k.c. > Note: This is my homework of the day. The "Note: " line isn't useful for a commit message. Neither is the checkpatch warning bit. Maybe the commit message could be something like: "Remove unnecessary else after return". > diff --git a/drivers/staging/gdm72xx/netlink_k.c > b/drivers/staging/gdm72xx/netlink_k.c [] > @@ -147,12 +147,11 @@ int netlink_send(struct sock *sock, int group, u16 > type, void *msg, int len) > > if (!ret) { > return len; > - } else { > - if (ret != -ESRCH) { > - pr_err("netlink_broadcast g=%d, t=%d, l=%d, r=%d\n", > -group, type, len, ret); > - } > - ret = 0; > } > - return ret; > + > + if (ret != -ESRCH) { > + pr_err("netlink_broadcast g=%d, t=%d, l=%d, r=%d\n", > +group, type, len, ret); > + } OK, but you don't need the braces around the pr_err. My preference is to also fix the typo in the function and would be something like: --- drivers/staging/gdm72xx/netlink_k.c | 23 ++- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/staging/gdm72xx/netlink_k.c b/drivers/staging/gdm72xx/netlink_k.c index 9bf00e6..43d2a49 100644 --- a/drivers/staging/gdm72xx/netlink_k.c +++ b/drivers/staging/gdm72xx/netlink_k.c @@ -120,9 +120,9 @@ int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len) struct nlmsghdr *nlh; int ret = 0; - if (group > ND_MAX_GROUP) { - pr_err("Group %d is invalied.\n", group); - pr_err("Valid group is 0 ~ %d.\n", ND_MAX_GROUP); + if (group < 0 || group > ND_MAX_GROUP) { + pr_err("Invalid group %d (valid groups are 0 to %d)\n", + group, ND_MAX_GROUP); return -EINVAL; } @@ -144,15 +144,12 @@ int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len) NETLINK_CB(skb).dst_group = 0; ret = netlink_broadcast(sock, skb, 0, group+1, GFP_ATOMIC); - - if (!ret) { + if (!ret) return len; - } else { - if (ret != -ESRCH) { - pr_err("netlink_broadcast g=%d, t=%d, l=%d, r=%d\n", - group, type, len, ret); - } - ret = 0; - } - return ret; + + if (ret != -ESRCH) + pr_err("netlink_broadcast g=%d, t=%d, l=%d, r=%d\n", + group, type, len, ret); + + return 0; } ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/1] staging : android : sync : get_unused_fd
Hi, Le samedi 27 septembre 2014 à 10:52 +0200, Heinrich Schuchardt a écrit : > sync.h recommends to use get_unused_fd which does not set > O_CLOEXEC while the rest of the android tree uses > get_unused_fd_flags and sets O_CLOEXEC. > > The patch adjust the comment. > I'd like to add this patch to my patchset which try to remove get_unused_fd() in favor of get_unused_fd_flags(): http://lkml.kernel.org/r/cover.1411562410.git.ydrone...@opteya.com But having O_CLOEXEC is welcome but not strictly needed, so I think the patch should be reworked to not require O_CLOEXEC. > Signed-off-by: Heinrich Schuchardt > --- > drivers/staging/android/sync.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h > index 66b0f43..a21b79f 100644 > --- a/drivers/staging/android/sync.h > +++ b/drivers/staging/android/sync.h > @@ -293,7 +293,8 @@ void sync_fence_put(struct sync_fence *fence); > * @fence: fence to install > * @fd: file descriptor in which to install the fence > * > - * Installs @fence into @fd. @fd's should be acquired through > get_unused_fd(). > + * Installs @fence into @fd. @fd's should be acquired through > + * get_unused_fd_flags(O_CLOEXEC). I think it will be better to have something like: get_unused_fd_flags(flags), with flags either provided by userspace or set to O_CLOEXEC. > */ > void sync_fence_install(struct sync_fence *fence, int fd); > Regards. -- Yann Droneaud OPTEYA ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Aw: Re: [PATCH 1/1] staging : android : sync : get_unused_fd
> Gesendet: Montag, 29. September 2014 um 20:03 Uhr > Von: "Yann Droneaud" > An: "Heinrich Schuchardt" > Cc: "Greg Kroah-Hartman" , "Colin Cross" > , "John Stultz" , "Daniel Vetter" > , "Sumit Semwal" , "Masanari Iida" > , "Daeseok Youn" , "Maarten > Lankhorst" , de...@driverdev.osuosl.org, > linux-ker...@vger.kernel.org, "Yann Droneaud" > Betreff: Re: [PATCH 1/1] staging : android : sync : get_unused_fd > > Hi, > > Le samedi 27 septembre 2014 à 10:52 +0200, Heinrich Schuchardt a écrit : > > sync.h recommends to use get_unused_fd which does not set > > O_CLOEXEC while the rest of the android tree uses > > get_unused_fd_flags and sets O_CLOEXEC. > > > > The patch adjust the comment. > > > > I'd like to add this patch to my patchset which try to remove > get_unused_fd() in favor of get_unused_fd_flags(): > > http://lkml.kernel.org/r/cover.1411562410.git.ydrone...@opteya.com > > But having O_CLOEXEC is welcome but not strictly needed, > so I think the patch should be reworked to not require O_CLOEXEC. All calls to get_unused_fd_flags() in directory drivers/staging/android use O_CLOEXEC. That is why I guess it is correct to put it into the sync.h comment too. Your patch set inspired me to look for further usages of get_unused_fd(). But I think the patch below is valid even if get_unused_fd() should not be removed from the kernel. Best regards Heinrich > > > Signed-off-by: Heinrich Schuchardt > > --- > > drivers/staging/android/sync.h | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h > > index 66b0f43..a21b79f 100644 > > --- a/drivers/staging/android/sync.h > > +++ b/drivers/staging/android/sync.h > > @@ -293,7 +293,8 @@ void sync_fence_put(struct sync_fence *fence); > > * @fence: fence to install > > * @fd:file descriptor in which to install the fence > > * > > - * Installs @fence into @fd. @fd's should be acquired through > > get_unused_fd(). > > + * Installs @fence into @fd. @fd's should be acquired through > > + * get_unused_fd_flags(O_CLOEXEC). > > I think it will be better to have something like: > > get_unused_fd_flags(flags), with flags either provided by userspace > or set to O_CLOEXEC. > > > > */ > > void sync_fence_install(struct sync_fence *fence, int fd); > > > > Regards. > > -- > Yann Droneaud > OPTEYA > > > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: r8821ae: Remove driver from staging
On Mon, Sep 29, 2014 at 01:08:21PM -0500, Larry Finger wrote: > On 09/29/2014 12:05 PM, Greg KH wrote: > >On Sun, Sep 28, 2014 at 08:39:51PM -0500, Larry Finger wrote: > >>A new version of this driver has been merged into the wireless-testing tree > >>as commit 21e4b0726dc671c423e2dc9a85364716219c4502. It is both possible and > >>desirable to delete the staging version to avoid build errors in linux-next. > >> > >>Signed-off-by: Larry Finger > >>--- > >> > >>Greg, > >> > >>This removal patch was generated after commit > >>368c75b98bdfdfad54e7f165016819ef344e3587. > >>It should apply to your tree unless further modifications have been made to > >>the staging driver. > > > >Something is odd with this patch, it doesn't apply, even against that > >commit id: > >Applying: staging: r8821ae: Remove driver from staging > >error: patch failed: drivers/staging/rtl8821ae/btcoexist/HalBtc8812a1Ant.c:1 > >error: drivers/staging/rtl8821ae/btcoexist/HalBtc8812a1Ant.c: patch does not > >apply > >Patch failed at 0001 staging: r8821ae: Remove driver from staging > >The copy of the patch that failed is found in: > >/home/gregkh/linux/work/staging/.git/rebase-apply/patch > >When you have resolved this problem, run "git am --continue". > >If you prefer to skip this patch, run "git am --skip" instead. > >To restore the original branch and stop patching, run "git am --abort". > > > >Can you refresh against the staging-next branch of staging.git and try it > >again? Or I can just delete it "by hand" which is fine with me, and might be > >easier fro you, just let me know. > > I was on the staging-next branch, but when I pulled after receiving this > mail, I got a conflict due to some change in > drivers/staging/rtl8821ae/pci.c. That one must have been in your local copy, > but not yet pushed when I pulled. > > If you don't mind doing the delete there, the traffic on the Cc sites will > be reduced. I'm sure you know what is needed, but just in case, delete the > files in drivers/staging/rtl8821ae/ and the Makefile and Kconfig entries in > drivers/staging/. Great, I've done this now in the staging-next tree, it will be merged for 3.18-rc1. Thanks for doing this work. greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v5 1/6] of: Decrement refcount of previous endpoint in of_graph_get_next_endpoint
On Mon, Sep 29, 2014 at 08:03:34PM +0200, Philipp Zabel wrote: > Decrementing the reference count of the previous endpoint node allows to > use the of_graph_get_next_endpoint function in a for_each_... style macro. > All current users of this function that pass a non-NULL prev parameter > (that is, soc_camera and imx-drm) are changed to not decrement the passed > prev argument's refcount themselves. > > Signed-off-by: Philipp Zabel > --- > Changes since v4: > - Folded patches 1-3 into this one > --- > drivers/media/platform/soc_camera/soc_camera.c | 3 ++- > drivers/of/base.c | 9 + > drivers/staging/imx-drm/imx-drm-core.c | 12 ++-- > 3 files changed, 5 insertions(+), 19 deletions(-) No objection from me for this, but Grant is in "charge" of drivers/of/base.c, so I'll leave it for him to apply. Acked-by: Greg Kroah-Hartman thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: skein: Fixed Conditional white space problems
> >I'll be looking to see that no object > code has changed (./scripts/objdiff) across your patch series. Hmm... I'm thinking of digging into it, but I'm not sure the #if's can be gotten rid of sans object code changes, since its picking codeblocks in the precompiler stage, right? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: skein: Fixed Conditional white space problems
Eric, On Mon, Sep 29, 2014 at 07:40:11PM -0500, Eric Rost wrote: > > >I'll be looking to see that no object > > code has changed (./scripts/objdiff) across your patch series. > > Hmm... I'm thinking of digging into it, but I'm not sure the #if's can > be gotten rid of sans object code changes, since its picking codeblocks > in the precompiler stage, right? You just have to remain consistent with what's currently being selected. But yes, you are correct. And don't get yourself too tied up in knots wrt objdiff-perfection. I would take a look at what Joe Perches posted as a starting point. I haven't reviewed it in depth yet as I'm wrapped around the axle with other commitments. If you get stuck, just ask. A *little* beating your head against the wall is part of the learning process, a lot is just unnecessary frustration. wrt to this code, we don't necessarily need to see the macros and such removed. First step, get them out of the middle of functions. Second step, decide which would be better off as static inline functions. The rest may be able to go into a common include. thx, Jason. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net 1/1 V2] hyperv: Fix a bug in netvsc_start_xmit()
From: "K. Y. Srinivasan" Date: Sun, 28 Sep 2014 22:16:43 -0700 > After the packet is successfully sent, we should not touch the skb > as it may have been freed. This patch is based on the work done by > Long Li . > > In this version of the patch I have fixed issues pointed out by David. > David, please queue this up for stable. > > Signed-off-by: K. Y. Srinivasan > Tested-by: Long Li Applied and queued up for -stable. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 0/4] staging: skein: Fixes whitespace warnings
This patchset reorganizes skein_block.c to move macro definitions out of functions, fixes whitspace issues, and removes the need for the #if'd for loops. Eric Rost (4): drivers: staging: skein: Whitespace cleanup drivers: staging: skein: Additional Whitespace Issues drivers: staging: skein: In progress drivers: staging: skein: File Reorg drivers/staging/skein/skein_block.c | 933 +++ 1 file changed, 500 insertions(+), 433 deletions(-) -- 1.7.10.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 1/4] staging: skein: Whitespace cleanup
Pretties up multiline #defines and many other whitespace issues Signed-off-by: Eric Rost --- drivers/staging/skein/skein_block.c | 585 +++ 1 file changed, 315 insertions(+), 270 deletions(-) diff --git a/drivers/staging/skein/skein_block.c b/drivers/staging/skein/skein_block.c index 616364f..d49709c 100644 --- a/drivers/staging/skein/skein_block.c +++ b/drivers/staging/skein/skein_block.c @@ -26,15 +26,18 @@ #define SKEIN_LOOP 001 /* default: unroll 256 and 512, but not 1024 */ #endif -#define BLK_BITS(WCNT*64) /* some useful definitions for code here */ +#define BLK_BITS(WCNT * 64) /* some useful definitions for code here */ #define KW_TWK_BASE (0) #define KW_KEY_BASE (3) #define ks (kw + KW_KEY_BASE) #define ts (kw + KW_TWK_BASE) #ifdef SKEIN_DEBUG -#define debug_save_tweak(ctx) { \ - ctx->h.tweak[0] = ts[0]; ctx->h.tweak[1] = ts[1]; } +#define debug_save_tweak(ctx) \ +{ \ + ctx->h.tweak[0] = ts[0];\ + ctx->h.tweak[1] = ts[1];\ +} #else #define debug_save_tweak(ctx) #endif @@ -43,15 +46,15 @@ #if !(SKEIN_USE_ASM & 256) void skein_256_process_block(struct skein_256_ctx *ctx, const u8 *blk_ptr, size_t blk_cnt, size_t byte_cnt_add) - { /* do it in C */ +{ /* do it in C */ enum { WCNT = SKEIN_256_STATE_WORDS }; #undef RCNT -#define RCNT (SKEIN_256_ROUNDS_TOTAL/8) +#define RCNT (SKEIN_256_ROUNDS_TOTAL / 8) #ifdef SKEIN_LOOP /* configure how much to unroll the loop */ -#define SKEIN_UNROLL_256 (((SKEIN_LOOP)/100)%10) +#define SKEIN_UNROLL_256 (((SKEIN_LOOP) / 100) % 10) #else #define SKEIN_UNROLL_256 (0) #endif @@ -96,7 +99,8 @@ void skein_256_process_block(struct skein_256_ctx *ctx, const u8 *blk_ptr, debug_save_tweak(ctx); skein_show_block(BLK_BITS, &ctx->h, ctx->x, blk_ptr, w, ks, ts); - X0 = w[0] + ks[0]; /* do the first full key injection */ + /* do the first full key injection */ + X0 = w[0] + ks[0]; X1 = w[1] + ks[1] + ts[0]; X2 = w[2] + ks[2] + ts[1]; X3 = w[3] + ks[3]; @@ -109,29 +113,34 @@ void skein_256_process_block(struct skein_256_ctx *ctx, const u8 *blk_ptr, /* run the rounds */ -#define ROUND256(p0, p1, p2, p3, ROT, r_num) \ -do { \ - X##p0 += X##p1; X##p1 = rotl_64(X##p1, ROT##_0); X##p1 ^= X##p0; \ - X##p2 += X##p3; X##p3 = rotl_64(X##p3, ROT##_1); X##p3 ^= X##p2; \ +#define ROUND256(p0, p1, p2, p3, ROT, r_num) \ +do { \ + X##p0 += X##p1; \ + X##p1 = rotl_64(X##p1, ROT##_0); \ + X##p1 ^= X##p0; \ + X##p2 += X##p3; \ + X##p3 = rotl_64(X##p3, ROT##_1); \ + X##p3 ^= X##p2; \ } while (0) #if SKEIN_UNROLL_256 == 0 #define R256(p0, p1, p2, p3, ROT, r_num) /* fully unrolled */ \ -do { \ - ROUND256(p0, p1, p2, p3, ROT, r_num); \ - skein_show_r_ptr(BLK_BITS, &ctx->h, r_num, X_ptr); \ +do { \ + ROUND256(p0, p1, p2, p3, ROT, r_num); \ + skein_show_r_ptr(BLK_BITS, &ctx->h, r_num, X_ptr);\ } while (0) -#define I256(R) \ -do { \ - /* inject the key schedule value */ \ - X0 += ks[((R)+1) % 5]; \ - X1 += ks[((R)+2) % 5] + ts[((R)+1) % 3]; \ - X2 += ks[((R)+3) % 5] + ts[((R)+2) % 3]; \ - X3 += ks[((R)+4) % 5] + (R)+1; \ +#define I256(R) \ +do { \ + /* inject the key schedule value */ \ + X0 += ks[((R) + 1) % 5];\ + X1 += ks[((R) + 2) % 5] + ts[((R) + 1) % 3];\ + X2 += ks[((R) + 3) % 5] + ts[((R) + 2) % 3];\ + X3 += ks[((R) + 4) % 5] + (R) + 1; \ skein_show_r_ptr(BLK_BITS, &ctx->h, SKEIN_RND_KEY_INJECT, X_ptr); \ } while (0) -#else /* looping version */ +#else +/* looping version */ #define R256(p0, p1, p2, p3, ROT, r_num) \ do { \ ROUND256(p0, p1, p2, p3, ROT, r_num); \ @@ -141,85 +150,85 @@ do { \ #define I256(R) \ do { \ /* inject the key schedule value */ \ - X0 += ks[r+(R)+0]; \ - X1 += ks[r+(R)+1] + ts[r+(R)+0]; \ - X2 += ks[r+(R)+2] + ts[r+(R)+1]; \ - X3 += ks[r+(R)+3] +r+(R);\ - /* rotate key schedule */ \ - ks[r + (R) + 4] = ks[r + (R) - 1]; \ - ts[r + (R) + 2] = ts[r + (R) - 1]; \ + X0 += ks[r + (R) + 0]; \ + X1 += ks[r + (R) + 1] +
[PATCH v2 2/4] staging: skein: Additional Whitespace Issues
Fixes leading and trailing whitespace issues. Signed-off-by: Eric Rost --- drivers/staging/skein/skein_block.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/skein/skein_block.c b/drivers/staging/skein/skein_block.c index d49709c..71c14f5 100644 --- a/drivers/staging/skein/skein_block.c +++ b/drivers/staging/skein/skein_block.c @@ -36,7 +36,7 @@ #define debug_save_tweak(ctx) \ { \ ctx->h.tweak[0] = ts[0];\ - ctx->h.tweak[1] = ts[1];\ + ctx->h.tweak[1] = ts[1];\ } #else #define debug_save_tweak(ctx) @@ -139,7 +139,7 @@ do { \ X3 += ks[((R) + 4) % 5] + (R) + 1; \ skein_show_r_ptr(BLK_BITS, &ctx->h, SKEIN_RND_KEY_INJECT, X_ptr); \ } while (0) -#else +#else /* looping version */ #define R256(p0, p1, p2, p3, ROT, r_num) \ do { \ @@ -531,20 +531,20 @@ void skein_1024_process_block(struct skein_1024_ctx *ctx, const u8 *blk_ptr, #ifdef SKEIN_DEBUG const u64 *X_ptr[16]; /* use for debugging (help cc put Xn in regs) */ - X_ptr[0] = &X00; - X_ptr[1] = &X01; + X_ptr[0] = &X00; + X_ptr[1] = &X01; X_ptr[2] = &X02; - X_ptr[3] = &X03; - X_ptr[4] = &X04; + X_ptr[3] = &X03; + X_ptr[4] = &X04; X_ptr[5] = &X05; - X_ptr[6] = &X06; - X_ptr[7] = &X07; + X_ptr[6] = &X06; + X_ptr[7] = &X07; X_ptr[8] = &X08; - X_ptr[9] = &X09; - X_ptr[10] = &X10; + X_ptr[9] = &X09; + X_ptr[10] = &X10; X_ptr[11] = &X11; - X_ptr[12] = &X12; - X_ptr[13] = &X13; + X_ptr[12] = &X12; + X_ptr[13] = &X13; X_ptr[14] = &X14; X_ptr[15] = &X15; #endif @@ -589,7 +589,7 @@ void skein_1024_process_block(struct skein_1024_ctx *ctx, const u8 *blk_ptr, skein_show_block(BLK_BITS, &ctx->h, ctx->x, blk_ptr, w, ks, ts); /* do the first full key injection */ - X00 = w[0] + ks[0]; + X00 = w[0] + ks[0]; X01 = w[1] + ks[1]; X02 = w[2] + ks[2]; X03 = w[3] + ks[3]; @@ -614,7 +614,7 @@ void skein_1024_process_block(struct skein_1024_ctx *ctx, const u8 *blk_ptr, do { \ X##p0 += X##p1; \ X##p1 = rotl_64(X##p1, ROT##_0); \ - X##p1 ^= X##p0; \ + X##p1 ^= X##p0; \ X##p2 += X##p3; \ X##p3 = rotl_64(X##p3, ROT##_1); \ X##p3 ^= X##p2; \ -- 1.7.10.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 3/4] staging: skein: In progress changes
In progress commit Signed-off-by: Eric Rost --- drivers/staging/skein/skein_block.c | 132 +++ 1 file changed, 70 insertions(+), 62 deletions(-) diff --git a/drivers/staging/skein/skein_block.c b/drivers/staging/skein/skein_block.c index 71c14f5..b8e4bd8 100644 --- a/drivers/staging/skein/skein_block.c +++ b/drivers/staging/skein/skein_block.c @@ -42,17 +42,9 @@ #define debug_save_tweak(ctx) #endif -/* SKEIN_256 **/ #if !(SKEIN_USE_ASM & 256) -void skein_256_process_block(struct skein_256_ctx *ctx, const u8 *blk_ptr, -size_t blk_cnt, size_t byte_cnt_add) -{ /* do it in C */ - enum { - WCNT = SKEIN_256_STATE_WORDS - }; #undef RCNT #define RCNT (SKEIN_256_ROUNDS_TOTAL / 8) - #ifdef SKEIN_LOOP /* configure how much to unroll the loop */ #define SKEIN_UNROLL_256 (((SKEIN_LOOP) / 100) % 10) #else @@ -63,56 +55,7 @@ void skein_256_process_block(struct skein_256_ctx *ctx, const u8 *blk_ptr, #if (RCNT % SKEIN_UNROLL_256) #error "Invalid SKEIN_UNROLL_256" /* sanity check on unroll count */ #endif - size_t r; - u64 kw[WCNT+4+RCNT*2]; /* key schedule: chaining vars + tweak + "rot"*/ -#else - u64 kw[WCNT+4]; /* key schedule words : chaining vars + tweak */ #endif - u64 X0, X1, X2, X3; /* local copy of context vars, for speed */ - u64 w[WCNT]; /* local copy of input block */ -#ifdef SKEIN_DEBUG - const u64 *X_ptr[4]; /* use for debugging (help cc put Xn in regs) */ - - X_ptr[0] = &X0; X_ptr[1] = &X1; X_ptr[2] = &X2; X_ptr[3] = &X3; -#endif - skein_assert(blk_cnt != 0); /* never call with blk_cnt == 0! */ - ts[0] = ctx->h.tweak[0]; - ts[1] = ctx->h.tweak[1]; - do { - /* -* this implementation only supports 2**64 input bytes -* (no carry out here) -*/ - ts[0] += byte_cnt_add; /* update processed length */ - - /* precompute the key schedule for this block */ - ks[0] = ctx->x[0]; - ks[1] = ctx->x[1]; - ks[2] = ctx->x[2]; - ks[3] = ctx->x[3]; - ks[4] = ks[0] ^ ks[1] ^ ks[2] ^ ks[3] ^ SKEIN_KS_PARITY; - - ts[2] = ts[0] ^ ts[1]; - - /* get input block in little-endian format */ - skein_get64_lsb_first(w, blk_ptr, WCNT); - debug_save_tweak(ctx); - skein_show_block(BLK_BITS, &ctx->h, ctx->x, blk_ptr, w, ks, ts); - - /* do the first full key injection */ - X0 = w[0] + ks[0]; - X1 = w[1] + ks[1] + ts[0]; - X2 = w[2] + ks[2] + ts[1]; - X3 = w[3] + ks[3]; - - /* show starting state values */ - skein_show_r_ptr(BLK_BITS, &ctx->h, SKEIN_RND_KEY_INITIAL, -x_ptr); - - blk_ptr += SKEIN_256_BLOCK_BYTES; - - /* run the rounds */ - #define ROUND256(p0, p1, p2, p3, ROT, r_num) \ do { \ X##p0 += X##p1; \ @@ -159,10 +102,7 @@ do { \ ts[r + (R) + 2] = ts[r + (R) - 1];\ skein_show_r_ptr(BLK_BITS, &ctx->h, SKEIN_RND_KEY_INJECT, X_ptr); \ } while (0) - - for (r = 1; r < 2 * RCNT; r += 2 * SKEIN_UNROLL_256) #endif - { #define R256_8_ROUNDS(R) \ do { \ R256(0, 1, 2, 3, R_256_0, 8 * (R) + 1); \ @@ -177,13 +117,81 @@ do { \ I256(2 * (R) + 1); \ } while (0) - R256_8_ROUNDS(0); - #define R256_UNROLL_R(NN) \ ((SKEIN_UNROLL_256 == 0 &&\ SKEIN_256_ROUNDS_TOTAL / 8 > (NN)) || \ (SKEIN_UNROLL_256 > (NN))) +#endif + + +/* SKEIN_256 **/ +#if !(SKEIN_USE_ASM & 256) +void skein_256_process_block(struct skein_256_ctx *ctx, const u8 *blk_ptr, +size_t blk_cnt, size_t byte_cnt_add) +{ /* do it in C */ + enum { + WCNT = SKEIN_256_STATE_WORDS + }; + +#if SKEIN_UNROLL_256 + size_t r; + u64 kw[WCNT+4+RCNT*2]; /* key schedule: chaining vars + tweak + "rot"*/ +#else + u64 kw[WCNT+4]; /* key schedule words : chaining vars + tweak */ +#endif + u64 X0, X1, X2, X3; /* local copy of context vars, for speed */ + u64 w[WCNT]; /* local copy of input block */ +#ifdef SKEIN_DEBUG + const u64 *X_ptr[4]; /* use for debugging (help cc put Xn in regs) */ + + X_ptr[0] = &X0; X_ptr[1] = &X1; X_ptr[2] = &X2; X_ptr[3] = &X3; +#endif + skein_assert(blk_cnt != 0); /* never call with blk_cnt == 0! */ + ts
[PATCH v2 4/4] staging: skein: File Reorg
Reorganizes file to remove #defines from middle of functions. Also removes #if'd loop declarations and adds ternary if driven loops. Signed-off-by: Eric Rost --- drivers/staging/skein/skein_block.c | 568 ++- 1 file changed, 291 insertions(+), 277 deletions(-) diff --git a/drivers/staging/skein/skein_block.c b/drivers/staging/skein/skein_block.c index b8e4bd8..88bc718 100644 --- a/drivers/staging/skein/skein_block.c +++ b/drivers/staging/skein/skein_block.c @@ -122,8 +122,248 @@ do { \ SKEIN_256_ROUNDS_TOTAL / 8 > (NN)) || \ (SKEIN_UNROLL_256 > (NN))) +#if (SKEIN_UNROLL_256 > 14) +#error "need more unrolling in skein_256_process_block" +#endif +#endif + +#if !(SKEIN_USE_ASM & 512) +#undef RCNT +#define RCNT (SKEIN_512_ROUNDS_TOTAL/8) + +#ifdef SKEIN_LOOP /* configure how much to unroll the loop */ +#define SKEIN_UNROLL_512 (((SKEIN_LOOP)/10)%10) +#else +#define SKEIN_UNROLL_512 (0) +#endif + +#if SKEIN_UNROLL_512 +#if (RCNT % SKEIN_UNROLL_512) +#error "Invalid SKEIN_UNROLL_512" /* sanity check on unroll count */ +#endif +#endif +#define ROUND512(p0, p1, p2, p3, p4, p5, p6, p7, ROT, r_num) \ +do { \ + X##p0 += X##p1; \ + X##p1 = rotl_64(X##p1, ROT##_0); \ + X##p1 ^= X##p0; \ + X##p2 += X##p3; \ + X##p3 = rotl_64(X##p3, ROT##_1); \ + X##p3 ^= X##p2; \ + X##p4 += X##p5; \ + X##p5 = rotl_64(X##p5, ROT##_2); \ + X##p5 ^= X##p4; \ + X##p6 += X##p7; X##p7 = rotl_64(X##p7, ROT##_3); \ + X##p7 ^= X##p6; \ +} while (0) + +#if SKEIN_UNROLL_512 == 0 +#define R512(p0, p1, p2, p3, p4, p5, p6, p7, ROT, r_num) /* unrolled */ \ +do {\ + ROUND512(p0, p1, p2, p3, p4, p5, p6, p7, ROT, r_num)\ + skein_show_r_ptr(BLK_BITS, &ctx->h, r_num, X_ptr); \ +} while (0) + +#define I512(R) \ +do { \ + /* inject the key schedule value */ \ + X0 += ks[((R) + 1) % 9];\ + X1 += ks[((R) + 2) % 9];\ + X2 += ks[((R) + 3) % 9];\ + X3 += ks[((R) + 4) % 9];\ + X4 += ks[((R) + 5) % 9];\ + X5 += ks[((R) + 6) % 9] + ts[((R) + 1) % 3];\ + X6 += ks[((R) + 7) % 9] + ts[((R) + 2) % 3];\ + X7 += ks[((R) + 8) % 9] + (R) + 1; \ + skein_show_r_ptr(BLK_BITS, &ctx->h, SKEIN_RND_KEY_INJECT, X_ptr); \ +} while (0) + +#else /* looping version */ +#define R512(p0, p1, p2, p3, p4, p5, p6, p7, ROT, r_num) \ +do { \ + ROUND512(p0, p1, p2, p3, p4, p5, p6, p7, ROT, r_num);\ + skein_show_r_ptr(BLK_BITS, &ctx->h, 4 * (r - 1) + r_num, X_ptr); \ +} while (0) + +#define I512(R) \ +do { \ + /* inject the key schedule value */ \ + X0 += ks[r + (R) + 0]; \ + X1 += ks[r + (R) + 1]; \ + X2 += ks[r + (R) + 2]; \ + X3 += ks[r + (R) + 3]; \ + X4 += ks[r + (R) + 4]; \ + X5 += ks[r + (R) + 5] + ts[r + (R) + 0];\ + X6 += ks[r + (R) + 6] + ts[r + (R) + 1];\ + X7 += ks[r + (R) + 7] + r + (R);\ + /* rotate key schedule */ \ + ks[r + (R) + 8] = ks[r + (R) - 1];\ + ts[r + (R) + 2] = ts[r + (R) - 1];\ + skein_show_r_ptr(BLK_BITS, &ctx->h, SKEIN_RND_KEY_INJECT, X_ptr); \ +} while (0) +#endif /* end of looped code definitions */ +#define R512_8_ROUNDS(R) /* do 8 full rounds */ \ +do { \ + R512(0, 1, 2, 3, 4, 5, 6, 7, R
Re: [PATCH v2 2/4] staging: skein: Additional Whitespace Issues
On Tue, 2014-09-30 at 01:10 -0500, Eric Rost wrote: > Fixes leading and trailing whitespace issues. [] > diff --git a/drivers/staging/skein/skein_block.c > b/drivers/staging/skein/skein_block.c [] > @@ -36,7 +36,7 @@ > #define debug_save_tweak(ctx) \ > { \ > ctx->h.tweak[0] = ts[0];\ > - ctx->h.tweak[1] = ts[1];\ > + ctx->h.tweak[1] = ts[1];\ I know it's an extra step to reintegrate these, but please don't introduce whitespace problems in patch 1 that you fix in patch 2. Do it correctly in patch 1. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 0/3] staging: skein: checkpatch.pl warnings
Fixes the follwoing checkpatch.pl warnings: WARNING: suspect code indent for conditional statements (16, 16) + for (r = 1; r < 2 * RCNT; r += 2 * SKEIN_UNROLL_512) [...] + { WARNING: suspect code indent for conditional statements (16, 16) + for (r = 1; r <= 2 * RCNT; r += 2 * SKEIN_UNROLL_1024) [...] + { Eric Rost (3): staging: skein: Whitespace cleanup drivers: staging: skein: In progress drivers: staging: skein: File Reorg drivers/staging/skein/skein_block.c | 933 +++ 1 file changed, 500 insertions(+), 433 deletions(-) -- 1.7.10.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel