[PATCH] x86/hyperv: Restrict get_vtl to only VTL platforms
For non VTL platforms vtl is always 0, and there is no need of get_vtl function. For VTL platforms get_vtl should always succeed and should return the correct VTL. Signed-off-by: Saurabh Sengar --- arch/x86/hyperv/hv_init.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c index 783ed339f341..e589c240565a 100644 --- a/arch/x86/hyperv/hv_init.c +++ b/arch/x86/hyperv/hv_init.c @@ -416,8 +416,8 @@ static u8 __init get_vtl(void) if (hv_result_success(ret)) { ret = output->as64.low & HV_X64_VTL_MASK; } else { - pr_err("Failed to get VTL(%lld) and set VTL to zero by default.\n", ret); - ret = 0; + pr_err("Failed to get VTL(error: %lld) exiting...\n", ret); + BUG(); } local_irq_restore(flags); @@ -604,8 +604,10 @@ void __init hyperv_init(void) hv_query_ext_cap(0); /* Find the VTL */ - if (!ms_hyperv.paravisor_present && hv_isolation_type_snp()) + if (IS_ENABLED(CONFIG_HYPERV_VTL_MODE)) ms_hyperv.vtl = get_vtl(); + else + ms_hyperv.vtl = 0; return; -- 2.34.1
[PATCH] drm: adding SDI to drm_connector_enum_list
adding SDI to drm connector list Signed-off-by: Saurabh Sengar --- drivers/gpu/drm/drm_connector.c | 1 + include/uapi/drm/drm_mode.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 2db7fb5..ea48ddb 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -86,6 +86,7 @@ static struct drm_conn_prop_enum_list drm_connector_enum_list[] = { { DRM_MODE_CONNECTOR_VIRTUAL, "Virtual" }, { DRM_MODE_CONNECTOR_DSI, "DSI" }, { DRM_MODE_CONNECTOR_DPI, "DPI" }, + { DRM_MODE_CONNECTOR_SDI, "SDI" }, }; void drm_connector_ida_init(void) diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h index df0e350..9b8d204 100644 --- a/include/uapi/drm/drm_mode.h +++ b/include/uapi/drm/drm_mode.h @@ -247,6 +247,7 @@ struct drm_mode_get_encoder { #define DRM_MODE_CONNECTOR_VIRTUAL 15 #define DRM_MODE_CONNECTOR_DSI 16 #define DRM_MODE_CONNECTOR_DPI 17 +#define DRM_MODE_CONNECTOR_SDI 18 struct drm_mode_get_connector { -- 2.7.4
drm/edid: api to register cea modes if no edid supported
Adding drm_add_modes_noedid_cea API for supporting cea modes for drm devices which does not have panel framework or edid support. Protocols like SDI whic have minimal support in linux kernel can benifit from this. There is already a API drm_add_modes_noedid, but that supports only dmt modes. Signed-off-by: Saurabh Sengar --- drivers/gpu/drm/drm_edid.c | 48 ++ include/drm/drm_edid.h | 2 ++ 2 files changed, 50 insertions(+) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index ec77bd3..08cfd9d 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -4110,6 +4110,54 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid) EXPORT_SYMBOL(drm_add_edid_modes); /** + * drm_add_modes_noedid_cea - add cea modes for the connectors without EDID + * @connector: connector we're probing + * @hdisplay: the horizontal display limit + * @vdisplay: the vertical display limit + * + * Add the cea modes to the connector's mode list. Only when the + * hdisplay/vdisplay is not beyond the given limit, it will be added. + * + * Return: The number of modes added or 0 if we couldn't find any. + */ +int drm_add_modes_noedid_cea(struct drm_connector *connector, + int hdisplay, int vdisplay) +{ + int i, count, num_modes = 0; + struct drm_display_mode *mode; + struct drm_device *dev = connector->dev; + + count = ARRAY_SIZE(edid_cea_modes); + if (hdisplay < 0) + hdisplay = 0; + if (vdisplay < 0) + vdisplay = 0; + + for (i = 0; i < count; i++) { + const struct drm_display_mode *ptr = &edid_cea_modes[i]; + if (hdisplay && vdisplay) { + /* +* Only when two are valid, they will be used to check +* whether the mode should be added to the mode list of +* the connector. +*/ + if (ptr->hdisplay > hdisplay || + ptr->vdisplay > vdisplay) + continue; + } + if (drm_mode_vrefresh(ptr) > 61) + continue; + mode = drm_mode_duplicate(dev, ptr); + if (mode) { + drm_mode_probed_add(connector, mode); + num_modes++; + } + } + return num_modes; +} +EXPORT_SYMBOL(drm_add_modes_noedid_cea); + +/** * drm_add_modes_noedid - add modes for the connectors without EDID * @connector: connector we're probing * @hdisplay: the horizontal display limit diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index c3a7d44..67f4c26 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -445,6 +445,8 @@ bool drm_detect_monitor_audio(struct edid *edid); bool drm_rgb_quant_range_selectable(struct edid *edid); int drm_add_modes_noedid(struct drm_connector *connector, int hdisplay, int vdisplay); +int drm_add_modes_noedid_cea(struct drm_connector *connector, +int hdisplay, int vdisplay); void drm_set_preferred_mode(struct drm_connector *connector, int hpref, int vpref); -- 2.1.1
[PATCH] usb: host: pci_quirks: fix memory leak, by adding iounmap
Added iounmap inorder to free memory mapped to pointer before returning Signed-off-by: Saurabh Sengar --- drivers/usb/host/pci-quirks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 26cb8c8..35af362 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -992,7 +992,7 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev) if ((ext_cap_offset + sizeof(val)) > len) { /* We're reading garbage from the controller */ dev_warn(&pdev->dev, "xHCI controller failing to respond"); - return; + goto iounmap; } val = readl(base + ext_cap_offset); @@ -1055,6 +1055,7 @@ hc_init: XHCI_MAX_HALT_USEC, val); } +iounmap: iounmap(base); } -- 1.9.1
[PATCH] QE: making cpm_muram_alloc_common into static
as cpm_muram_alloc_common is used only in this file, making it static Signed-off-by: Saurabh Sengar --- drivers/soc/fsl/qe/qe_common.c | 66 +- include/soc/fsl/qe/qe.h| 2 -- 2 files changed, 33 insertions(+), 35 deletions(-) diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c index 419fa5b..e18159a 100644 --- a/drivers/soc/fsl/qe/qe_common.c +++ b/drivers/soc/fsl/qe/qe_common.c @@ -103,6 +103,39 @@ out_muram: } /* + * cpm_muram_alloc_common - cpm_muram_alloc common code + * @size: number of bytes to allocate + * @algo: algorithm for alloc. + * @data: data for genalloc's algorithm. + * + * This function returns an offset into the muram area. + */ +static unsigned long cpm_muram_alloc_common(unsigned long size, + genpool_algo_t algo, void *data) +{ + struct muram_block *entry; + unsigned long start; + + start = gen_pool_alloc_algo(muram_pool, size, algo, data); + if (!start) + goto out2; + start = start - GENPOOL_OFFSET; + memset_io(cpm_muram_addr(start), 0, size); + entry = kmalloc(sizeof(*entry), GFP_KERNEL); + if (!entry) + goto out1; + entry->start = start; + entry->size = size; + list_add(&entry->head, &muram_block_list); + + return start; +out1: + gen_pool_free(muram_pool, start, size); +out2: + return (unsigned long)-ENOMEM; +} + +/* * cpm_muram_alloc - allocate the requested size worth of multi-user ram * @size: number of bytes to allocate * @align: requested alignment, in bytes @@ -175,39 +208,6 @@ unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size) } EXPORT_SYMBOL(cpm_muram_alloc_fixed); -/* - * cpm_muram_alloc_common - cpm_muram_alloc common code - * @size: number of bytes to allocate - * @algo: algorithm for alloc. - * @data: data for genalloc's algorithm. - * - * This function returns an offset into the muram area. - */ -unsigned long cpm_muram_alloc_common(unsigned long size, genpool_algo_t algo, -void *data) -{ - struct muram_block *entry; - unsigned long start; - - start = gen_pool_alloc_algo(muram_pool, size, algo, data); - if (!start) - goto out2; - start = start - GENPOOL_OFFSET; - memset_io(cpm_muram_addr(start), 0, size); - entry = kmalloc(sizeof(*entry), GFP_KERNEL); - if (!entry) - goto out1; - entry->start = start; - entry->size = size; - list_add(&entry->head, &muram_block_list); - - return start; -out1: - gen_pool_free(muram_pool, start, size); -out2: - return (unsigned long)-ENOMEM; -} - /** * cpm_muram_addr - turn a muram offset into a virtual address * @offset: muram offset to convert diff --git a/include/soc/fsl/qe/qe.h b/include/soc/fsl/qe/qe.h index c7fa36c..33b29ea 100644 --- a/include/soc/fsl/qe/qe.h +++ b/include/soc/fsl/qe/qe.h @@ -103,8 +103,6 @@ int cpm_muram_init(void); unsigned long cpm_muram_alloc(unsigned long size, unsigned long align); int cpm_muram_free(unsigned long offset); unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size); -unsigned long cpm_muram_alloc_common(unsigned long size, genpool_algo_t algo, -void *data); void __iomem *cpm_muram_addr(unsigned long offset); unsigned long cpm_muram_offset(void __iomem *addr); dma_addr_t cpm_muram_dma(void __iomem *addr); -- 1.9.1
[PATCH] QE: Use GFP_ATOMIC while spin_lock_irqsave is held
cpm_muram_alloc_common is called twice and both the times spin_lock_irqsave is held. Using GFP_KERNEL can sleep in spin_lock_irqsave context and cause deadlock Signed-off-by: Saurabh Sengar --- Let me know if there is any other way to fix it. Also, I would say this function should be static as it is not used in any other file drivers/soc/fsl/qe/qe_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c index 419fa5b..d774e54 100644 --- a/drivers/soc/fsl/qe/qe_common.c +++ b/drivers/soc/fsl/qe/qe_common.c @@ -194,7 +194,7 @@ unsigned long cpm_muram_alloc_common(unsigned long size, genpool_algo_t algo, goto out2; start = start - GENPOOL_OFFSET; memset_io(cpm_muram_addr(start), 0, size); - entry = kmalloc(sizeof(*entry), GFP_KERNEL); + entry = kmalloc(sizeof(*entry), GFP_ATOMIC); if (!entry) goto out1; entry->start = start; -- 1.9.1
Re: [PATCH] dma: Revert "dmaengine: mic_x100: add missing spin_unlock"
On 23 December 2015 at 09:05, Ashutosh Dixit wrote: > This reverts commit e958e079e254 ("dmaengine: mic_x100: add missing > spin_unlock"). > > The above patch is incorrect. There is nothing wrong with the original > code. The spin_lock is acquired in the "prep" functions and released > in "submit". Hi Ashutosh, If it is need to be released by submit function, we don't require the spin_unlock on success case as well. am I correct ? > Signed-off-by: Ashutosh Dixit > --- > drivers/dma/mic_x100_dma.c | 15 +-- > 1 file changed, 5 insertions(+), 10 deletions(-) > > diff --git a/drivers/dma/mic_x100_dma.c b/drivers/dma/mic_x100_dma.c > index cddfa8d..068e920 100644 > --- a/drivers/dma/mic_x100_dma.c > +++ b/drivers/dma/mic_x100_dma.c > @@ -317,7 +317,6 @@ mic_dma_prep_memcpy_lock(struct dma_chan *ch, dma_addr_t > dma_dest, > struct mic_dma_chan *mic_ch = to_mic_dma_chan(ch); > struct device *dev = mic_dma_ch_to_device(mic_ch); > int result; > - struct dma_async_tx_descriptor *tx = NULL; > > if (!len && !flags) > return NULL; > @@ -325,13 +324,10 @@ mic_dma_prep_memcpy_lock(struct dma_chan *ch, > dma_addr_t dma_dest, > spin_lock(&mic_ch->prep_lock); > result = mic_dma_do_dma(mic_ch, flags, dma_src, dma_dest, len); > if (result >= 0) > - tx = allocate_tx(mic_ch); > - > - if (!tx) > - dev_err(dev, "Error enqueueing dma, error=%d\n", result); > - > + return allocate_tx(mic_ch); > + dev_err(dev, "Error enqueueing dma, error=%d\n", result); > spin_unlock(&mic_ch->prep_lock); This spin_unlock shouldn't be required as explained it is getting released by submit function > - return tx; > + return NULL; > } > > static struct dma_async_tx_descriptor * > @@ -339,14 +335,13 @@ mic_dma_prep_interrupt_lock(struct dma_chan *ch, > unsigned long flags) > { > struct mic_dma_chan *mic_ch = to_mic_dma_chan(ch); > int ret; > - struct dma_async_tx_descriptor *tx = NULL; > > spin_lock(&mic_ch->prep_lock); > ret = mic_dma_do_dma(mic_ch, flags, 0, 0, 0); > if (!ret) > - tx = allocate_tx(mic_ch); > + return allocate_tx(mic_ch); > spin_unlock(&mic_ch->prep_lock); and this too ? > - return tx; > + return NULL; > } > > /* Return the status of the transaction */ > -- > 2.0.0.rc3.2.g998f840 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] NFC: added the rx delay parameter for nfcsim workqueue
added the rx delay parameter as a device tunable parameter. Signed-off-by: Saurabh Sengar --- This is a follow up patch after the review comments by Samuel Ortiz on the initial patch. Below is the link to original patch which implemented this parameter as sysfs entry: https://lkml.org/lkml/2015/12/20/118 drivers/nfc/nfcsim.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/nfc/nfcsim.c b/drivers/nfc/nfcsim.c index 26ac9e5..93aaca5 100644 --- a/drivers/nfc/nfcsim.c +++ b/drivers/nfc/nfcsim.c @@ -32,6 +32,8 @@ #define NFCSIM_POLL_TARGET 2 #define NFCSIM_POLL_DUAL (NFCSIM_POLL_INITIATOR | NFCSIM_POLL_TARGET) +#define RX_DEFAULT_DELAY 5 + struct nfcsim { struct nfc_dev *nfc_dev; @@ -51,6 +53,8 @@ struct nfcsim { u8 initiator; + u32 rx_delay; + data_exchange_cb_t cb; void *cb_context; @@ -320,10 +324,9 @@ static int nfcsim_tx(struct nfc_dev *nfc_dev, struct nfc_target *target, * If packet transmission occurs immediately between them, we have a * non-stop flow of several tens of thousands SYMM packets per second * and a burning cpu. -* -* TODO: Add support for a sysfs entry to control this delay. */ - queue_delayed_work(wq, &peer->recv_work, msecs_to_jiffies(5)); + queue_delayed_work(wq, &peer->recv_work, + msecs_to_jiffies(dev->rx_delay)); mutex_unlock(&peer->lock); @@ -461,6 +464,7 @@ static struct nfcsim *nfcsim_init_dev(void) if (rc) goto free_nfc_dev; + dev->rx_delay = RX_DEFAULT_DELAY; return dev; free_nfc_dev: -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RESEND PATCH] NFC: added the sysfs entry for nfcsim workqueue delay
added the sysfs entry for nfcsim workqueue delay, as tx_delay Signed-off-by: Saurabh Sengar --- In case this TODO is not expected to be done, please let me know. I wonder after my repeated attempts since last 50 days, I am not able to get a single response. Resending this patch in hope to get some response this time. drivers/nfc/nfcsim.c | 38 +++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/drivers/nfc/nfcsim.c b/drivers/nfc/nfcsim.c index 26ac9e5..e77be35 100644 --- a/drivers/nfc/nfcsim.c +++ b/drivers/nfc/nfcsim.c @@ -32,6 +32,8 @@ #define NFCSIM_POLL_TARGET 2 #define NFCSIM_POLL_DUAL (NFCSIM_POLL_INITIATOR | NFCSIM_POLL_TARGET) +#define TX_DEFAULT_DELAY 5 + struct nfcsim { struct nfc_dev *nfc_dev; @@ -62,12 +64,41 @@ static struct nfcsim *dev1; static struct workqueue_struct *wq; + +static int tx_delay = TX_DEFAULT_DELAY; + +static ssize_t show_tx_delay(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + int n; + + n = scnprintf(buf, PAGE_SIZE, "%d\n", tx_delay); + return n; +} + +static ssize_t store_tx_delay(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + if (kstrtouint(buf, 0, &tx_delay) < 0) + return -EINVAL; + + if (tx_delay < 0) + return -EINVAL; + + return count; +} + +static DEVICE_ATTR(tx_delay, 0644, show_tx_delay, store_tx_delay); + static void nfcsim_cleanup_dev(struct nfcsim *dev, u8 shutdown) { DEV_DBG(dev, "shutdown=%d\n", shutdown); mutex_lock(&dev->lock); + device_remove_file(&dev->nfc_dev->dev, &dev_attr_tx_delay); dev->polling_mode = NFCSIM_POLL_NONE; dev->shutting_down = shutdown; dev->cb = NULL; @@ -320,10 +351,8 @@ static int nfcsim_tx(struct nfc_dev *nfc_dev, struct nfc_target *target, * If packet transmission occurs immediately between them, we have a * non-stop flow of several tens of thousands SYMM packets per second * and a burning cpu. -* -* TODO: Add support for a sysfs entry to control this delay. */ - queue_delayed_work(wq, &peer->recv_work, msecs_to_jiffies(5)); + queue_delayed_work(wq, &peer->recv_work, msecs_to_jiffies(tx_delay)); mutex_unlock(&peer->lock); @@ -461,6 +490,9 @@ static struct nfcsim *nfcsim_init_dev(void) if (rc) goto free_nfc_dev; + rc = device_create_file(&dev->nfc_dev->dev, &dev_attr_tx_delay); + if (rc) + pr_err("error creating sysfs entry\n"); return dev; free_nfc_dev: -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RESEND PATCH] usb: host: pci_quirks: fix memory leak, by adding iounmap
added iounmap inorder to free memory mapped to base before returning Signed-off-by: Saurabh Sengar --- drivers/usb/host/pci-quirks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 26cb8c8..35af362 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -992,7 +992,7 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev) if ((ext_cap_offset + sizeof(val)) > len) { /* We're reading garbage from the controller */ dev_warn(&pdev->dev, "xHCI controller failing to respond"); - return; + goto iounmap; } val = readl(base + ext_cap_offset); @@ -1055,6 +1055,7 @@ hc_init: XHCI_MAX_HALT_USEC, val); } +iounmap: iounmap(base); } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Staging: speakup: varhandlers: cleanup of function spk_get_punc_var
On 12 December 2015 at 15:41, Sudip Mukherjee wrote: > On Sat, Dec 12, 2015 at 11:40:25AM +0300, Dan Carpenter wrote: >> On Wed, Dec 09, 2015 at 10:47:18AM +0530, Sudip Mukherjee wrote: >> > On Mon, Dec 07, 2015 at 06:35:11PM +0530, Saurabh Sengar wrote: >> > > This patch does the following: >> > > * changed the complicated if statements to simple case statements >> > > * in case of E_DEFAULT, no need to return error as ERESTART, >> > > because this is the user asked for. Hence function should return success. >> > > * ret variable is 0 always, hence removed it. >> > > * removed one ternary operator, as it was always returning the status >> > > value only, >> > > and hence removed the status variable too >> > >> > That becomes 4 different changes. Please break them into separate >> > patches. >> >> It's cleaning up one function so you could argue that it's just one >> thing. > > Then maybe that should have been mentioned in the commit message along > with mentioning point wise the different changes made. > That is already mentioned in subject line of patch, which will be the part of commit message. Regrads, Saurabh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Staging: speakup: varhandlers: cleanup of function spk_get_punc_var
On 12 December 2015 at 14:10, Dan Carpenter wrote: > On Wed, Dec 09, 2015 at 10:47:18AM +0530, Sudip Mukherjee wrote: >> On Mon, Dec 07, 2015 at 06:35:11PM +0530, Saurabh Sengar wrote: >> > This patch does the following: >> > * changed the complicated if statements to simple case statements >> > * in case of E_DEFAULT, no need to return error as ERESTART, >> > because this is the user asked for. Hence function should return success. >> > * ret variable is 0 always, hence removed it. >> > * removed one ternary operator, as it was always returning the status >> > value only, >> > and hence removed the status variable too >> >> That becomes 4 different changes. Please break them into separate >> patches. > > It's cleaning up one function so you could argue that it's just one > thing. Sometimes it's actually harder to review when a patch is broken > into ultra tiny junks. yes Dan, this is my point too. I was planning to cleanup many function in speakup. If I will be breakup in to such a small chunk, it will problem for both of us. The best I can do is to hide the details in description and just say clanup there. I am open to suggestions. Regards, Saurabh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] wan: wanxl: add pci_disable_device in case of error
If there is 'no suitable DMA available' error, device should be disabled before returning Signed-off-by: Saurabh Sengar --- drivers/net/wan/wanxl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c index e73f138..a20d688 100644 --- a/drivers/net/wan/wanxl.c +++ b/drivers/net/wan/wanxl.c @@ -586,6 +586,7 @@ static int wanxl_pci_init_one(struct pci_dev *pdev, if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(28)) || pci_set_dma_mask(pdev, DMA_BIT_MASK(28))) { pr_err("No usable DMA configuration\n"); + pci_disable_device(pdev); return -EIO; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] NFC: added the sysfs entry for nfcsim workqueue delay
ping again !! On 1 December 2015 at 21:10, Saurabh Sengar wrote: > pinging for feedback. > Please respond. > > On 20 November 2015 at 16:07, Saurabh Sengar wrote: >> I have also tested this module its successfully creating the tx_delay >> entry in nfc >> >> root@saurabh:/home/saurabh# ls /sys/class/nfc/nfc0/tx_delay >> /sys/class/nfc/nfc0/tx_delay >> >> its default value is set to 5 >> root@saurabh:/home/saurabh# cat /sys/class/nfc/nfc0/tx_delay >> 5 >> >> its changing the value correctly >> root@saurabh:/home/saurabh# echo 15 > /sys/class/nfc/nfc0/tx_delay >> root@saurabh:/home/saurabh# cat /sys/class/nfc/nfc0/tx_delay >> 15 >> >> and on removing the module its cleaning up without any oops >> >> Tested-by: Saurabh Sengar >> >> On 13 November 2015 at 16:48, Saurabh Sengar wrote: >>> added the sysfs entry for nfcsim workqueue delay, as tx_delay >>> >>> Signed-off-by: Saurabh Sengar >>> --- >>> implementing the TODO task >>> >>> drivers/nfc/nfcsim.c | 38 +++--- >>> 1 file changed, 35 insertions(+), 3 deletions(-) >>> >>> diff --git a/drivers/nfc/nfcsim.c b/drivers/nfc/nfcsim.c >>> index 26ac9e5..e77be35 100644 >>> --- a/drivers/nfc/nfcsim.c >>> +++ b/drivers/nfc/nfcsim.c >>> @@ -32,6 +32,8 @@ >>> #define NFCSIM_POLL_TARGET 2 >>> #define NFCSIM_POLL_DUAL (NFCSIM_POLL_INITIATOR | NFCSIM_POLL_TARGET) >>> >>> +#define TX_DEFAULT_DELAY 5 >>> + >>> struct nfcsim { >>> struct nfc_dev *nfc_dev; >>> >>> @@ -62,12 +64,41 @@ static struct nfcsim *dev1; >>> >>> static struct workqueue_struct *wq; >>> >>> + >>> +static int tx_delay = TX_DEFAULT_DELAY; >>> + >>> +static ssize_t show_tx_delay(struct device *dev, >>> + struct device_attribute *attr, >>> + char *buf) >>> +{ >>> + int n; >>> + >>> + n = scnprintf(buf, PAGE_SIZE, "%d\n", tx_delay); >>> + return n; >>> +} >>> + >>> +static ssize_t store_tx_delay(struct device *dev, >>> + struct device_attribute *attr, >>> + const char *buf, size_t count) >>> +{ >>> + if (kstrtouint(buf, 0, &tx_delay) < 0) >>> + return -EINVAL; >>> + >>> + if (tx_delay < 0) >>> + return -EINVAL; >>> + >>> + return count; >>> +} >>> + >>> +static DEVICE_ATTR(tx_delay, 0644, show_tx_delay, store_tx_delay); >>> + >>> static void nfcsim_cleanup_dev(struct nfcsim *dev, u8 shutdown) >>> { >>> DEV_DBG(dev, "shutdown=%d\n", shutdown); >>> >>> mutex_lock(&dev->lock); >>> >>> + device_remove_file(&dev->nfc_dev->dev, &dev_attr_tx_delay); >>> dev->polling_mode = NFCSIM_POLL_NONE; >>> dev->shutting_down = shutdown; >>> dev->cb = NULL; >>> @@ -320,10 +351,8 @@ static int nfcsim_tx(struct nfc_dev *nfc_dev, struct >>> nfc_target *target, >>> * If packet transmission occurs immediately between them, we have a >>> * non-stop flow of several tens of thousands SYMM packets per >>> second >>> * and a burning cpu. >>> -* >>> -* TODO: Add support for a sysfs entry to control this delay. >>> */ >>> - queue_delayed_work(wq, &peer->recv_work, msecs_to_jiffies(5)); >>> + queue_delayed_work(wq, &peer->recv_work, >>> msecs_to_jiffies(tx_delay)); >>> >>> mutex_unlock(&peer->lock); >>> >>> @@ -461,6 +490,9 @@ static struct nfcsim *nfcsim_init_dev(void) >>> if (rc) >>> goto free_nfc_dev; >>> >>> + rc = device_create_file(&dev->nfc_dev->dev, &dev_attr_tx_delay); >>> + if (rc) >>> + pr_err("error creating sysfs entry\n"); >>> return dev; >>> >>> free_nfc_dev: >>> -- >>> 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Staging: speakup: varhandlers: cleanup of function spk_get_punc_var
This patch does the following: * changed the complicated if statements to simple case statements * in case of E_DEFAULT, no need to return error as ERESTART, because this is the user asked for. Hence function should return success. * ret variable is 0 always, hence removed it. * removed one ternary operator, as it was always returning the status value only, and hence removed the status variable too Signed-off-by: Saurabh Sengar --- drivers/staging/speakup/varhandlers.c | 50 +-- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c index ab4fe8d..e1393d2 100644 --- a/drivers/staging/speakup/varhandlers.c +++ b/drivers/staging/speakup/varhandlers.c @@ -176,7 +176,6 @@ struct punc_var_t *spk_get_punc_var(enum var_id_t var_id) int spk_set_num_var(int input, struct st_var_header *var, int how) { int val; - short ret = 0; int *p_val = var->p_val; int l; char buf[32]; @@ -186,50 +185,51 @@ int spk_set_num_var(int input, struct st_var_header *var, int how) if (!var_data) return -ENODATA; - if (how == E_NEW_DEFAULT) { + val = var_data->u.n.value; + switch (how) { + case E_NEW_DEFAULT: if (input < var_data->u.n.low || input > var_data->u.n.high) return -ERANGE; var_data->u.n.default_val = input; return 0; - } - if (how == E_DEFAULT) { + case E_DEFAULT: val = var_data->u.n.default_val; - ret = -ERESTART; - } else { - if (how == E_SET) - val = input; - else - val = var_data->u.n.value; - if (how == E_INC) - val += input; - else if (how == E_DEC) - val -= input; - if (val < var_data->u.n.low || val > var_data->u.n.high) - return -ERANGE; + break; + case E_SET: + val = input; + break; + case E_INC: + val += input; + break; + case E_DEC: + val -= input; + break; } + + if (val < var_data->u.n.low || val > var_data->u.n.high) + return -ERANGE; + var_data->u.n.value = val; if (var->var_type == VAR_TIME && p_val != NULL) { *p_val = msecs_to_jiffies(val); - return ret; + return 0; } if (p_val != NULL) *p_val = val; if (var->var_id == PUNC_LEVEL) { spk_punc_mask = spk_punc_masks[val]; - return ret; + return 0; } if (var_data->u.n.multiplier != 0) val *= var_data->u.n.multiplier; val += var_data->u.n.offset; if (var->var_id < FIRST_SYNTH_VAR || !synth) - return ret; - if (synth->synth_adjust) { - int status = synth->synth_adjust(var); + return 0; + if (synth->synth_adjust) + return synth->synth_adjust(var); - return (status != 0) ? status : ret; - } if (!var_data->u.n.synth_fmt) - return ret; + return 0; if (var->var_id == PITCH) cp = spk_pitch_buff; else @@ -240,7 +240,7 @@ int spk_set_num_var(int input, struct st_var_header *var, int how) l = sprintf(cp, var_data->u.n.synth_fmt, var_data->u.n.out_str[val]); synth_printf("%s", cp); - return ret; + return 0; } int spk_set_string_var(const char *page, struct st_var_header *var, int len) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] Staging: speakup: kobjects: Return the error type to caller
Inorder to notify the user that value is not successfuly set in sys entry, error should be returned from store function instead of count Signed-off-by: Saurabh Sengar --- v2: Hi Dan, I will look more into this function in my free time. For now just sending you this patch fixing ERANGE as commented drivers/staging/speakup/kobjects.c | 4 +++- drivers/staging/staging.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c index fdfeb42..509163c 100644 --- a/drivers/staging/speakup/kobjects.c +++ b/drivers/staging/speakup/kobjects.c @@ -640,7 +640,7 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr, len = E_INC; else len = E_SET; - if (kstrtol(cp, 10, &value) == 0) + if (!kstrtol(cp, 10, &value)) ret = spk_set_num_var(value, param, len); else pr_warn("overflow or parsing error has occurred"); @@ -688,6 +688,8 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr, if (ret == -ERESTART) pr_info("%s reset to default value\n", param->name); + else if (ret < 0) + return ret; return count; } EXPORT_SYMBOL_GPL(spk_var_store); diff --git a/drivers/staging/staging.c b/drivers/staging/staging.c index 233e589..36dd594 100644 --- a/drivers/staging/staging.c +++ b/drivers/staging/staging.c @@ -2,12 +2,12 @@ #include #include -static int __init staging_init(void) +static int staging_init(void) { return 0; } -static void __exit staging_exit(void) +static void staging_exit(void) { } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Staging: speakup: kobjects: Return the error type to caller
On 7 December 2015 at 12:18, Dan Carpenter wrote: > On Fri, Dec 04, 2015 at 08:12:33PM +0530, Saurabh Sengar wrote: >> Inorder to notify the user that value is not successfuly set in sys >> entry, error should be returned from store function instead of count >> >> Signed-off-by: Saurabh Sengar >> --- >> drivers/staging/speakup/kobjects.c | 5 - >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/staging/speakup/kobjects.c >> b/drivers/staging/speakup/kobjects.c >> index fdfeb42..b3a83fb 100644 >> --- a/drivers/staging/speakup/kobjects.c >> +++ b/drivers/staging/speakup/kobjects.c >> @@ -640,7 +640,8 @@ ssize_t spk_var_store(struct kobject *kobj, struct >> kobj_attribute *attr, >> len = E_INC; >> else >> len = E_SET; >> - if (kstrtol(cp, 10, &value) == 0) >> + ret = kstrtol(cp, 10, &value); >> + if (!ret) >> ret = spk_set_num_var(value, param, len); > > Both kstrtol() and spk_set_num_var() return -ERANGE. The next lines > expect that if we got -ERANGE, then it came from spk_set_num_var() so > they print a wrong message. Yes I understand this. And in case we got -ERANGE from spk_set_num_var, it is printing the error message. I have tested this too by passing the out of range values to few parameters. > >> else >> pr_warn("overflow or parsing error has occurred"); >> @@ -688,6 +689,8 @@ ssize_t spk_var_store(struct kobject *kobj, struct >> kobj_attribute *attr, >> >> if (ret == -ERESTART) >> pr_info("%s reset to default value\n", param->name); > > Is this really true? Sorry, I am not sure here what you mean here. I have not implemented it. > > This function is so weird and broken. Please look at it some more and > fix it harder with a mallet. You mean I broke it ? I don't think so, I have tested the functionality before submitting the patch. If you mean that this function already not in good shape, I understand and agree with you. > > regards, > dan carpenter > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] gpu: host1x: mipi: Added missing mutex_unlock
In case of error too function should return after releasing the mutex Signed-off-by: Saurabh Sengar --- drivers/gpu/host1x/mipi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/host1x/mipi.c b/drivers/gpu/host1x/mipi.c index 52a6fd2..6e559a9 100644 --- a/drivers/gpu/host1x/mipi.c +++ b/drivers/gpu/host1x/mipi.c @@ -250,6 +250,7 @@ struct tegra_mipi_device *tegra_mipi_request(struct device *device) dev_err(dev->mipi->dev, "failed to power up MIPI bricks: %d\n", err); + mutex_unlock(&dev->mipi->lock); return ERR_PTR(err); } } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drm: msm: dsi: Added missing mutex_unlock
in case of failed to get iova, function was returning without releasing the mutex. Added it. Signed-off-by: Saurabh Sengar --- drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 4c49868..13f937b 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -849,11 +849,11 @@ static int dsi_tx_buf_alloc(struct msm_dsi_host *msm_host, int size) } ret = msm_gem_get_iova_locked(msm_host->tx_gem_obj, 0, &iova); + mutex_unlock(&dev->struct_mutex); if (ret) { pr_err("%s: failed to get iova, %d\n", __func__, ret); return ret; } - mutex_unlock(&dev->struct_mutex); if (iova & 0x07) { pr_err("%s: buf NOT 8 bytes aligned\n", __func__); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3] usb: host: pci_quirks: fix memory leak, by adding iounmap
added iounmap inorder to free memory mapped to base before returning Signed-off-by: Saurabh Sengar --- v3: reverted to v1 logic, on top of usb-next branch drivers/usb/host/pci-quirks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 26cb8c8..35af362 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -992,7 +992,7 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev) if ((ext_cap_offset + sizeof(val)) > len) { /* We're reading garbage from the controller */ dev_warn(&pdev->dev, "xHCI controller failing to respond"); - return; + goto iounmap; } val = readl(base + ext_cap_offset); @@ -1055,6 +1055,7 @@ hc_init: XHCI_MAX_HALT_USEC, val); } +iounmap: iounmap(base); } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] usb: host: pci_quirks: fix memory leak, by adding iounmap
On 4 December 2015 at 21:53, Greg KH wrote: > On Wed, Dec 02, 2015 at 10:51:37PM +0530, Saurabh Sengar wrote: >> added iounmap inorder to free memory mapped to base before returning >> >> Signed-off-by: Saurabh Sengar >> --- >> v2: changed logic a bit, because of recent patches pushed to usb-next >> drivers/usb/host/pci-quirks.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c >> index 26cb8c8..2ac198c 100644 >> --- a/drivers/usb/host/pci-quirks.c >> +++ b/drivers/usb/host/pci-quirks.c >> @@ -992,7 +992,7 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev) >> if ((ext_cap_offset + sizeof(val)) > len) { >> /* We're reading garbage from the controller */ >> dev_warn(&pdev->dev, "xHCI controller failing to respond"); >> - return; >> + goto hc_init; > > Are you sure this is correct? That goto location then does a whole > bunch of things with the xhci controller that you just now determined is > failing to respond. I can't take this as-is, sorry. > > greg k-h Yes I agree, and in the first patch I didn't do this way. But the latest patch which got introduced is doing "goto hc_init" at line 990 ext_cap_offset = xhci_find_next_ext_cap(base, 0, XHCI_EXT_CAPS_LEGACY); if (!ext_cap_offset) goto hc_init; I think this is wrong too, may be I am wrong. Any way I will send the first patch again on top of usb-next as v3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Staging: speakup: kobjects: Return the error type to caller
Inorder to notify the user that value is not successfuly set in sys entry, error should be returned from store function instead of count Signed-off-by: Saurabh Sengar --- drivers/staging/speakup/kobjects.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c index fdfeb42..b3a83fb 100644 --- a/drivers/staging/speakup/kobjects.c +++ b/drivers/staging/speakup/kobjects.c @@ -640,7 +640,8 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr, len = E_INC; else len = E_SET; - if (kstrtol(cp, 10, &value) == 0) + ret = kstrtol(cp, 10, &value); + if (!ret) ret = spk_set_num_var(value, param, len); else pr_warn("overflow or parsing error has occurred"); @@ -688,6 +689,8 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr, if (ret == -ERESTART) pr_info("%s reset to default value\n", param->name); + else if (ret < 0) + return ret; return count; } EXPORT_SYMBOL_GPL(spk_var_store); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mfd: mc13xxx-core: use of_property_read_bool()
I couldn't see this patch applied in linux-next branch still. Regards, Saurabh On 24 November 2015 at 21:59, Lee Jones wrote: > On Mon, 16 Nov 2015, Saurabh Sengar wrote: > >> for checking if a property is present or not, >> use of_property_read_bool instead of of_get_property() >> >> Signed-off-by: Saurabh Sengar >> --- >> drivers/mfd/mc13xxx-core.c | 8 >> 1 file changed, 4 insertions(+), 4 deletions(-) > > I'm fine with the change, but in future please use the commit format > expected of the subsystem. In this case, you are missing upper-case > characters at the start of the subject line AND the start of the > commit log. In fact, it is devoid of sufficient punctuation in > general. > > I have applied this and fixed up the issues; this time! > >> diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c >> index 3f9f4c8..d7f54e4 100644 >> --- a/drivers/mfd/mc13xxx-core.c >> +++ b/drivers/mfd/mc13xxx-core.c >> @@ -383,16 +383,16 @@ static int mc13xxx_probe_flags_dt(struct mc13xxx >> *mc13xxx) >> if (!np) >> return -ENODEV; >> >> - if (of_get_property(np, "fsl,mc13xxx-uses-adc", NULL)) >> + if (of_property_read_bool(np, "fsl,mc13xxx-uses-adc")) >> mc13xxx->flags |= MC13XXX_USE_ADC; >> >> - if (of_get_property(np, "fsl,mc13xxx-uses-codec", NULL)) >> + if (of_property_read_bool(np, "fsl,mc13xxx-uses-codec")) >> mc13xxx->flags |= MC13XXX_USE_CODEC; >> >> - if (of_get_property(np, "fsl,mc13xxx-uses-rtc", NULL)) >> + if (of_property_read_bool(np, "fsl,mc13xxx-uses-rtc")) >> mc13xxx->flags |= MC13XXX_USE_RTC; >> >> - if (of_get_property(np, "fsl,mc13xxx-uses-touch", NULL)) >> + if (of_property_read_bool(np, "fsl,mc13xxx-uses-touch")) >> mc13xxx->flags |= MC13XXX_USE_TOUCHSCREEN; >> >> return 0; > > -- > Lee Jones > Linaro STMicroelectronics Landing Team Lead > Linaro.org │ Open source software for ARM SoCs > Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] usb: host: pci_quirks: fix memory leak, by adding iounmap
added iounmap inorder to free memory mapped to base before returning Signed-off-by: Saurabh Sengar --- v2: changed logic a bit, because of recent patches pushed to usb-next drivers/usb/host/pci-quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 26cb8c8..2ac198c 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -992,7 +992,7 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev) if ((ext_cap_offset + sizeof(val)) > len) { /* We're reading garbage from the controller */ dev_warn(&pdev->dev, "xHCI controller failing to respond"); - return; + goto hc_init; } val = readl(base + ext_cap_offset); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] usb: host: pci_quirks: fix memory leak, by adding iounmap
Hi Greg, I am little unclear. Now, shall I resend my patch on top of usb.git tree or linux.git tree. Regards, Saurabh On 2 December 2015 at 21:15, Greg KH wrote: > On Wed, Dec 02, 2015 at 09:08:06AM +0530, Saurabh Sengar wrote: >> On 2 December 2015 at 04:05, Greg KH wrote: >> > On Fri, Nov 06, 2015 at 05:46:30PM +0530, Saurabh Sengar wrote: >> >> added iounmap inorder to free memory mapped to base before returning >> >> >> >> Signed-off-by: Saurabh Sengar >> >> --- >> >> drivers/usb/host/pci-quirks.c | 4 ++-- >> >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> >> >> diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c >> >> index f940056..332f687 100644 >> >> --- a/drivers/usb/host/pci-quirks.c >> >> +++ b/drivers/usb/host/pci-quirks.c >> >> @@ -990,7 +990,7 @@ static void quirk_usb_handoff_xhci(struct pci_dev >> >> *pdev) >> >> /* We're reading garbage from the controller */ >> >> dev_warn(&pdev->dev, >> >>"xHCI controller failing to respond"); >> >> - return; >> >> + goto iounmap; >> >> } >> >> >> >> if (!ext_cap_offset) >> >> @@ -1061,7 +1061,7 @@ hc_init: >> >>"xHCI HW did not halt within %d usec status = >> >> 0x%x\n", >> >>XHCI_MAX_HALT_USEC, val); >> >> } >> >> - >> >> +iounmap: >> >> iounmap(base); >> >> } >> >> >> > >> > Does not apply to the tree :( >> >> >> This patch applies fine on top of >> "git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git". >> Just now only I have re-verified. >> Am I expected to send this patch on top of some other git tree/branch ? > > It will end up going in the usb.git tree, on the usb-next branch, and it > conflicts with other xhci patches that just landed there ahead of yours. > So it's not your fault, you did the right thing, just others also did > work here so you need to redo yours as well, a normal thing in kernel > development :) > > hope this helps explain things. > > thanks, > > greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] usb: host: pci_quirks: fix memory leak, by adding iounmap
On 2 December 2015 at 04:05, Greg KH wrote: > On Fri, Nov 06, 2015 at 05:46:30PM +0530, Saurabh Sengar wrote: >> added iounmap inorder to free memory mapped to base before returning >> >> Signed-off-by: Saurabh Sengar >> --- >> drivers/usb/host/pci-quirks.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c >> index f940056..332f687 100644 >> --- a/drivers/usb/host/pci-quirks.c >> +++ b/drivers/usb/host/pci-quirks.c >> @@ -990,7 +990,7 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev) >> /* We're reading garbage from the controller */ >> dev_warn(&pdev->dev, >>"xHCI controller failing to respond"); >> - return; >> + goto iounmap; >> } >> >> if (!ext_cap_offset) >> @@ -1061,7 +1061,7 @@ hc_init: >>"xHCI HW did not halt within %d usec status = 0x%x\n", >>XHCI_MAX_HALT_USEC, val); >> } >> - >> +iounmap: >> iounmap(base); >> } >> > > Does not apply to the tree :( This patch applies fine on top of "git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git". Just now only I have re-verified. Am I expected to send this patch on top of some other git tree/branch ? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] NFC: added the sysfs entry for nfcsim workqueue delay
pinging for feedback. Please respond. On 20 November 2015 at 16:07, Saurabh Sengar wrote: > I have also tested this module its successfully creating the tx_delay > entry in nfc > > root@saurabh:/home/saurabh# ls /sys/class/nfc/nfc0/tx_delay > /sys/class/nfc/nfc0/tx_delay > > its default value is set to 5 > root@saurabh:/home/saurabh# cat /sys/class/nfc/nfc0/tx_delay > 5 > > its changing the value correctly > root@saurabh:/home/saurabh# echo 15 > /sys/class/nfc/nfc0/tx_delay > root@saurabh:/home/saurabh# cat /sys/class/nfc/nfc0/tx_delay > 15 > > and on removing the module its cleaning up without any oops > > Tested-by: Saurabh Sengar > > On 13 November 2015 at 16:48, Saurabh Sengar wrote: >> added the sysfs entry for nfcsim workqueue delay, as tx_delay >> >> Signed-off-by: Saurabh Sengar >> --- >> implementing the TODO task >> >> drivers/nfc/nfcsim.c | 38 +++--- >> 1 file changed, 35 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/nfc/nfcsim.c b/drivers/nfc/nfcsim.c >> index 26ac9e5..e77be35 100644 >> --- a/drivers/nfc/nfcsim.c >> +++ b/drivers/nfc/nfcsim.c >> @@ -32,6 +32,8 @@ >> #define NFCSIM_POLL_TARGET 2 >> #define NFCSIM_POLL_DUAL (NFCSIM_POLL_INITIATOR | NFCSIM_POLL_TARGET) >> >> +#define TX_DEFAULT_DELAY 5 >> + >> struct nfcsim { >> struct nfc_dev *nfc_dev; >> >> @@ -62,12 +64,41 @@ static struct nfcsim *dev1; >> >> static struct workqueue_struct *wq; >> >> + >> +static int tx_delay = TX_DEFAULT_DELAY; >> + >> +static ssize_t show_tx_delay(struct device *dev, >> + struct device_attribute *attr, >> + char *buf) >> +{ >> + int n; >> + >> + n = scnprintf(buf, PAGE_SIZE, "%d\n", tx_delay); >> + return n; >> +} >> + >> +static ssize_t store_tx_delay(struct device *dev, >> + struct device_attribute *attr, >> + const char *buf, size_t count) >> +{ >> + if (kstrtouint(buf, 0, &tx_delay) < 0) >> + return -EINVAL; >> + >> + if (tx_delay < 0) >> + return -EINVAL; >> + >> + return count; >> +} >> + >> +static DEVICE_ATTR(tx_delay, 0644, show_tx_delay, store_tx_delay); >> + >> static void nfcsim_cleanup_dev(struct nfcsim *dev, u8 shutdown) >> { >> DEV_DBG(dev, "shutdown=%d\n", shutdown); >> >> mutex_lock(&dev->lock); >> >> + device_remove_file(&dev->nfc_dev->dev, &dev_attr_tx_delay); >> dev->polling_mode = NFCSIM_POLL_NONE; >> dev->shutting_down = shutdown; >> dev->cb = NULL; >> @@ -320,10 +351,8 @@ static int nfcsim_tx(struct nfc_dev *nfc_dev, struct >> nfc_target *target, >> * If packet transmission occurs immediately between them, we have a >> * non-stop flow of several tens of thousands SYMM packets per second >> * and a burning cpu. >> -* >> -* TODO: Add support for a sysfs entry to control this delay. >> */ >> - queue_delayed_work(wq, &peer->recv_work, msecs_to_jiffies(5)); >> + queue_delayed_work(wq, &peer->recv_work, msecs_to_jiffies(tx_delay)); >> >> mutex_unlock(&peer->lock); >> >> @@ -461,6 +490,9 @@ static struct nfcsim *nfcsim_init_dev(void) >> if (rc) >> goto free_nfc_dev; >> >> + rc = device_create_file(&dev->nfc_dev->dev, &dev_attr_tx_delay); >> + if (rc) >> + pr_err("error creating sysfs entry\n"); >> return dev; >> >> free_nfc_dev: >> -- >> 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] dma: mic_x100: add missing spin_unlock
spin lock should be released while returning from function Signed-off-by: Saurabh Sengar --- v2: fixed comment from Vinod Koul drivers/dma/mic_x100_dma.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/dma/mic_x100_dma.c b/drivers/dma/mic_x100_dma.c index 068e920..cddfa8d 100644 --- a/drivers/dma/mic_x100_dma.c +++ b/drivers/dma/mic_x100_dma.c @@ -317,6 +317,7 @@ mic_dma_prep_memcpy_lock(struct dma_chan *ch, dma_addr_t dma_dest, struct mic_dma_chan *mic_ch = to_mic_dma_chan(ch); struct device *dev = mic_dma_ch_to_device(mic_ch); int result; + struct dma_async_tx_descriptor *tx = NULL; if (!len && !flags) return NULL; @@ -324,10 +325,13 @@ mic_dma_prep_memcpy_lock(struct dma_chan *ch, dma_addr_t dma_dest, spin_lock(&mic_ch->prep_lock); result = mic_dma_do_dma(mic_ch, flags, dma_src, dma_dest, len); if (result >= 0) - return allocate_tx(mic_ch); - dev_err(dev, "Error enqueueing dma, error=%d\n", result); + tx = allocate_tx(mic_ch); + + if (!tx) + dev_err(dev, "Error enqueueing dma, error=%d\n", result); + spin_unlock(&mic_ch->prep_lock); - return NULL; + return tx; } static struct dma_async_tx_descriptor * @@ -335,13 +339,14 @@ mic_dma_prep_interrupt_lock(struct dma_chan *ch, unsigned long flags) { struct mic_dma_chan *mic_ch = to_mic_dma_chan(ch); int ret; + struct dma_async_tx_descriptor *tx = NULL; spin_lock(&mic_ch->prep_lock); ret = mic_dma_do_dma(mic_ch, flags, 0, 0, 0); if (!ret) - return allocate_tx(mic_ch); + tx = allocate_tx(mic_ch); spin_unlock(&mic_ch->prep_lock); - return NULL; + return tx; } /* Return the status of the transaction */ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] usb: host: pci_quirks: fix memory leak, by adding iounmap
pinging in case this patch is lost. On 6 November 2015 at 17:46, Saurabh Sengar wrote: > added iounmap inorder to free memory mapped to base before returning > > Signed-off-by: Saurabh Sengar > --- > drivers/usb/host/pci-quirks.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c > index f940056..332f687 100644 > --- a/drivers/usb/host/pci-quirks.c > +++ b/drivers/usb/host/pci-quirks.c > @@ -990,7 +990,7 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev) > /* We're reading garbage from the controller */ > dev_warn(&pdev->dev, > "xHCI controller failing to respond"); > - return; > + goto iounmap; > } > > if (!ext_cap_offset) > @@ -1061,7 +1061,7 @@ hc_init: > "xHCI HW did not halt within %d usec status = > 0x%x\n", > XHCI_MAX_HALT_USEC, val); > } > - > +iounmap: > iounmap(base); > } > > -- > 1.9.1 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mmc: of_mmc_spi: Add IRQF_ONESHOT to interrupt flags
If no primary handler is specified for threaded_irq then a default one is assigned which always returns IRQ_WAKE_THREAD. This handler requires the IRQF_ONESHOT, because the source of interrupt is not disabled Signed-off-by: Saurabh Sengar --- drivers/mmc/host/of_mmc_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c index 6e218fb..660170c 100644 --- a/drivers/mmc/host/of_mmc_spi.c +++ b/drivers/mmc/host/of_mmc_spi.c @@ -55,8 +55,8 @@ static int of_mmc_spi_init(struct device *dev, { struct of_mmc_spi *oms = to_of_mmc_spi(dev); - return request_threaded_irq(oms->detect_irq, NULL, irqhandler, 0, - dev_name(dev), mmc); + return request_threaded_irq(oms->detect_irq, NULL, irqhandler, + IRQF_ONESHOT, dev_name(dev), mmc); } static void of_mmc_spi_exit(struct device *dev, void *mmc) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers/rtc/rtc-tps65910.c: Add IRQF_ONESHOT to interrupt flags
If no primary handler is specified for threaded_irq then a default one is assigned which always returns IRQ_WAKE_THREAD. This handler requires the IRQF_ONESHOT, because the source of interrupt is not disabled Signed-off-by: Saurabh Sengar --- drivers/rtc/rtc-tps65910.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c index f42aa2b..9afafde 100644 --- a/drivers/rtc/rtc-tps65910.c +++ b/drivers/rtc/rtc-tps65910.c @@ -268,7 +268,8 @@ static int tps65910_rtc_probe(struct platform_device *pdev) } ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, - tps65910_rtc_interrupt, IRQF_TRIGGER_LOW | IRQF_EARLY_RESUME, + tps65910_rtc_interrupt, + IRQF_TRIGGER_LOW | IRQF_EARLY_RESUME | IRQF_ONESHOT, dev_name(&pdev->dev), &pdev->dev); if (ret < 0) { dev_err(&pdev->dev, "IRQ is not free.\n"); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] extcon: rt8973: Add IRQF_ONESHOT to interrupt flags
Add IRQF_ONESHOT if no primary handler is provided for request threaded irq Signed-off-by: Saurabh Sengar --- drivers/extcon/extcon-rt8973a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/extcon/extcon-rt8973a.c b/drivers/extcon/extcon-rt8973a.c index 36bf1d6..e1bb8280 100644 --- a/drivers/extcon/extcon-rt8973a.c +++ b/drivers/extcon/extcon-rt8973a.c @@ -603,7 +603,7 @@ static int rt8973a_muic_i2c_probe(struct i2c_client *i2c, ret = devm_request_threaded_irq(info->dev, virq, NULL, rt8973a_muic_irq_handler, - IRQF_NO_SUSPEND, + IRQF_NO_SUSPEND | IRQF_ONESHOT, muic_irq->name, info); if (ret) { dev_err(info->dev, -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] usb : replace dma_pool_alloc and memset with dma_pool_zalloc
any conclusion for this patch ? any feedback ? On Oct 28, 2015 2:46 PM, "Peter Chen" wrote: > > On Wed, Oct 28, 2015 at 12:44:35PM +0530, Saurabh Sengar wrote: > > replace dma_pool_alloc and memset with a single call to dma_pool_zalloc > > > > Signed-off-by: Saurabh Sengar > > --- > > drivers/usb/chipidea/udc.c | 3 +-- > > drivers/usb/gadget/udc/gr_udc.c | 3 +-- > > drivers/usb/host/uhci-q.c | 3 +-- > > drivers/usb/host/whci/qset.c| 3 +-- > > drivers/usb/host/xhci-mem.c | 6 ++ > > 5 files changed, 6 insertions(+), 12 deletions(-) > > > > diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c > > index 8223fe7..235b948f 100644 > > --- a/drivers/usb/chipidea/udc.c > > +++ b/drivers/usb/chipidea/udc.c > > @@ -349,14 +349,13 @@ static int add_td_to_list(struct ci_hw_ep *hwep, > > struct ci_hw_req *hwreq, > > if (node == NULL) > > return -ENOMEM; > > > > - node->ptr = dma_pool_alloc(hwep->td_pool, GFP_ATOMIC, > > + node->ptr = dma_pool_zalloc(hwep->td_pool, GFP_ATOMIC, > > &node->dma); > > if (node->ptr == NULL) { > > kfree(node); > > return -ENOMEM; > > } > > > > - memset(node->ptr, 0, sizeof(struct ci_hw_td)); > > node->ptr->token = cpu_to_le32(length << __ffs(TD_TOTAL_BYTES)); > > node->ptr->token &= cpu_to_le32(TD_TOTAL_BYTES); > > node->ptr->token |= cpu_to_le32(TD_STATUS_ACTIVE); > > diff --git a/drivers/usb/gadget/udc/gr_udc.c > > b/drivers/usb/gadget/udc/gr_udc.c > > index b9429bc..39b7136 100644 > > --- a/drivers/usb/gadget/udc/gr_udc.c > > +++ b/drivers/usb/gadget/udc/gr_udc.c > > @@ -253,13 +253,12 @@ static struct gr_dma_desc *gr_alloc_dma_desc(struct > > gr_ep *ep, gfp_t gfp_flags) > > dma_addr_t paddr; > > struct gr_dma_desc *dma_desc; > > > > - dma_desc = dma_pool_alloc(ep->dev->desc_pool, gfp_flags, &paddr); > > + dma_desc = dma_pool_zalloc(ep->dev->desc_pool, gfp_flags, &paddr); > > if (!dma_desc) { > > dev_err(ep->dev->dev, "Could not allocate from DMA pool\n"); > > return NULL; > > } > > > > - memset(dma_desc, 0, sizeof(*dma_desc)); > > dma_desc->paddr = paddr; > > > > return dma_desc; > > diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c > > index da6f56d..c17ea15 100644 > > --- a/drivers/usb/host/uhci-q.c > > +++ b/drivers/usb/host/uhci-q.c > > @@ -248,11 +248,10 @@ static struct uhci_qh *uhci_alloc_qh(struct uhci_hcd > > *uhci, > > dma_addr_t dma_handle; > > struct uhci_qh *qh; > > > > - qh = dma_pool_alloc(uhci->qh_pool, GFP_ATOMIC, &dma_handle); > > + qh = dma_pool_zalloc(uhci->qh_pool, GFP_ATOMIC, &dma_handle); > > if (!qh) > > return NULL; > > > > - memset(qh, 0, sizeof(*qh)); > > qh->dma_handle = dma_handle; > > > > qh->element = UHCI_PTR_TERM(uhci); > > diff --git a/drivers/usb/host/whci/qset.c b/drivers/usb/host/whci/qset.c > > index dc31c42..3297473 100644 > > --- a/drivers/usb/host/whci/qset.c > > +++ b/drivers/usb/host/whci/qset.c > > @@ -30,10 +30,9 @@ struct whc_qset *qset_alloc(struct whc *whc, gfp_t > > mem_flags) > > struct whc_qset *qset; > > dma_addr_t dma; > > > > - qset = dma_pool_alloc(whc->qset_pool, mem_flags, &dma); > > + qset = dma_pool_zalloc(whc->qset_pool, mem_flags, &dma); > > if (qset == NULL) > > return NULL; > > - memset(qset, 0, sizeof(struct whc_qset)); > > > > qset->qset_dma = dma; > > qset->whc = whc; > > diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c > > index 41f841f..060c20c 100644 > > --- a/drivers/usb/host/xhci-mem.c > > +++ b/drivers/usb/host/xhci-mem.c > > @@ -47,13 +47,12 @@ static struct xhci_segment *xhci_segment_alloc(struct > > xhci_hcd *xhci, > > if (!seg) > > return NULL; > > > > - seg->trbs = dma_pool_alloc(xhci->segment_pool, flags, &dma); > > + seg->trbs = dma_pool_zalloc(xhci->segment_pool, flags, &dma); > > if (!seg->trbs) { > > kfree(seg); > > return NULL; > > } > > > > - mems
[PATCH] Input: smtpe-ts: better way of using of_property_read_u32()
better way of using of_property_read_u32(), helps remove one variable and many 'if' conditions Signed-off-by: Saurabh Sengar --- drivers/input/touchscreen/stmpe-ts.c | 29 ++--- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c index e414d43..51abe62 100644 --- a/drivers/input/touchscreen/stmpe-ts.c +++ b/drivers/input/touchscreen/stmpe-ts.c @@ -268,27 +268,18 @@ static void stmpe_ts_get_platform_info(struct platform_device *pdev, struct stmpe_touch *ts) { struct device_node *np = pdev->dev.of_node; - u32 val; if (np) { - if (!of_property_read_u32(np, "st,sample-time", &val)) - ts->sample_time = val; - if (!of_property_read_u32(np, "st,mod-12b", &val)) - ts->mod_12b = val; - if (!of_property_read_u32(np, "st,ref-sel", &val)) - ts->ref_sel = val; - if (!of_property_read_u32(np, "st,adc-freq", &val)) - ts->adc_freq = val; - if (!of_property_read_u32(np, "st,ave-ctrl", &val)) - ts->ave_ctrl = val; - if (!of_property_read_u32(np, "st,touch-det-delay", &val)) - ts->touch_det_delay = val; - if (!of_property_read_u32(np, "st,settling", &val)) - ts->settling = val; - if (!of_property_read_u32(np, "st,fraction-z", &val)) - ts->fraction_z = val; - if (!of_property_read_u32(np, "st,i-drive", &val)) - ts->i_drive = val; + of_property_read_u32(np, "st,sample-time", &ts->sample_time); + of_property_read_u32(np, "st,mod-12b", &ts->mod_12b); + of_property_read_u32(np, "st,ref-sel", &ts->ref_sel); + of_property_read_u32(np, "st,adc-freq", &ts->adc_freq); + of_property_read_u32(np, "st,ave-ctrl", &ts->ave_ctrl); + of_property_read_u32(np, "st,touch-det-delay", + &ts->touch_det_delay); + of_property_read_u32(np, "st,settling", &ts->settling = val); + of_property_read_u32(np, "st,fraction-z", &ts->fraction_z); + of_property_read_u32(np, "st,i-drive", &ts->i_drive); } } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] mtd: nand: use of_property_read_u8()
use of_property_read_u8() for u8 values Signed-off-by: Saurabh Sengar --- v2 : added the missed semi colon drivers/mtd/nand/orion_nand.c | 22 +++--- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c index ee83749..0cbebc5 100644 --- a/drivers/mtd/nand/orion_nand.c +++ b/drivers/mtd/nand/orion_nand.c @@ -83,7 +83,6 @@ static int __init orion_nand_probe(struct platform_device *pdev) struct clk *clk; void __iomem *io_base; int ret = 0; - u32 val = 0; nc = devm_kzalloc(&pdev->dev, sizeof(struct nand_chip) + sizeof(struct mtd_info), @@ -103,22 +102,15 @@ static int __init orion_nand_probe(struct platform_device *pdev) GFP_KERNEL); if (!board) return -ENOMEM; - if (!of_property_read_u32(pdev->dev.of_node, "cle", &val)) - board->cle = (u8)val; - else - board->cle = 0; - if (!of_property_read_u32(pdev->dev.of_node, "ale", &val)) - board->ale = (u8)val; - else + of_property_read_u8(pdev->dev.of_node, "cle", &board->cle); + + if (of_property_read_u8(pdev->dev.of_node, "ale", &board->ale)) board->ale = 1; - if (!of_property_read_u32(pdev->dev.of_node, - "bank-width", &val)) - board->width = (u8)val * 8; - else + if (of_property_read_u8(pdev->dev.of_node, + "bank-width", &board->width)) board->width = 8; - if (!of_property_read_u32(pdev->dev.of_node, - "chip-delay", &val)) - board->chip_delay = (u8)val; + of_property_read_u8(pdev->dev.of_node, + "chip-delay", &board->chip_delay); } else { board = dev_get_platdata(&pdev->dev); } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mtd: nand: use of_property_read_u8()
use of_property_read_u8() for u8 values Signed-off-by: Saurabh Sengar --- drivers/mtd/nand/orion_nand.c | 22 +++--- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c index ee83749..1a68145 100644 --- a/drivers/mtd/nand/orion_nand.c +++ b/drivers/mtd/nand/orion_nand.c @@ -83,7 +83,6 @@ static int __init orion_nand_probe(struct platform_device *pdev) struct clk *clk; void __iomem *io_base; int ret = 0; - u32 val = 0; nc = devm_kzalloc(&pdev->dev, sizeof(struct nand_chip) + sizeof(struct mtd_info), @@ -103,22 +102,15 @@ static int __init orion_nand_probe(struct platform_device *pdev) GFP_KERNEL); if (!board) return -ENOMEM; - if (!of_property_read_u32(pdev->dev.of_node, "cle", &val)) - board->cle = (u8)val; - else - board->cle = 0; - if (!of_property_read_u32(pdev->dev.of_node, "ale", &val)) - board->ale = (u8)val; - else + of_property_read_u8(pdev->dev.of_node, "cle", &board->cle); + + if (of_property_read_u8(pdev->dev.of_node, "ale", &board->ale)) board->ale = 1; - if (!of_property_read_u32(pdev->dev.of_node, - "bank-width", &val)) - board->width = (u8)val * 8; - else + if (of_property_read_u8(pdev->dev.of_node, + "bank-width", &board->width)) board->width = 8; - if (!of_property_read_u32(pdev->dev.of_node, - "chip-delay", &val)) - board->chip_delay = (u8)val; + of_property_read_u8(pdev->dev.of_node, + "chip-delay", &board->chip_delay) } else { board = dev_get_platdata(&pdev->dev); } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] thermal: exynos: use of_property_read_u8()
use of_property_read_u8() for u8 variables, also changed the return type to void as this function return type is nowhere used. Signed-off-by: Saurabh Sengar --- drivers/thermal/samsung/exynos_tmu.c | 30 +- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index fa61eff..b692c95 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -1128,20 +1128,16 @@ static int exynos_of_get_soc_type(struct device_node *np) return -EINVAL; } -static int exynos_of_sensor_conf(struct device_node *np, +static void exynos_of_sensor_conf(struct device_node *np, struct exynos_tmu_platform_data *pdata) { - u32 value; - int ret; - of_node_get(np); - ret = of_property_read_u32(np, "samsung,tmu_gain", &value); - pdata->gain = (u8)value; - of_property_read_u32(np, "samsung,tmu_reference_voltage", &value); - pdata->reference_voltage = (u8)value; - of_property_read_u32(np, "samsung,tmu_noise_cancel_mode", &value); - pdata->noise_cancel_mode = (u8)value; + of_property_read_u8(np, "samsung,tmu_gain", &pdata->gain); + of_property_read_u8(np, "samsung,tmu_reference_voltage", + &pdata->reference_voltage); + of_property_read_u8(np, "samsung,tmu_noise_cancel_mode", + &pdata->noise_cancel_mode); of_property_read_u32(np, "samsung,tmu_efuse_value", &pdata->efuse_value); @@ -1150,18 +1146,18 @@ static int exynos_of_sensor_conf(struct device_node *np, of_property_read_u32(np, "samsung,tmu_max_efuse_value", &pdata->max_efuse_value); - of_property_read_u32(np, "samsung,tmu_first_point_trim", &value); - pdata->first_point_trim = (u8)value; - of_property_read_u32(np, "samsung,tmu_second_point_trim", &value); - pdata->second_point_trim = (u8)value; - of_property_read_u32(np, "samsung,tmu_default_temp_offset", &value); - pdata->default_temp_offset = (u8)value; + of_property_read_u8(np, "samsung,tmu_first_point_trim", + &pdata->first_point_trim); + of_property_read_u8(np, "samsung,tmu_second_point_trim", + &pdata->second_point_trim); + of_property_read_u8(np, "samsung,tmu_default_temp_offset", + &pdata->default_temp_offset); of_property_read_u32(np, "samsung,tmu_cal_type", &pdata->cal_type); of_property_read_u32(np, "samsung,tmu_cal_mode", &pdata->cal_mode); of_node_put(np); - return 0; + return; } static int exynos_map_dt_data(struct platform_device *pdev) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] net: fec: no need to test for the return type of of_property_read_u32
in case of error no need to set num_tx and num_rx = 1, because in case of error these variables will remain unchanged by of_property_read_u32 ie 1 only Signed-off-by: Saurabh Sengar --- drivers/net/ethernet/freescale/fec_main.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index b2a3220..d2328fc 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -3277,7 +3277,6 @@ static void fec_enet_get_queue_num(struct platform_device *pdev, int *num_tx, int *num_rx) { struct device_node *np = pdev->dev.of_node; - int err; *num_tx = *num_rx = 1; @@ -3285,13 +3284,9 @@ fec_enet_get_queue_num(struct platform_device *pdev, int *num_tx, int *num_rx) return; /* parse the num of tx and rx queues */ - err = of_property_read_u32(np, "fsl,num-tx-queues", num_tx); - if (err) - *num_tx = 1; + of_property_read_u32(np, "fsl,num-tx-queues", num_tx); - err = of_property_read_u32(np, "fsl,num-rx-queues", num_rx); - if (err) - *num_rx = 1; + of_property_read_u32(np, "fsl,num-rx-queues", num_rx); if (*num_tx < 1 || *num_tx > FEC_ENET_MAX_TX_QS) { dev_warn(&pdev->dev, "Invalid num_tx(=%d), fall back to 1\n", -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: net: xgene: optimizing the code
this patch does the following: 1 . remove unnecessary if, else condition 2 . reduce one variable 3 . change the return type of 2 functions to void as there return values turn out to be 0 always after above changes Signed-off-by: Saurabh Sengar --- drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 25 +--- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c index 991412c..6096d02 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c @@ -1084,7 +1084,7 @@ static const struct net_device_ops xgene_ndev_ops = { }; #ifdef CONFIG_ACPI -static int xgene_get_port_id_acpi(struct device *dev, +static void xgene_get_port_id_acpi(struct device *dev, struct xgene_enet_pdata *pdata) { acpi_status status; @@ -1097,24 +1097,19 @@ static int xgene_get_port_id_acpi(struct device *dev, pdata->port_id = temp; } - return 0; + return; } #endif -static int xgene_get_port_id_dt(struct device *dev, struct xgene_enet_pdata *pdata) +static void xgene_get_port_id_dt(struct device *dev, struct xgene_enet_pdata *pdata) { u32 id = 0; - int ret; - ret = of_property_read_u32(dev->of_node, "port-id", &id); - if (ret) { - pdata->port_id = 0; - ret = 0; - } else { - pdata->port_id = id & BIT(0); - } + of_property_read_u32(dev->of_node, "port-id", &id); - return ret; + pdata->port_id = id & BIT(0); + + return; } static int xgene_get_tx_delay(struct xgene_enet_pdata *pdata) @@ -1209,13 +1204,11 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata) } if (dev->of_node) - ret = xgene_get_port_id_dt(dev, pdata); + xgene_get_port_id_dt(dev, pdata); #ifdef CONFIG_ACPI else - ret = xgene_get_port_id_acpi(dev, pdata); + xgene_get_port_id_acpi(dev, pdata); #endif - if (ret) - return ret; if (!device_get_mac_address(dev, ndev->dev_addr, ETH_ALEN)) eth_hw_addr_random(ndev); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] memory: emif: use of_property_read_u32()
use of_property_read_u32(), it will save few steps and variables Signed-off-by: Saurabh Sengar --- drivers/memory/emif.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c index 04644e7..52a9ad1 100644 --- a/drivers/memory/emif.c +++ b/drivers/memory/emif.c @@ -1262,11 +1262,10 @@ static void __init_or_module of_get_custom_configs(struct device_node *np_emif, struct emif_data *emif) { struct emif_custom_configs *cust_cfgs = NULL; - int len; - const __be32*lpmode, *poll_intvl; + u32 lpmode = 0, poll_intvl = 0; - lpmode = of_get_property(np_emif, "low-power-mode", &len); - poll_intvl = of_get_property(np_emif, "temp-alert-poll-interval", &len); + of_property_read_u32(np_emif, "low-power-mode", &lpmode); + of_property_read_u32(np_emif, "temp-alert-poll-interval", &poll_intvl); if (lpmode || poll_intvl) cust_cfgs = devm_kzalloc(emif->dev, sizeof(*cust_cfgs), @@ -1277,7 +1276,7 @@ static void __init_or_module of_get_custom_configs(struct device_node *np_emif, if (lpmode) { cust_cfgs->mask |= EMIF_CUSTOM_CONFIG_LPMODE; - cust_cfgs->lpmode = be32_to_cpup(lpmode); + cust_cfgs->lpmode = lpmode; of_property_read_u32(np_emif, "low-power-mode-timeout-performance", &cust_cfgs->lpmode_timeout_performance); @@ -1292,11 +1291,10 @@ static void __init_or_module of_get_custom_configs(struct device_node *np_emif, if (poll_intvl) { cust_cfgs->mask |= EMIF_CUSTOM_CONFIG_TEMP_ALERT_POLL_INTERVAL; - cust_cfgs->temp_alert_poll_interval_ms = - be32_to_cpup(poll_intvl); + cust_cfgs->temp_alert_poll_interval_ms = poll_intvl; } - if (of_find_property(np_emif, "extended-temp-part", &len)) + if (of_find_property(np_emif, "extended-temp-part", NULL)) cust_cfgs->mask |= EMIF_CUSTOM_CONFIG_EXTENDED_TEMP_PART; if (!is_custom_config_valid(cust_cfgs, emif->dev)) { -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] crypto: nx: use of_property_read_u32()
use of_propert_read_u32() for reading int value, it can help reducing number of variables used Signed-off-by: Saurabh Sengar --- drivers/crypto/nx/nx-842-powernv.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/crypto/nx/nx-842-powernv.c b/drivers/crypto/nx/nx-842-powernv.c index 9ef51fa..87f7a0f 100644 --- a/drivers/crypto/nx/nx-842-powernv.c +++ b/drivers/crypto/nx/nx-842-powernv.c @@ -525,7 +525,6 @@ static int nx842_powernv_decompress(const unsigned char *in, unsigned int inlen, static int __init nx842_powernv_probe(struct device_node *dn) { struct nx842_coproc *coproc; - struct property *ct_prop, *ci_prop; unsigned int ct, ci; int chip_id; @@ -534,18 +533,16 @@ static int __init nx842_powernv_probe(struct device_node *dn) pr_err("ibm,chip-id missing\n"); return -EINVAL; } - ct_prop = of_find_property(dn, "ibm,842-coprocessor-type", NULL); - if (!ct_prop) { + + if (of_property_read_u32(dn, "ibm,842-coprocessor-type", &ct)) { pr_err("ibm,842-coprocessor-type missing\n"); return -EINVAL; } - ct = be32_to_cpu(*(unsigned int *)ct_prop->value); - ci_prop = of_find_property(dn, "ibm,842-coprocessor-instance", NULL); - if (!ci_prop) { + + if (of_property_read_u32(dn, "ibm,842-coprocessor-instance", &ci)) { pr_err("ibm,842-coprocessor-instance missing\n"); return -EINVAL; } - ci = be32_to_cpu(*(unsigned int *)ci_prop->value); coproc = kmalloc(sizeof(*coproc), GFP_KERNEL); if (!coproc) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] leds/powernv : removing NULL check
no need to explicitly check for pointer to be null, of_prop_next_string anyways return NULL, if passed pointer is NULL and hence loop will continue Signed-off-by: Saurabh Sengar --- drivers/leds/leds-powernv.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/leds/leds-powernv.c b/drivers/leds/leds-powernv.c index 1e75e1f..bc2d76e 100644 --- a/drivers/leds/leds-powernv.c +++ b/drivers/leds/leds-powernv.c @@ -256,8 +256,6 @@ static int powernv_led_classdev(struct platform_device *pdev, for_each_child_of_node(led_node, np) { p = of_find_property(np, "led-types", NULL); - if (!p) - continue; while ((cur = of_prop_next_string(p, cur)) != NULL) { powernv_led = devm_kzalloc(dev, sizeof(*powernv_led), -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] IB/mlx5: fix null dereference
removing null dereference Signed-off-by: Saurabh Sengar --- is there any better way to fix it ? as if there is no 'x' there is no way we can access 'x->lock' drivers/infiniband/hw/mlx5/qp.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index 307bdbc..613a853 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c @@ -1064,13 +1064,10 @@ static void mlx5_ib_lock_cqs(struct mlx5_ib_cq *send_cq, struct mlx5_ib_cq *recv } } else { spin_lock_irq(&send_cq->lock); - __acquire(&recv_cq->lock); } } else if (recv_cq) { spin_lock_irq(&recv_cq->lock); - __acquire(&send_cq->lock); } else { - __acquire(&send_cq->lock); __acquire(&recv_cq->lock); } } @@ -1091,15 +1088,12 @@ static void mlx5_ib_unlock_cqs(struct mlx5_ib_cq *send_cq, struct mlx5_ib_cq *re spin_unlock_irq(&recv_cq->lock); } } else { - __release(&recv_cq->lock); spin_unlock_irq(&send_cq->lock); } } else if (recv_cq) { - __release(&send_cq->lock); spin_unlock_irq(&recv_cq->lock); } else { __release(&recv_cq->lock); - __release(&send_cq->lock); } } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] regulator: of: simplifing the parsing code
On 21 November 2015 at 18:52, Mark Brown wrote: > On Fri, Nov 20, 2015 at 01:27:27PM +0530, Saurabh Sengar wrote: > >> I also have concern related to how we are passing 'regulator-mode' and >> 'regulator-initial-mode'. Currently this require a extra function to be >> set in 'of_map_mode', which can be avoided. >> These two parameters can be set directly from the device tree as in below >> patch: >> https://lkml.org/lkml/2014/1/16/263 > > No, they can't - the values we set for modes in the DT are defined per > regulator and we need to translate these into the regulator API > definitions. > What I want to say is there are only 4 possible values which can be set for initial_mode and suspend_state modes: #define REGULATOR_MODE_FAST 0x1 #define REGULATOR_MODE_NORMAL 0x2 #define REGULATOR_MODE_IDLE 0x4 #define REGULATOR_MODE_STANDBY 0x8 these are defined in include/linux/regulator/consumer.h (core regulator file). 'of_map_modes' of each regulator driver ultimately set these values only. I want to suggest that these values can directly be pass from dts. Different dts can pass different values according to the regulator they are using, no need to decode them from of_map_modes function. Let me know your comments on this. Regards, Saurabh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] gianfar: use of_property_read_bool()
use of_property_read_bool() for testing bool property Signed-off-by: Saurabh Sengar --- drivers/net/ethernet/freescale/gianfar.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 3e6b9b4..ebeea5e 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -738,7 +738,6 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) struct gfar_private *priv = NULL; struct device_node *np = ofdev->dev.of_node; struct device_node *child = NULL; - struct property *stash; u32 stash_len = 0; u32 stash_idx = 0; unsigned int num_tx_qs, num_rx_qs; @@ -854,9 +853,7 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) goto err_grp_init; } - stash = of_find_property(np, "bd-stash", NULL); - - if (stash) { + if (of_property_read_bool(np, "bd-stash")) { priv->device_flags |= FSL_GIANFAR_DEV_HAS_BD_STASHING; priv->bd_stash_en = 1; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] NFC: added the sysfs entry for nfcsim workqueue delay
I have also tested this module its successfully creating the tx_delay entry in nfc root@saurabh:/home/saurabh# ls /sys/class/nfc/nfc0/tx_delay /sys/class/nfc/nfc0/tx_delay its default value is set to 5 root@saurabh:/home/saurabh# cat /sys/class/nfc/nfc0/tx_delay 5 its changing the value correctly root@saurabh:/home/saurabh# echo 15 > /sys/class/nfc/nfc0/tx_delay root@saurabh:/home/saurabh# cat /sys/class/nfc/nfc0/tx_delay 15 and on removing the module its cleaning up without any oops Tested-by: Saurabh Sengar On 13 November 2015 at 16:48, Saurabh Sengar wrote: > added the sysfs entry for nfcsim workqueue delay, as tx_delay > > Signed-off-by: Saurabh Sengar > --- > implementing the TODO task > > drivers/nfc/nfcsim.c | 38 +++--- > 1 file changed, 35 insertions(+), 3 deletions(-) > > diff --git a/drivers/nfc/nfcsim.c b/drivers/nfc/nfcsim.c > index 26ac9e5..e77be35 100644 > --- a/drivers/nfc/nfcsim.c > +++ b/drivers/nfc/nfcsim.c > @@ -32,6 +32,8 @@ > #define NFCSIM_POLL_TARGET 2 > #define NFCSIM_POLL_DUAL (NFCSIM_POLL_INITIATOR | NFCSIM_POLL_TARGET) > > +#define TX_DEFAULT_DELAY 5 > + > struct nfcsim { > struct nfc_dev *nfc_dev; > > @@ -62,12 +64,41 @@ static struct nfcsim *dev1; > > static struct workqueue_struct *wq; > > + > +static int tx_delay = TX_DEFAULT_DELAY; > + > +static ssize_t show_tx_delay(struct device *dev, > + struct device_attribute *attr, > + char *buf) > +{ > + int n; > + > + n = scnprintf(buf, PAGE_SIZE, "%d\n", tx_delay); > + return n; > +} > + > +static ssize_t store_tx_delay(struct device *dev, > + struct device_attribute *attr, > + const char *buf, size_t count) > +{ > + if (kstrtouint(buf, 0, &tx_delay) < 0) > + return -EINVAL; > + > + if (tx_delay < 0) > + return -EINVAL; > + > + return count; > +} > + > +static DEVICE_ATTR(tx_delay, 0644, show_tx_delay, store_tx_delay); > + > static void nfcsim_cleanup_dev(struct nfcsim *dev, u8 shutdown) > { > DEV_DBG(dev, "shutdown=%d\n", shutdown); > > mutex_lock(&dev->lock); > > + device_remove_file(&dev->nfc_dev->dev, &dev_attr_tx_delay); > dev->polling_mode = NFCSIM_POLL_NONE; > dev->shutting_down = shutdown; > dev->cb = NULL; > @@ -320,10 +351,8 @@ static int nfcsim_tx(struct nfc_dev *nfc_dev, struct > nfc_target *target, > * If packet transmission occurs immediately between them, we have a > * non-stop flow of several tens of thousands SYMM packets per second > * and a burning cpu. > -* > -* TODO: Add support for a sysfs entry to control this delay. > */ > - queue_delayed_work(wq, &peer->recv_work, msecs_to_jiffies(5)); > + queue_delayed_work(wq, &peer->recv_work, msecs_to_jiffies(tx_delay)); > > mutex_unlock(&peer->lock); > > @@ -461,6 +490,9 @@ static struct nfcsim *nfcsim_init_dev(void) > if (rc) > goto free_nfc_dev; > > + rc = device_create_file(&dev->nfc_dev->dev, &dev_attr_tx_delay); > + if (rc) > + pr_err("error creating sysfs entry\n"); > return dev; > > free_nfc_dev: > -- > 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] regulator: of: simplifing the parsing code
in case of_property_read_u32 fails, it keeps the parameter unchanged so no need to test if its success and then assign the value Signed-off-by: Saurabh Sengar --- Hi Mark, I also have concern related to how we are passing 'regulator-mode' and 'regulator-initial-mode'. Currently this require a extra function to be set in 'of_map_mode', which can be avoided. These two parameters can be set directly from the device tree as in below patch: https://lkml.org/lkml/2014/1/16/263 All drivers can have only out of 4 predefined values for these parameters, define in linux/iregulator/consumer.h, its not driver specific. Please let me know your comments, if this suits you I will send a one more patch on top of this it will further simplify this code. Regards, Saurabh drivers/regulator/of_regulator.c | 41 +--- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index 499e437..61b74a9 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c @@ -51,16 +51,14 @@ static void of_get_regulation_constraints(struct device_node *np, if (min_uV && max_uV && constraints->min_uV == constraints->max_uV) constraints->apply_uV = true; - if (!of_property_read_u32(np, "regulator-microvolt-offset", &pval)) - constraints->uV_offset = pval; - if (!of_property_read_u32(np, "regulator-min-microamp", &pval)) - constraints->min_uA = pval; - if (!of_property_read_u32(np, "regulator-max-microamp", &pval)) - constraints->max_uA = pval; - - if (!of_property_read_u32(np, "regulator-input-current-limit-microamp", - &pval)) - constraints->ilim_uA = pval; + of_property_read_u32(np, "regulator-microvolt-offset", + &constraints->uV_offset); + of_property_read_u32(np, "regulator-min-microamp", + &constraints->min_uA); + of_property_read_u32(np, "regulator-max-microamp", + &constraints->max_uA); + of_property_read_u32(np, "regulator-input-current-limit-microamp", + &constraints->ilim_uA); /* Current change possible? */ if (constraints->min_uA != constraints->max_uA) @@ -79,17 +77,13 @@ static void of_get_regulation_constraints(struct device_node *np, if (of_property_read_bool(np, "regulator-allow-set-load")) constraints->valid_ops_mask |= REGULATOR_CHANGE_DRMS; - ret = of_property_read_u32(np, "regulator-ramp-delay", &pval); - if (!ret) { - if (pval) - constraints->ramp_delay = pval; - else + if (!of_property_read_u32(np, "regulator-ramp-delay", + &constraints->ramp_delay)) + if (!constraints->ramp_delay) constraints->ramp_disable = true; - } - ret = of_property_read_u32(np, "regulator-enable-ramp-delay", &pval); - if (!ret) - constraints->enable_time = pval; + of_property_read_u32(np, "regulator-enable-ramp-delay", + &constraints->enable_time); constraints->soft_start = of_property_read_bool(np, "regulator-soft-start"); @@ -107,8 +101,8 @@ static void of_get_regulation_constraints(struct device_node *np, } } - if (!of_property_read_u32(np, "regulator-system-load", &pval)) - constraints->system_load = pval; + of_property_read_u32(np, "regulator-system-load", + &constraints->system_load); constraints->over_current_protection = of_property_read_bool(np, "regulator-over-current-protection"); @@ -154,9 +148,8 @@ static void of_get_regulation_constraints(struct device_node *np, "regulator-off-in-suspend")) suspend_state->disabled = true; - if (!of_property_read_u32(suspend_np, - "regulator-suspend-microvolt", &pval)) - suspend_state->uV = pval; + of_property_read_u32(suspend_np, + "regulator-suspend-microvolt", &suspend_state->uV); of_node_put(suspend_np); suspend_state = NULL; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] lpfc: replaced kmalloc + memset with kzalloc
replacing kmalloc and memset by a single call of kzalloc Signed-off-by: Saurabh Sengar --- v2 : I didn't got any response for my initial patch, I am sending it again on top of latest kernel(today's) drivers/scsi/lpfc/lpfc_els.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index b6fa257..92dd204 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -4956,13 +4956,12 @@ lpfc_els_rcv_rdp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, if (RDP_NPORT_ID_SIZE != be32_to_cpu(rdp_req->nport_id_desc.length)) goto rjt_logerr; - rdp_context = kmalloc(sizeof(struct lpfc_rdp_context), GFP_KERNEL); + rdp_context = kzalloc(sizeof(struct lpfc_rdp_context), GFP_KERNEL); if (!rdp_context) { rjt_err = LSRJT_UNABLE_TPC; goto error; } - memset(rdp_context, 0, sizeof(struct lpfc_rdp_context)); cmd = &cmdiocb->iocb; rdp_context->ndlp = lpfc_nlp_get(ndlp); rdp_context->ox_id = cmd->unsli3.rcvsli3.ox_id; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] tty/vt/keyboard: use memdup_user to simplify code
On 28 October 2015 at 11:56, Saurabh Sengar wrote: > use memdup_user rather than duplicating implementation. > found by coccinelle > > Signed-off-by: Saurabh Sengar > --- > drivers/tty/vt/keyboard.c | 14 +- > 1 file changed, 5 insertions(+), 9 deletions(-) > > diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c > index 6f0336f..f973bfc 100644 > --- a/drivers/tty/vt/keyboard.c > +++ b/drivers/tty/vt/keyboard.c > @@ -1706,16 +1706,12 @@ int vt_do_diacrit(unsigned int cmd, void __user *udp, > int perm) > return -EINVAL; > > if (ct) { > - dia = kmalloc(sizeof(struct kbdiacr) * ct, > - GFP_KERNEL); > - if (!dia) > - return -ENOMEM; > > - if (copy_from_user(dia, a->kbdiacr, > - sizeof(struct kbdiacr) * ct)) { > - kfree(dia); > - return -EFAULT; > - } > + dia = memdup_user(a->kbdiacr, > + sizeof(struct kbdiacr) * ct); > + if (IS_ERR(dia)) > + return PTR_ERR(dia); > + > } > > spin_lock_irqsave(&kbd_event_lock, flags); > -- > 1.9.1 > Hi, Is this patch rejected for some reason or is still in queue? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: power: set IRQF_ONESHOT if no primary handler is specified
If no primary handler is specified for threaded_irq then a default one is assigned which always returns IRQ_WAKE_THREAD. This handler requires the IRQF_ONESHOT, because the source of interrupt is not disabled. Signed-off-by: Saurabh Sengar --- drivers/power/max8903_charger.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/power/max8903_charger.c b/drivers/power/max8903_charger.c index 6d39d52..17876ca 100644 --- a/drivers/power/max8903_charger.c +++ b/drivers/power/max8903_charger.c @@ -291,10 +291,10 @@ static int max8903_probe(struct platform_device *pdev) if (pdata->dc_valid) { ret = devm_request_threaded_irq(dev, gpio_to_irq(pdata->dok), - NULL, max8903_dcin, - IRQF_TRIGGER_FALLING | - IRQF_TRIGGER_RISING, - "MAX8903 DC IN", data); + NULL, max8903_dcin, + IRQF_TRIGGER_FALLING | + IRQF_TRIGGER_RISING | IRQF_ONESHOT, + "MAX8903 DC IN", data); if (ret) { dev_err(dev, "Cannot request irq %d for DC (%d)\n", gpio_to_irq(pdata->dok), ret); @@ -304,10 +304,10 @@ static int max8903_probe(struct platform_device *pdev) if (pdata->usb_valid) { ret = devm_request_threaded_irq(dev, gpio_to_irq(pdata->uok), - NULL, max8903_usbin, - IRQF_TRIGGER_FALLING | - IRQF_TRIGGER_RISING, - "MAX8903 USB IN", data); + NULL, max8903_usbin, + IRQF_TRIGGER_FALLING | + IRQF_TRIGGER_RISING | IRQF_ONESHOT, + "MAX8903 USB IN", data); if (ret) { dev_err(dev, "Cannot request irq %d for USB (%d)\n", gpio_to_irq(pdata->uok), ret); @@ -317,10 +317,10 @@ static int max8903_probe(struct platform_device *pdev) if (pdata->flt) { ret = devm_request_threaded_irq(dev, gpio_to_irq(pdata->flt), - NULL, max8903_fault, - IRQF_TRIGGER_FALLING | - IRQF_TRIGGER_RISING, - "MAX8903 Fault", data); + NULL, max8903_fault, + IRQF_TRIGGER_FALLING | + IRQF_TRIGGER_RISING | IRQF_ONESHOT, + "MAX8903 Fault", data); if (ret) { dev_err(dev, "Cannot request irq %d for Fault (%d)\n", gpio_to_irq(pdata->flt), ret); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v4] usb: chipidea: removing of_find_property
On 18 November 2015 at 12:54, Peter Chen wrote: > I am clear now, I will queue it. Thank you -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v4] usb: chipidea: removing of_find_property
On 18 November 2015 at 11:35, Peter Chen wrote: > On Wed, Nov 18, 2015 at 09:40:12AM +0530, Saurabh Sengar wrote: >> call to of_find_property() before of_property_read_u32() is unnecessary. >> of_property_read_u32() anyway calls to of_find_property() only. >> >> Signed-off-by: Saurabh Sengar >> --- >> v4 : removed return type check for optional property 'itc-setting' >> >> drivers/usb/chipidea/core.c | 57 >> + >> 1 file changed, 22 insertions(+), 35 deletions(-) >> >> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c >> index 965d0e2..3d1c3c5 100644 >> --- a/drivers/usb/chipidea/core.c >> +++ b/drivers/usb/chipidea/core.c >> @@ -688,52 +688,39 @@ static int ci_get_platdata(struct device *dev, >> if (usb_get_maximum_speed(dev) == USB_SPEED_FULL) >> platdata->flags |= CI_HDRC_FORCE_FULLSPEED; >> >> - if (of_find_property(dev->of_node, "phy-clkgate-delay-us", NULL)) >> - of_property_read_u32(dev->of_node, "phy-clkgate-delay-us", >> + of_property_read_u32(dev->of_node, "phy-clkgate-delay-us", >>&platdata->phy_clkgate_delay_us); >> >> platdata->itc_setting = 1; >> - if (of_find_property(dev->of_node, "itc-setting", NULL)) { >> - ret = of_property_read_u32(dev->of_node, "itc-setting", >> - &platdata->itc_setting); >> - if (ret) { >> - dev_err(dev, >> - "failed to get itc-setting\n"); >> - return ret; >> - } >> - } >> >> - if (of_find_property(dev->of_node, "ahb-burst-config", NULL)) { >> - ret = of_property_read_u32(dev->of_node, "ahb-burst-config", >> - &platdata->ahb_burst_config); >> - if (ret) { >> - dev_err(dev, >> - "failed to get ahb-burst-config\n"); >> - return ret; >> - } >> + of_property_read_u32(dev->of_node, "itc-setting", >> + &platdata->itc_setting); >> + >> + ret = of_property_read_u32(dev->of_node, "ahb-burst-config", >> + &platdata->ahb_burst_config); >> + if (!ret) { >> platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST; >> + } else if (ret != -EINVAL) { >> + dev_err(dev, "failed to get ahb-burst-config\n"); >> + return ret; >> } >Sorry, one more comment, why we don't quit if the 'ret' is other error >value? > > Peter We quit if error is anything other then -EINVAL. In case of -EINVAL, it means we are deliberating ignoring that property thus left it. Also the previous functionality was like this when we were using of_find_property(). Please let me know if this need to be changed, that we need to return in all kind of error, I will fix it and send it in patch v5. Regards, Saurabh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4] usb: chipidea: removing of_find_property
call to of_find_property() before of_property_read_u32() is unnecessary. of_property_read_u32() anyway calls to of_find_property() only. Signed-off-by: Saurabh Sengar --- v4 : removed return type check for optional property 'itc-setting' drivers/usb/chipidea/core.c | 57 + 1 file changed, 22 insertions(+), 35 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 965d0e2..3d1c3c5 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -688,52 +688,39 @@ static int ci_get_platdata(struct device *dev, if (usb_get_maximum_speed(dev) == USB_SPEED_FULL) platdata->flags |= CI_HDRC_FORCE_FULLSPEED; - if (of_find_property(dev->of_node, "phy-clkgate-delay-us", NULL)) - of_property_read_u32(dev->of_node, "phy-clkgate-delay-us", + of_property_read_u32(dev->of_node, "phy-clkgate-delay-us", &platdata->phy_clkgate_delay_us); platdata->itc_setting = 1; - if (of_find_property(dev->of_node, "itc-setting", NULL)) { - ret = of_property_read_u32(dev->of_node, "itc-setting", - &platdata->itc_setting); - if (ret) { - dev_err(dev, - "failed to get itc-setting\n"); - return ret; - } - } - if (of_find_property(dev->of_node, "ahb-burst-config", NULL)) { - ret = of_property_read_u32(dev->of_node, "ahb-burst-config", - &platdata->ahb_burst_config); - if (ret) { - dev_err(dev, - "failed to get ahb-burst-config\n"); - return ret; - } + of_property_read_u32(dev->of_node, "itc-setting", + &platdata->itc_setting); + + ret = of_property_read_u32(dev->of_node, "ahb-burst-config", + &platdata->ahb_burst_config); + if (!ret) { platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST; + } else if (ret != -EINVAL) { + dev_err(dev, "failed to get ahb-burst-config\n"); + return ret; } - if (of_find_property(dev->of_node, "tx-burst-size-dword", NULL)) { - ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword", - &platdata->tx_burst_size); - if (ret) { - dev_err(dev, - "failed to get tx-burst-size-dword\n"); - return ret; - } + ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword", + &platdata->tx_burst_size); + if (!ret) { platdata->flags |= CI_HDRC_OVERRIDE_TX_BURST; + } else if (ret != -EINVAL) { + dev_err(dev, "failed to get tx-burst-size-dword\n"); + return ret; } - if (of_find_property(dev->of_node, "rx-burst-size-dword", NULL)) { - ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword", - &platdata->rx_burst_size); - if (ret) { - dev_err(dev, - "failed to get rx-burst-size-dword\n"); - return ret; - } + ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword", + &platdata->rx_burst_size); + if (!ret) { platdata->flags |= CI_HDRC_OVERRIDE_RX_BURST; + } else if (ret != -EINVAL) { + dev_err(dev, "failed to get rx-burst-size-dword\n"); + return ret; } ext_id = ERR_PTR(-ENODEV); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3] usb: chipidea: removing of_find_property
Hi Peter, Yes itc_setting is still optional, in case dts does not pass this property, return type will be -EINVAL and there would be no problem. The function will break only if there is 'No data'(-ENODATA) or 'overflow'(-ENODATA) error for this property. In case this is not OK, I will send a another patch(v4) as you have suggested. Regards, Saurabh On 18 November 2015 at 09:08, Peter Chen wrote: > On Tue, Nov 17, 2015 at 05:22:26PM +0530, Saurabh Sengar wrote: >> call to of_find_property() before of_property_read_u32() is unnecessary. >> of_property_read_u32() anyway calls to of_find_property() only. >> >> Signed-off-by: Saurabh Sengar >> --- >> v2 : removed pval variable >> v3 : removed unnecessary if condition >> drivers/usb/chipidea/core.c | 59 >> +++-- >> 1 file changed, 25 insertions(+), 34 deletions(-) >> >> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c >> index 965d0e2..960a925 100644 >> --- a/drivers/usb/chipidea/core.c >> +++ b/drivers/usb/chipidea/core.c >> @@ -688,52 +688,43 @@ static int ci_get_platdata(struct device *dev, >> if (usb_get_maximum_speed(dev) == USB_SPEED_FULL) >> platdata->flags |= CI_HDRC_FORCE_FULLSPEED; >> >> - if (of_find_property(dev->of_node, "phy-clkgate-delay-us", NULL)) >> - of_property_read_u32(dev->of_node, "phy-clkgate-delay-us", >> + of_property_read_u32(dev->of_node, "phy-clkgate-delay-us", >>&platdata->phy_clkgate_delay_us); >> >> platdata->itc_setting = 1; >> - if (of_find_property(dev->of_node, "itc-setting", NULL)) { >> - ret = of_property_read_u32(dev->of_node, "itc-setting", >> - &platdata->itc_setting); >> - if (ret) { >> - dev_err(dev, >> - "failed to get itc-setting\n"); >> - return ret; >> - } >> + >> + ret = of_property_read_u32(dev->of_node, "itc-setting", >> + &platdata->itc_setting); >> + if (ret && ret != -EINVAL) { >> + dev_err(dev, "failed to get itc-setting\n"); >> + return ret; >> } > > For this one, you may not need to check return value, since > platdata->itc_setting is optional, and doesn't need to set > any flags if platdata->itc_setting is valid. > > Other changes are ok for me. > > Peter > >> >> - if (of_find_property(dev->of_node, "ahb-burst-config", NULL)) { >> - ret = of_property_read_u32(dev->of_node, "ahb-burst-config", >> - &platdata->ahb_burst_config); >> - if (ret) { >> - dev_err(dev, >> - "failed to get ahb-burst-config\n"); >> - return ret; >> - } >> + ret = of_property_read_u32(dev->of_node, "ahb-burst-config", >> + &platdata->ahb_burst_config); >> + if (!ret) { >> platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST; >> + } else if (ret != -EINVAL) { >> + dev_err(dev, "failed to get ahb-burst-config\n"); >> + return ret; >> } >> >> - if (of_find_property(dev->of_node, "tx-burst-size-dword", NULL)) { >> - ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword", >> - &platdata->tx_burst_size); >> - if (ret) { >> - dev_err(dev, >> - "failed to get tx-burst-size-dword\n"); >> - return ret; >> - } >> + ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword", >> + &platdata->tx_burst_size); >> + if (!ret) { >> platdata->flags |= CI_HDRC_OVERRIDE_TX_BURST; >> + } else if (ret != -EINVAL) { >> + dev_err(dev, "failed to get tx-burst-size-dword\n"); >> + return ret; >> } >> >> - if (of_find_property(dev->of_node, "rx-burst-size-dword", NULL)) { >> - ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword", >> -
Re: [PATCH v2] usb: chipidea: removing of_find_property
Hi Julia, You have used v2 of patch, I have sent v3 of patch too. 1:30 hour before Please use version 3 as that is the latest. version 3 : https://lkml.org/lkml/2015/11/17/243 Sorry for trouble. Regards, Saurabh On 17 November 2015 at 18:28, Julia Lawall wrote: > Please check. The code, with the blank line on line 692, looks strange. > > julia > > On Tue, 17 Nov 2015, kbuild test robot wrote: > >> CC: kbuild-...@01.org >> In-Reply-To: <1447760410-3426-1-git-send-email-saurabh.tr...@gmail.com> >> TO: Saurabh Sengar >> CC: m...@mansr.com, peter.c...@freescale.com, gre...@linuxfoundation.org, >> linux-...@vger.kernel.org, linux-kernel@vger.kernel.org, Saurabh Sengar >> >> CC: Saurabh Sengar >> >> Hi Saurabh, >> >> [auto build test WARNING on peter.chen-usb/ci-for-usb-next] >> [also build test WARNING on v4.4-rc1 next-20151117] >> >> url: >> https://github.com/0day-ci/linux/commits/Saurabh-Sengar/usb-chipidea-removing-of_find_property/20151117-194333 >> base: https://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb >> ci-for-usb-next >> :: branch date: 68 minutes ago >> :: commit date: 68 minutes ago >> >> >> drivers/usb/chipidea/core.c:693:1-27: code aligned with following code on >> >> line 695 >> >> git remote add linux-review https://github.com/0day-ci/linux >> git remote update linux-review >> git checkout 4375ac1189e900bbde912d31ec3bb66572c0784a >> vim +693 drivers/usb/chipidea/core.c >> >> 63863b98 Heikki Krogerus 2015-09-21 687if (usb_get_maximum_speed(dev) >> == USB_SPEED_FULL) >> 4f6743d5 Michael Grzeschik 2014-02-19 688platdata->flags |= >> CI_HDRC_FORCE_FULLSPEED; >> 4f6743d5 Michael Grzeschik 2014-02-19 689 >> 4375ac11 Saurabh Sengar2015-11-17 690if >> (!of_property_read_u32(dev->of_node, "phy-clkgate-delay-us", >> 4375ac11 Saurabh Sengar2015-11-17 691 >> &platdata->phy_clkgate_delay_us)) >> 1fbf4628 Fabio Estevam 2015-09-08 692 >> df96ed8d Peter Chen2014-09-22 @693platdata->itc_setting = 1; >> 4375ac11 Saurabh Sengar2015-11-17 694 >> df96ed8d Peter Chen2014-09-22 @695ret = >> of_property_read_u32(dev->of_node, "itc-setting", >> df96ed8d Peter Chen2014-09-22 696 >> &platdata->itc_setting); >> 4375ac11 Saurabh Sengar2015-11-17 697if (ret && ret != -EINVAL) { >> 4375ac11 Saurabh Sengar2015-11-17 698dev_err(dev, "failed >> to get itc-setting\n"); >> >> :: The code at line 693 was first introduced by commit >> :: df96ed8dced21426c54c7f69cf7513e75280957a usb: chipidea: introduce ITC >> tuning interface >> >> :: TO: Peter Chen >> :: CC: Peter Chen >> >> --- >> 0-DAY kernel test infrastructureOpen Source Technology Center >> https://lists.01.org/pipermail/kbuild-all Intel Corporation >> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3] usb: chipidea: removing of_find_property
call to of_find_property() before of_property_read_u32() is unnecessary. of_property_read_u32() anyway calls to of_find_property() only. Signed-off-by: Saurabh Sengar --- v2 : removed pval variable v3 : removed unnecessary if condition drivers/usb/chipidea/core.c | 59 +++-- 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 965d0e2..960a925 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -688,52 +688,43 @@ static int ci_get_platdata(struct device *dev, if (usb_get_maximum_speed(dev) == USB_SPEED_FULL) platdata->flags |= CI_HDRC_FORCE_FULLSPEED; - if (of_find_property(dev->of_node, "phy-clkgate-delay-us", NULL)) - of_property_read_u32(dev->of_node, "phy-clkgate-delay-us", + of_property_read_u32(dev->of_node, "phy-clkgate-delay-us", &platdata->phy_clkgate_delay_us); platdata->itc_setting = 1; - if (of_find_property(dev->of_node, "itc-setting", NULL)) { - ret = of_property_read_u32(dev->of_node, "itc-setting", - &platdata->itc_setting); - if (ret) { - dev_err(dev, - "failed to get itc-setting\n"); - return ret; - } + + ret = of_property_read_u32(dev->of_node, "itc-setting", + &platdata->itc_setting); + if (ret && ret != -EINVAL) { + dev_err(dev, "failed to get itc-setting\n"); + return ret; } - if (of_find_property(dev->of_node, "ahb-burst-config", NULL)) { - ret = of_property_read_u32(dev->of_node, "ahb-burst-config", - &platdata->ahb_burst_config); - if (ret) { - dev_err(dev, - "failed to get ahb-burst-config\n"); - return ret; - } + ret = of_property_read_u32(dev->of_node, "ahb-burst-config", + &platdata->ahb_burst_config); + if (!ret) { platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST; + } else if (ret != -EINVAL) { + dev_err(dev, "failed to get ahb-burst-config\n"); + return ret; } - if (of_find_property(dev->of_node, "tx-burst-size-dword", NULL)) { - ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword", - &platdata->tx_burst_size); - if (ret) { - dev_err(dev, - "failed to get tx-burst-size-dword\n"); - return ret; - } + ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword", + &platdata->tx_burst_size); + if (!ret) { platdata->flags |= CI_HDRC_OVERRIDE_TX_BURST; + } else if (ret != -EINVAL) { + dev_err(dev, "failed to get tx-burst-size-dword\n"); + return ret; } - if (of_find_property(dev->of_node, "rx-burst-size-dword", NULL)) { - ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword", - &platdata->rx_burst_size); - if (ret) { - dev_err(dev, - "failed to get rx-burst-size-dword\n"); - return ret; - } + ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword", + &platdata->rx_burst_size); + if (!ret) { platdata->flags |= CI_HDRC_OVERRIDE_RX_BURST; + } else if (ret != -EINVAL) { + dev_err(dev, "failed to get rx-burst-size-dword\n"); + return ret; } ext_id = ERR_PTR(-ENODEV); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] usb: chipidea: removing of_find_property
call to of_find_property() before of_property_read_u32() is unnecessary. of_property_read_u32() anyway calls to of_find_property() only. Signed-off-by: Saurabh Sengar --- v2: removed pval variable drivers/usb/chipidea/core.c | 61 +++-- 1 file changed, 26 insertions(+), 35 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 965d0e2..916a20d 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -688,52 +688,43 @@ static int ci_get_platdata(struct device *dev, if (usb_get_maximum_speed(dev) == USB_SPEED_FULL) platdata->flags |= CI_HDRC_FORCE_FULLSPEED; - if (of_find_property(dev->of_node, "phy-clkgate-delay-us", NULL)) - of_property_read_u32(dev->of_node, "phy-clkgate-delay-us", -&platdata->phy_clkgate_delay_us); + if (!of_property_read_u32(dev->of_node, "phy-clkgate-delay-us", +&platdata->phy_clkgate_delay_us)) platdata->itc_setting = 1; - if (of_find_property(dev->of_node, "itc-setting", NULL)) { - ret = of_property_read_u32(dev->of_node, "itc-setting", - &platdata->itc_setting); - if (ret) { - dev_err(dev, - "failed to get itc-setting\n"); - return ret; - } + + ret = of_property_read_u32(dev->of_node, "itc-setting", + &platdata->itc_setting); + if (ret && ret != -EINVAL) { + dev_err(dev, "failed to get itc-setting\n"); + return ret; } - if (of_find_property(dev->of_node, "ahb-burst-config", NULL)) { - ret = of_property_read_u32(dev->of_node, "ahb-burst-config", - &platdata->ahb_burst_config); - if (ret) { - dev_err(dev, - "failed to get ahb-burst-config\n"); - return ret; - } + ret = of_property_read_u32(dev->of_node, "ahb-burst-config", + &platdata->ahb_burst_config); + if (!ret) { platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST; + } else if (ret != -EINVAL) { + dev_err(dev, "failed to get ahb-burst-config\n"); + return ret; } - if (of_find_property(dev->of_node, "tx-burst-size-dword", NULL)) { - ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword", - &platdata->tx_burst_size); - if (ret) { - dev_err(dev, - "failed to get tx-burst-size-dword\n"); - return ret; - } + ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword", + &platdata->tx_burst_size); + if (!ret) { platdata->flags |= CI_HDRC_OVERRIDE_TX_BURST; + } else if (ret != -EINVAL) { + dev_err(dev, "failed to get tx-burst-size-dword\n"); + return ret; } - if (of_find_property(dev->of_node, "rx-burst-size-dword", NULL)) { - ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword", - &platdata->rx_burst_size); - if (ret) { - dev_err(dev, - "failed to get rx-burst-size-dword\n"); - return ret; - } + ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword", + &platdata->rx_burst_size); + if (!ret) { platdata->flags |= CI_HDRC_OVERRIDE_RX_BURST; + } else if (ret != -EINVAL) { + dev_err(dev, "failed to get rx-burst-size-dword\n"); + return ret; } ext_id = ERR_PTR(-ENODEV); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] usb: chipidea: removing of_find_property
call to of_find_property() before of_property_read_u32() is unnecessary. of_property_read_u32() anyway calls to of_find_property() only. Signed-off-by: Saurabh Sengar --- drivers/usb/chipidea/core.c | 67 ++--- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 965d0e2..8a4c22c 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -643,6 +643,7 @@ static int ci_get_platdata(struct device *dev, struct extcon_dev *ext_vbus, *ext_id; struct ci_hdrc_cable *cable; int ret; + u32 pval; if (!platdata->phy_mode) platdata->phy_mode = of_usb_get_phy_mode(dev->of_node); @@ -688,52 +689,48 @@ static int ci_get_platdata(struct device *dev, if (usb_get_maximum_speed(dev) == USB_SPEED_FULL) platdata->flags |= CI_HDRC_FORCE_FULLSPEED; - if (of_find_property(dev->of_node, "phy-clkgate-delay-us", NULL)) - of_property_read_u32(dev->of_node, "phy-clkgate-delay-us", -&platdata->phy_clkgate_delay_us); + if (!of_property_read_u32(dev->of_node, "phy-clkgate-delay-us", +&pval)) + platdata->phy_clkgate_delay_us = pval; platdata->itc_setting = 1; - if (of_find_property(dev->of_node, "itc-setting", NULL)) { - ret = of_property_read_u32(dev->of_node, "itc-setting", - &platdata->itc_setting); - if (ret) { - dev_err(dev, - "failed to get itc-setting\n"); - return ret; - } + + ret = of_property_read_u32(dev->of_node, "itc-setting", &pval); + if (!ret) + platdata->itc_setting = pval; + else if (ret != -EINVAL) { + dev_err(dev, "failed to get itc-setting\n"); + return ret; } - if (of_find_property(dev->of_node, "ahb-burst-config", NULL)) { - ret = of_property_read_u32(dev->of_node, "ahb-burst-config", - &platdata->ahb_burst_config); - if (ret) { - dev_err(dev, - "failed to get ahb-burst-config\n"); - return ret; - } + ret = of_property_read_u32(dev->of_node, "ahb-burst-config", + &pval); + if (!ret) { + platdata->ahb_burst_config = pval; platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST; + } else if (ret != -EINVAL) { + dev_err(dev, "failed to get ahb-burst-config\n"); + return ret; } - if (of_find_property(dev->of_node, "tx-burst-size-dword", NULL)) { - ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword", - &platdata->tx_burst_size); - if (ret) { - dev_err(dev, - "failed to get tx-burst-size-dword\n"); - return ret; - } + ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword", + &pval); + if (!ret) { + platdata->tx_burst_size = pval; platdata->flags |= CI_HDRC_OVERRIDE_TX_BURST; + } else if (ret != -EINVAL) { + dev_err(dev, "failed to get tx-burst-size-dword\n"); + return ret; } - if (of_find_property(dev->of_node, "rx-burst-size-dword", NULL)) { - ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword", - &platdata->rx_burst_size); - if (ret) { - dev_err(dev, - "failed to get rx-burst-size-dword\n"); - return ret; - } + ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword", + &pval); + if (!ret) { + platdata->rx_burst_size = pval; platdata->flags |= CI_HDRC_OVERRIDE_RX_BURST; + } else if (ret != -EINVAL) { + dev_err(dev, "failed to get rx-burst-size-dword\n"); + return ret; } ext_id = ERR_PTR(-ENODEV); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] usb: host: ohci-pxa27x: use of_property_read_bool()
for checking if a property is present or not, of_property_read_bool is more appropriate than of_get_property() Signed-off-by: Saurabh Sengar --- v2 : replaced then to than in description drivers/usb/host/ohci-pxa27x.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index ba1bec7..e8c006e 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c @@ -365,19 +365,19 @@ static int ohci_pxa_of_init(struct platform_device *pdev) if (!pdata) return -ENOMEM; - if (of_get_property(np, "marvell,enable-port1", NULL)) + if (of_property_read_bool(np, "marvell,enable-port1")) pdata->flags |= ENABLE_PORT1; - if (of_get_property(np, "marvell,enable-port2", NULL)) + if (of_property_read_bool(np, "marvell,enable-port2")) pdata->flags |= ENABLE_PORT2; - if (of_get_property(np, "marvell,enable-port3", NULL)) + if (of_property_read_bool(np, "marvell,enable-port3")) pdata->flags |= ENABLE_PORT3; - if (of_get_property(np, "marvell,port-sense-low", NULL)) + if (of_property_read_bool(np, "marvell,port-sense-low")) pdata->flags |= POWER_SENSE_LOW; - if (of_get_property(np, "marvell,power-control-low", NULL)) + if (of_property_read_bool(np, "marvell,power-control-low")) pdata->flags |= POWER_CONTROL_LOW; - if (of_get_property(np, "marvell,no-oc-protection", NULL)) + if (of_property_read_bool(np, "marvell,no-oc-protection")) pdata->flags |= NO_OC_PROTECTION; - if (of_get_property(np, "marvell,oc-mode-perport", NULL)) + if (of_property_read_bool(np, "marvell,oc-mode-perport")) pdata->flags |= OC_MODE_PERPORT; if (!of_property_read_u32(np, "marvell,power-on-delay", &tmp)) pdata->power_on_delay = tmp; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mfd: mc13xxx-core: use of_property_read_bool()
for checking if a property is present or not, use of_property_read_bool instead of of_get_property() Signed-off-by: Saurabh Sengar --- drivers/mfd/mc13xxx-core.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c index 3f9f4c8..d7f54e4 100644 --- a/drivers/mfd/mc13xxx-core.c +++ b/drivers/mfd/mc13xxx-core.c @@ -383,16 +383,16 @@ static int mc13xxx_probe_flags_dt(struct mc13xxx *mc13xxx) if (!np) return -ENODEV; - if (of_get_property(np, "fsl,mc13xxx-uses-adc", NULL)) + if (of_property_read_bool(np, "fsl,mc13xxx-uses-adc")) mc13xxx->flags |= MC13XXX_USE_ADC; - if (of_get_property(np, "fsl,mc13xxx-uses-codec", NULL)) + if (of_property_read_bool(np, "fsl,mc13xxx-uses-codec")) mc13xxx->flags |= MC13XXX_USE_CODEC; - if (of_get_property(np, "fsl,mc13xxx-uses-rtc", NULL)) + if (of_property_read_bool(np, "fsl,mc13xxx-uses-rtc")) mc13xxx->flags |= MC13XXX_USE_RTC; - if (of_get_property(np, "fsl,mc13xxx-uses-touch", NULL)) + if (of_property_read_bool(np, "fsl,mc13xxx-uses-touch")) mc13xxx->flags |= MC13XXX_USE_TOUCHSCREEN; return 0; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] usb: host: ohci-pxa27x: use of_property_read_bool()
for checking if a property is present or not, of_property_read_bool is more appropriate then of_get_property() Signed-off-by: Saurabh Sengar --- drivers/usb/host/ohci-pxa27x.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index ba1bec7..e8c006e 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c @@ -365,19 +365,19 @@ static int ohci_pxa_of_init(struct platform_device *pdev) if (!pdata) return -ENOMEM; - if (of_get_property(np, "marvell,enable-port1", NULL)) + if (of_property_read_bool(np, "marvell,enable-port1")) pdata->flags |= ENABLE_PORT1; - if (of_get_property(np, "marvell,enable-port2", NULL)) + if (of_property_read_bool(np, "marvell,enable-port2")) pdata->flags |= ENABLE_PORT2; - if (of_get_property(np, "marvell,enable-port3", NULL)) + if (of_property_read_bool(np, "marvell,enable-port3")) pdata->flags |= ENABLE_PORT3; - if (of_get_property(np, "marvell,port-sense-low", NULL)) + if (of_property_read_bool(np, "marvell,port-sense-low")) pdata->flags |= POWER_SENSE_LOW; - if (of_get_property(np, "marvell,power-control-low", NULL)) + if (of_property_read_bool(np, "marvell,power-control-low")) pdata->flags |= POWER_CONTROL_LOW; - if (of_get_property(np, "marvell,no-oc-protection", NULL)) + if (of_property_read_bool(np, "marvell,no-oc-protection")) pdata->flags |= NO_OC_PROTECTION; - if (of_get_property(np, "marvell,oc-mode-perport", NULL)) + if (of_property_read_bool(np, "marvell,oc-mode-perport")) pdata->flags |= OC_MODE_PERPORT; if (!of_property_read_u32(np, "marvell,power-on-delay", &tmp)) pdata->power_on_delay = tmp; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mfd: ssbi: removing unnecessary strcmp
passing the actual enum value for controller type from device tree, instead of passing the string and converting it to enum Signed-off-by: Saurabh Sengar --- Documentation/devicetree/bindings/arm/msm/ssbi.txt | 6 +++--- arch/arm/boot/dts/qcom-apq8064.dtsi| 3 ++- arch/arm/boot/dts/qcom-ipq8064.dtsi| 3 ++- arch/arm/boot/dts/qcom-msm8660.dtsi| 3 ++- arch/arm/boot/dts/qcom-msm8960.dtsi| 3 ++- drivers/mfd/ssbi.c | 17 ++--- include/dt-bindings/mfd/qcom,ssbi.h| 19 +++ 7 files changed, 36 insertions(+), 18 deletions(-) create mode 100644 include/dt-bindings/mfd/qcom,ssbi.h diff --git a/Documentation/devicetree/bindings/arm/msm/ssbi.txt b/Documentation/devicetree/bindings/arm/msm/ssbi.txt index 54fd5ce..61a37e0 100644 --- a/Documentation/devicetree/bindings/arm/msm/ssbi.txt +++ b/Documentation/devicetree/bindings/arm/msm/ssbi.txt @@ -10,9 +10,9 @@ These require the following properties: - qcom,controller-type indicates the SSBI bus variant the controller should use to talk - with the slave device. This should be one of "ssbi", "ssbi2", or - "pmic-arbiter". The type chosen is determined by the attached - slave. + with the slave device. This should be one of MSM_SBI_CTRL_SSBI, + MSM_SBI_CTRL_SSBI2 or MSM_SBI_CTRL_PMIC_ARBITER. + The type chosen is determined by the attached slave. The slave device should be the single child node of the ssbi device with a compatible field. diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi index a4c1762..e391a01 100644 --- a/arch/arm/boot/dts/qcom-apq8064.dtsi +++ b/arch/arm/boot/dts/qcom-apq8064.dtsi @@ -5,6 +5,7 @@ #include #include #include +#include #include / { model = "Qualcomm APQ8064"; @@ -339,7 +340,7 @@ qcom,ssbi@50 { compatible = "qcom,ssbi"; reg = <0x0050 0x1000>; - qcom,controller-type = "pmic-arbiter"; + qcom,controller-type = ; pmicintc: pmic@0 { compatible = "qcom,pm8921"; diff --git a/arch/arm/boot/dts/qcom-ipq8064.dtsi b/arch/arm/boot/dts/qcom-ipq8064.dtsi index fa69863..a3ba13a 100644 --- a/arch/arm/boot/dts/qcom-ipq8064.dtsi +++ b/arch/arm/boot/dts/qcom-ipq8064.dtsi @@ -3,6 +3,7 @@ #include "skeleton.dtsi" #include #include +#include #include / { @@ -307,7 +308,7 @@ qcom,ssbi@50 { compatible = "qcom,ssbi"; reg = <0x0050 0x1000>; - qcom,controller-type = "pmic-arbiter"; + qcom,controller-type = ; }; gcc: clock-controller@90 { diff --git a/arch/arm/boot/dts/qcom-msm8660.dtsi b/arch/arm/boot/dts/qcom-msm8660.dtsi index e5f7f33..51b28d2 100644 --- a/arch/arm/boot/dts/qcom-msm8660.dtsi +++ b/arch/arm/boot/dts/qcom-msm8660.dtsi @@ -4,6 +4,7 @@ #include #include +#include #include / { @@ -112,7 +113,7 @@ qcom,ssbi@50 { compatible = "qcom,ssbi"; reg = <0x50 0x1000>; - qcom,controller-type = "pmic-arbiter"; + qcom,controller-type = ; pmicintc: pmic@0 { compatible = "qcom,pm8058"; diff --git a/arch/arm/boot/dts/qcom-msm8960.dtsi b/arch/arm/boot/dts/qcom-msm8960.dtsi index 134cd91..d01cee5 100644 --- a/arch/arm/boot/dts/qcom-msm8960.dtsi +++ b/arch/arm/boot/dts/qcom-msm8960.dtsi @@ -5,6 +5,7 @@ #include #include #include +#include #include / { @@ -171,7 +172,7 @@ qcom,ssbi@50 { compatible = "qcom,ssbi"; reg = <0x50 0x1000>; - qcom,controller-type = "pmic-arbiter"; + qcom,controller-type = ; pmicintc: pmic@0 { compatible = "qcom,pm8921"; diff --git a/drivers/mfd/ssbi.c b/drivers/mfd/ssbi.c index 27986f6..cf4d983 100644 --- a/drivers/mfd/ssbi.c +++ b/drivers/mfd/ssbi.c @@ -274,7 +274,7 @@ static int ssbi_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct resource *mem_res; struct ssbi *ssbi; - const char *type; + u32 type; ssbi = devm_kzalloc(&pdev->dev, sizeof(*ssbi), GFP_KERNEL); if (!ssbi) @@ -287,22 +287,17 @@ static int ssbi_probe(struct platform_device *pdev) platform_set_drvdata(pdev, ssbi); - type = of_get_property(np, "qcom,c
Re: [PATCH] IB/sa: replace GFP_KERNEL with GFP_ATOMIC
On Fri, 13 Nov 2015 at 10:47:52 +, Wan, Kaike wrote: > I don't think so. > The following patch has rendered this patch unnecessary: > https://patchwork.kernel.org/patch/7526811/ > Kaike OK, could you please use "Reported-by" tag of my name in your patch Regards, Saurabh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] NFC: added the sysfs entry for nfcsim workqueue delay
added the sysfs entry for nfcsim workqueue delay, as tx_delay Signed-off-by: Saurabh Sengar --- implementing the TODO task drivers/nfc/nfcsim.c | 38 +++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/drivers/nfc/nfcsim.c b/drivers/nfc/nfcsim.c index 26ac9e5..e77be35 100644 --- a/drivers/nfc/nfcsim.c +++ b/drivers/nfc/nfcsim.c @@ -32,6 +32,8 @@ #define NFCSIM_POLL_TARGET 2 #define NFCSIM_POLL_DUAL (NFCSIM_POLL_INITIATOR | NFCSIM_POLL_TARGET) +#define TX_DEFAULT_DELAY 5 + struct nfcsim { struct nfc_dev *nfc_dev; @@ -62,12 +64,41 @@ static struct nfcsim *dev1; static struct workqueue_struct *wq; + +static int tx_delay = TX_DEFAULT_DELAY; + +static ssize_t show_tx_delay(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + int n; + + n = scnprintf(buf, PAGE_SIZE, "%d\n", tx_delay); + return n; +} + +static ssize_t store_tx_delay(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + if (kstrtouint(buf, 0, &tx_delay) < 0) + return -EINVAL; + + if (tx_delay < 0) + return -EINVAL; + + return count; +} + +static DEVICE_ATTR(tx_delay, 0644, show_tx_delay, store_tx_delay); + static void nfcsim_cleanup_dev(struct nfcsim *dev, u8 shutdown) { DEV_DBG(dev, "shutdown=%d\n", shutdown); mutex_lock(&dev->lock); + device_remove_file(&dev->nfc_dev->dev, &dev_attr_tx_delay); dev->polling_mode = NFCSIM_POLL_NONE; dev->shutting_down = shutdown; dev->cb = NULL; @@ -320,10 +351,8 @@ static int nfcsim_tx(struct nfc_dev *nfc_dev, struct nfc_target *target, * If packet transmission occurs immediately between them, we have a * non-stop flow of several tens of thousands SYMM packets per second * and a burning cpu. -* -* TODO: Add support for a sysfs entry to control this delay. */ - queue_delayed_work(wq, &peer->recv_work, msecs_to_jiffies(5)); + queue_delayed_work(wq, &peer->recv_work, msecs_to_jiffies(tx_delay)); mutex_unlock(&peer->lock); @@ -461,6 +490,9 @@ static struct nfcsim *nfcsim_init_dev(void) if (rc) goto free_nfc_dev; + rc = device_create_file(&dev->nfc_dev->dev, &dev_attr_tx_delay); + if (rc) + pr_err("error creating sysfs entry\n"); return dev; free_nfc_dev: -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] IB/sa: replace GFP_KERNEL with GFP_ATOMIC
On Wed, 28 Oct 2015 at 04:30:10 +, Weiny, Ira wrote: > Until we can remove the spinlock the current proposed patch should be applied > in the interim. Sorry for the noise before. > Reviewed-By: Ira Weiny Hi, is this patch expected to be applied ? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mtd: phram: error handling
> More importantly, it's good to test these cases too: > * phram is built-in (not a module), with and without a phram= line on > the commandline > * writing to /sys/module/phram/parameters/phram (for both the module > and built-in cases) Hi Brian, 1) I have tried phram as built-in, with and without phram= line in cmdline but both the time there was no phram directory found in /sys/modules, neither /dev/mtd0 (do I need to enablesome config options ?) 2) There was no 'parameters' directory inside /sys/module/phram when I used phram as module, though /dev/mtd0 and /dev/mtd0ro were present I tried searching phram in kernel/Documentation but couldn't found anything. I have few queries related to phram driver, please answer if your time permits. (Feel free to ignore if I am taking too much your time, I know these are too many :) ) Q1) Phram driver is used for accessing memory which are there but not currently mapped in system? am I correct? Q2) When I register device with junk names like phram=saurabh,0x1f700,0x400, it registers fine with name 'saurabh', isn't it wrong ? Q3) If I access some memory which does not even exist, driver still registers and even read operation is successfull to it. eg: phram=ram,8Gi,1ki (My laptop have 4GB ram but accessing 8GB address of ram) Regards, Saurabh --- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mtd: phram: error handling
Brian Norris wrote: > Well, today you're in luck! You're touching a driver that requires no > special hardware, so you should be able to test it. > I think you can try using the mem= kernel parameter (see > Documentation/kernel-parameters.txt) to restrict your system memory, and > then try using that unreachable portions of memory for phram. You can > try this driver as either a module or built-in. For the former, you can > specify the parameters during modprobe time, or later by writing to > /sys/module/phram/parameters/phram. For the latter, you can specify on > the kernel command line or in /sys/module/phram/parameters/phram. > Let me know if you have any more questions about testing your patch. Hi Brian, As you have suggested I have restricted my laptop's memory to 1GB and tried to access unreachable portion of memory(2GB). It seems to be successfully registered(this is OK right ?). I have also tested below error scenarios; all exiting gracefully - parameter too long - too many arguments - not enough arguments - invalid start adddress - invalid device length This is my first interaction with phram device so I request you to verify my testing. Below are the commands and output I did for this testing. - saurabh@saurabh:~/little/Task02/linux$ cat /proc/meminfo | grep Mem MemTotal:1016588 kB MemFree: 126016 kB MemAvailable: 295508 kB saurabh@saurabh:~/little/Task02/linux$ cat /proc/cmdline BOOT_IMAGE=/boot/vmlinuz-4.3.0-10333-gdfe4330-dirty mem=1024M root=UUID=2b66d4b2-ac21-4554-bf3b-64bc973e1dad ro quiet splash vt.handoff=7 saurabh@saurabh:~/little/Task02/linux$ sudo insmod drivers/mtd/devices/phram.ko phram=ram,2048Mi,1ki saurabh@saurabh:~/little/Task02/linux$ sudo dmesg -c [ 634.748495] phram: ram device: 0x400 at 0x8000 saurabh@saurabh:~/little/Task02/linux$ sudo insmod drivers/mtd/devices/phram.ko phram=abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz,256Mi,1Mi insmod: ERROR: could not insert module drivers/mtd/devices/phram.ko: Invalid parameters saurabh@saurabh:~/little/Task02/linux$ sudo dmesg -c [ 1469.763787] phram: parameter too long [ 1469.763797] phram: `abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz,256Mi,1Mi' invalid for parameter `phram' saurabh@saurabh:~/little/Task02/linux$ sudo insmod drivers/mtd/devices/phram.ko phram=swap,256Mi,1Mi,extra_parameter insmod: ERROR: could not insert module drivers/mtd/devices/phram.ko: Invalid parameters saurabh@saurabh:~/little/Task02/linux$ sudo dmesg -c [ 1650.081694] phram: too many arguments [ 1650.081703] phram: `swap,256Mi,1Mi,extra_parameter' invalid for parameter `phram' saurabh@saurabh:~/little/Task02/linux$ sudo insmod drivers/mtd/devices/phram.ko phram=swap,256Mi insmod: ERROR: could not insert module drivers/mtd/devices/phram.ko: Invalid parameters saurabh@saurabh:~/little/Task02/linux$ sudo dmesg -c [ 1707.437130] phram: not enough arguments [ 1707.437138] phram: `swap,256Mi' invalid for parameter `phram' saurabh@saurabh:~/little/Task02/linux$ sudo insmod drivers/mtd/devices/phram.ko phram=swap,256xyz,1Mi insmod: ERROR: could not insert module drivers/mtd/devices/phram.ko: Invalid parameters saurabh@saurabh:~/little/Task02/linux$ sudo dmesg -c [ 1783.014351] phram: invalid start address [ 1783.014359] phram: `swap,256xyz,1Mi' invalid for parameter `phram' saurabh@saurabh:~/little/Task02/linux$ sudo insmod drivers/mtd/devices/phram.ko phram=swap,256Mi,1xyz insmod: ERROR: could not insert module drivers/mtd/devices/phram.ko: Invalid parameters saurabh@saurabh:~/little/Task02/linux$ sudo dmesg -c [ 1831.746108] phram: invalid device length [ 1831.746117] phram: `swap,256Mi,1xyz' invalid for parameter `phram' --- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mtd: phram: error handling
Expand parse_err macro with hidden flow in-place. Remove the now unused parse_err macro. Miscellanea: o Use invalid not illegal for error messages Noticed-by: Brian Norris Signed-off-by: Joe Perches Signed-off-by: Saurabh Sengar --- >> I think -EINVAL makes more sense than 1. That >> could be a subsequent patch, I suppose. >That means you have to trace all the callers >to verify that converting 1 to -22 is acceptable. >Maybe Saurabh wants to do that. I have checked that function is called only by init and module param, and I understand in both the cases -EINVAL is a valid return type. Sorry, I am not able to test the driver, sending the patch as asked above. Also sorry for the noise I created in first report drivers/mtd/devices/phram.c | 29 - 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c index 8b66e52..e39fe5c 100644 --- a/drivers/mtd/devices/phram.c +++ b/drivers/mtd/devices/phram.c @@ -199,11 +199,6 @@ static inline void kill_final_newline(char *str) } -#define parse_err(fmt, args...) do { \ - pr_err(fmt , ## args); \ - return 1; \ -} while (0) - #ifndef MODULE static int phram_init_called; /* @@ -226,8 +221,10 @@ static int phram_setup(const char *val) uint64_t len; int i, ret; - if (strnlen(val, sizeof(buf)) >= sizeof(buf)) - parse_err("parameter too long\n"); + if (strnlen(val, sizeof(buf)) >= sizeof(buf)) { + pr_err("parameter too long\n"); + return -EINVAL; + } strcpy(str, val); kill_final_newline(str); @@ -235,11 +232,15 @@ static int phram_setup(const char *val) for (i = 0; i < 3; i++) token[i] = strsep(&str, ","); - if (str) - parse_err("too many arguments\n"); + if (str) { + pr_err("too many arguments\n"); + return -EINVAL; + } - if (!token[2]) - parse_err("not enough arguments\n"); + if (!token[2]) { + pr_err("not enough arguments\n"); + return -EINVAL; + } ret = parse_name(&name, token[0]); if (ret) @@ -248,13 +249,15 @@ static int phram_setup(const char *val) ret = parse_num64(&start, token[1]); if (ret) { kfree(name); - parse_err("illegal start address\n"); + pr_err("invalid start address\n"); + return -EINVAL; } ret = parse_num64(&len, token[2]); if (ret) { kfree(name); - parse_err("illegal device length\n"); + pr_err("invalid device length\n"); + return -EINVAL; } ret = register_device(name, start, len); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] dma: mic_x100: add missing spin_unlock
spin lock should be released while returning from function Signed-off-by: Saurabh Sengar --- drivers/dma/mic_x100_dma.c | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/dma/mic_x100_dma.c b/drivers/dma/mic_x100_dma.c index 068e920..7f6d477 100644 --- a/drivers/dma/mic_x100_dma.c +++ b/drivers/dma/mic_x100_dma.c @@ -317,17 +317,21 @@ mic_dma_prep_memcpy_lock(struct dma_chan *ch, dma_addr_t dma_dest, struct mic_dma_chan *mic_ch = to_mic_dma_chan(ch); struct device *dev = mic_dma_ch_to_device(mic_ch); int result; + struct dma_async_tx_descriptor *tx = NULL; if (!len && !flags) - return NULL; + return tx; spin_lock(&mic_ch->prep_lock); result = mic_dma_do_dma(mic_ch, flags, dma_src, dma_dest, len); if (result >= 0) - return allocate_tx(mic_ch); - dev_err(dev, "Error enqueueing dma, error=%d\n", result); + tx = allocate_tx(mic_ch); + + if(!tx) + dev_err(dev, "Error enqueueing dma, error=%d\n", result); + spin_unlock(&mic_ch->prep_lock); - return NULL; + return tx; } static struct dma_async_tx_descriptor * @@ -335,13 +339,14 @@ mic_dma_prep_interrupt_lock(struct dma_chan *ch, unsigned long flags) { struct mic_dma_chan *mic_ch = to_mic_dma_chan(ch); int ret; + struct dma_async_tx_descriptor *tx = NULL; spin_lock(&mic_ch->prep_lock); ret = mic_dma_do_dma(mic_ch, flags, 0, 0, 0); if (!ret) - return allocate_tx(mic_ch); + tx = allocate_tx(mic_ch); spin_unlock(&mic_ch->prep_lock); - return NULL; + return tx; } /* Return the status of the transaction */ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drm/nouveau/abi16: add missing mutex_unlock()
adding missing mutex_unlock() Signed-off-by: Saurabh Sengar --- drivers/gpu/drm/nouveau/nouveau_abi16.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c index d336c22..280bd8e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_abi16.c +++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c @@ -54,11 +54,11 @@ nouveau_abi16_get(struct drm_file *file_priv, struct drm_device *dev) if (nvif_device_init(&cli->base.object, NOUVEAU_ABI16_DEVICE, NV_DEVICE, &args, sizeof(args), -&abi16->device) == 0) - return cli->abi16; +&abi16->device)) { - kfree(cli->abi16); - cli->abi16 = NULL; + kfree(cli->abi16); + cli->abi16 = NULL; + } } mutex_unlock(&cli->mutex); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] mtd: phram: error handling
registering the device with NULL pointer can lead to crash, hence fixing it Signed-off-by: Saurabh Sengar --- > Andy Shevchenko wrote: > Hmm… Why not just checking it before an register attempt? I think user > is in right to know as many problems as they have at one shot, with > your patch if there are two problems the user has to try twice. Yes, taken your feedback, fixing it here in v2 as you recommended drivers/mtd/devices/phram.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c index 8b66e52..46b7a8a 100644 --- a/drivers/mtd/devices/phram.c +++ b/drivers/mtd/devices/phram.c @@ -257,6 +257,9 @@ static int phram_setup(const char *val) parse_err("illegal device length\n"); } + if(!name) + return -EINVAL; + ret = register_device(name, start, len); if (!ret) pr_info("%s device: %#llx at %#llx\n", name, len, start); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mtd: phram: error handling
registering the device with NULL pointer can lead to crash, hence fixing it. Signed-off-by: Saurabh Sengar --- in case of 'illegal start address' or 'illegal device length', name pointer is getting freed. we shouldn't register the device with NULL pointer. drivers/mtd/devices/phram.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c index 8b66e52..9a7aed3 100644 --- a/drivers/mtd/devices/phram.c +++ b/drivers/mtd/devices/phram.c @@ -249,12 +249,14 @@ static int phram_setup(const char *val) if (ret) { kfree(name); parse_err("illegal start address\n"); + goto err; } ret = parse_num64(&len, token[2]); if (ret) { kfree(name); parse_err("illegal device length\n"); + goto err; } ret = register_device(name, start, len); @@ -262,7 +264,7 @@ static int phram_setup(const char *val) pr_info("%s device: %#llx at %#llx\n", name, len, start); else kfree(name); - +err: return ret; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] [media] hackrf: moving pointer reference before kfree
accessing a pointer after free could possible lead to segmentation fault, hence correcting it Signed-off-by: Saurabh Sengar --- drivers/media/usb/hackrf/hackrf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/hackrf/hackrf.c b/drivers/media/usb/hackrf/hackrf.c index e05bfec..faf3670 100644 --- a/drivers/media/usb/hackrf/hackrf.c +++ b/drivers/media/usb/hackrf/hackrf.c @@ -1528,9 +1528,9 @@ err_v4l2_ctrl_handler_free_tx: err_v4l2_ctrl_handler_free_rx: v4l2_ctrl_handler_free(&dev->rx_ctrl_handler); err_kfree: + dev_dbg(dev->dev, "failed=%d\n", ret); kfree(dev); err: - dev_dbg(dev->dev, "failed=%d\n", ret); return ret; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] usb: host: pci_quirks: fix memory leak, by adding iounmap
added iounmap inorder to free memory mapped to base before returning Signed-off-by: Saurabh Sengar --- drivers/usb/host/pci-quirks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index f940056..332f687 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -990,7 +990,7 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev) /* We're reading garbage from the controller */ dev_warn(&pdev->dev, "xHCI controller failing to respond"); - return; + goto iounmap; } if (!ext_cap_offset) @@ -1061,7 +1061,7 @@ hc_init: "xHCI HW did not halt within %d usec status = 0x%x\n", XHCI_MAX_HALT_USEC, val); } - +iounmap: iounmap(base); } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] efi: replace GFP_KERNEL with GFP_ATOMIC
>It's slightly winding code, but if you look at the callers of >efivar_init() you'll see that none of them set both 'atomic' and >'duplicates', so dup_variable_bug() will never be called while holding >a spinlock. >Or am I missing something? I was assuming that there could be a possibility when both 'atomic' and 'duplicates' are set. If both can never be set, then this patch does not make any sense, you are correct. Thank you for review -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] regulator: of: removing two variables min_uV and max_uV
replacing the of_get_property function with of_property_read_u32 function as its help removing two variables. Signed-off-by: Saurabh Sengar --- Hi Mark, >> /* Only one voltage? Then make sure it's set. */ >> - if (min_uV && max_uV && constraints->min_uV == constraints->max_uV) >> + if (constraints->min_uV == constraints->max_uV) >> constraints->apply_uV = true; > Your new code is not equivalent to the existing code. The new code will > set apply_uV even if the DT properties are not present which will in > turn mean that we will end up attempting to apply a setting of 0V if > that happens which is not desirable. I have put these check back, please let me know if this v2 patch is worth drivers/regulator/of_regulator.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index 499e437..3710206 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c @@ -28,7 +28,6 @@ static void of_get_regulation_constraints(struct device_node *np, struct regulator_init_data **init_data, const struct regulator_desc *desc) { - const __be32 *min_uV, *max_uV; struct regulation_constraints *constraints = &(*init_data)->constraints; struct regulator_state *suspend_state; struct device_node *suspend_np; @@ -37,18 +36,17 @@ static void of_get_regulation_constraints(struct device_node *np, constraints->name = of_get_property(np, "regulator-name", NULL); - min_uV = of_get_property(np, "regulator-min-microvolt", NULL); - if (min_uV) - constraints->min_uV = be32_to_cpu(*min_uV); - max_uV = of_get_property(np, "regulator-max-microvolt", NULL); - if (max_uV) - constraints->max_uV = be32_to_cpu(*max_uV); + if (!of_property_read_u32(np, "regulator-min-microvolt", &pval)) + constraints->min_uV = pval; + if (!of_property_read_u32(np, "regulator-max-microvolt", &pval)) + constraints->max_uV = pval; /* Voltage change possible? */ if (constraints->min_uV != constraints->max_uV) constraints->valid_ops_mask |= REGULATOR_CHANGE_VOLTAGE; /* Only one voltage? Then make sure it's set. */ - if (min_uV && max_uV && constraints->min_uV == constraints->max_uV) + if (constraints->min_uV && constraints->max_uV + && constraints->min_uV == constraints->max_uV) constraints->apply_uV = true; if (!of_property_read_u32(np, "regulator-microvolt-offset", &pval)) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] IB/ipoib: optimized the function ipoib_mcast_alloc
ipoib_mcast_alloc is called only in atomic context, hence removing the extra check. Signed-off-by: Saurabh Sengar --- Hi, Even if in future, if there are some functions expected to call it in normal context(not atomic), we can pass the GFP_KERNEL or GFP_ATOMIC directly to function call instead of passing 0 and 1, which later again need to be compared in order to change it to GFP_KERNEL and GFP_ATOMIC. Please let me know if there are better ways to improve it. drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index d750a86..15d35be 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c @@ -132,12 +132,11 @@ void ipoib_mcast_free(struct ipoib_mcast *mcast) kfree(mcast); } -static struct ipoib_mcast *ipoib_mcast_alloc(struct net_device *dev, -int can_sleep) +static struct ipoib_mcast *ipoib_mcast_alloc(struct net_device *dev) { struct ipoib_mcast *mcast; - mcast = kzalloc(sizeof *mcast, can_sleep ? GFP_KERNEL : GFP_ATOMIC); + mcast = kzalloc(sizeof *mcast, GFP_ATOMIC); if (!mcast) return NULL; @@ -573,7 +572,7 @@ void ipoib_mcast_join_task(struct work_struct *work) if (!priv->broadcast) { struct ipoib_mcast *broadcast; - broadcast = ipoib_mcast_alloc(dev, 0); + broadcast = ipoib_mcast_alloc(dev); if (!broadcast) { ipoib_warn(priv, "failed to allocate broadcast group\n"); /* @@ -728,7 +727,7 @@ void ipoib_mcast_send(struct net_device *dev, u8 *daddr, struct sk_buff *skb) ipoib_dbg_mcast(priv, "setting up send only multicast group for %pI6\n", mgid); - mcast = ipoib_mcast_alloc(dev, 0); + mcast = ipoib_mcast_alloc(dev); if (!mcast) { ipoib_warn(priv, "unable to allocate memory " "for multicast structure\n"); @@ -886,7 +885,7 @@ void ipoib_mcast_restart_task(struct work_struct *work) ipoib_dbg_mcast(priv, "adding multicast entry for mgid %pI6\n", mgid.raw); - nmcast = ipoib_mcast_alloc(dev, 0); + nmcast = ipoib_mcast_alloc(dev); if (!nmcast) { ipoib_warn(priv, "unable to allocate memory for multicast structure\n"); continue; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] regulator: of: removing two variables min_uV and max_uV
replacing the of_get_property function with of_property_read_u32 function as its help removing two variables. also the check for min_uV and max_uV is not required, even if they are zero and equal we should set apply_uV as true Signed-off-by: Saurabh Sengar --- drivers/regulator/of_regulator.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index 250700c..e419789 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c @@ -28,7 +28,6 @@ static void of_get_regulation_constraints(struct device_node *np, struct regulator_init_data **init_data, const struct regulator_desc *desc) { - const __be32 *min_uV, *max_uV; struct regulation_constraints *constraints = &(*init_data)->constraints; struct regulator_state *suspend_state; struct device_node *suspend_np; @@ -37,18 +36,16 @@ static void of_get_regulation_constraints(struct device_node *np, constraints->name = of_get_property(np, "regulator-name", NULL); - min_uV = of_get_property(np, "regulator-min-microvolt", NULL); - if (min_uV) - constraints->min_uV = be32_to_cpu(*min_uV); - max_uV = of_get_property(np, "regulator-max-microvolt", NULL); - if (max_uV) - constraints->max_uV = be32_to_cpu(*max_uV); + if (!of_property_read_u32(np, "regulator-min-microvolt", &pval)) + constraints->min_uV = pval; + if (!of_property_read_u32(np, "regulator-max-microvolt", &pval)) + constraints->max_uV = pval; /* Voltage change possible? */ if (constraints->min_uV != constraints->max_uV) constraints->valid_ops_mask |= REGULATOR_CHANGE_VOLTAGE; /* Only one voltage? Then make sure it's set. */ - if (min_uV && max_uV && constraints->min_uV == constraints->max_uV) + if (constraints->min_uV == constraints->max_uV) constraints->apply_uV = true; if (!of_property_read_u32(np, "regulator-microvolt-offset", &pval)) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] net: rds: changing the return type from int to void
as result of function rds_iw_flush_mr_pool is nowhere checked, changing its return type from int to void. also removing the unused variable rc as there is nothing to return Signed-off-by: Saurabh Sengar --- v2 : modify patch description, as per the comments from Sergei Shtylyov net/rds/iw_rdma.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/rds/iw_rdma.c b/net/rds/iw_rdma.c index 6a8fbd6..d3d4454f 100644 --- a/net/rds/iw_rdma.c +++ b/net/rds/iw_rdma.c @@ -75,7 +75,7 @@ struct rds_iw_mr_pool { int max_pages; }; -static int rds_iw_flush_mr_pool(struct rds_iw_mr_pool *pool, int free_all); +static void rds_iw_flush_mr_pool(struct rds_iw_mr_pool *pool, int free_all); static void rds_iw_mr_pool_flush_worker(struct work_struct *work); static int rds_iw_init_fastreg(struct rds_iw_mr_pool *pool, struct rds_iw_mr *ibmr); static int rds_iw_map_fastreg(struct rds_iw_mr_pool *pool, @@ -479,14 +479,13 @@ void rds_iw_sync_mr(void *trans_private, int direction) * If the number of MRs allocated exceeds the limit, we also try * to free as many MRs as needed to get back to this limit. */ -static int rds_iw_flush_mr_pool(struct rds_iw_mr_pool *pool, int free_all) +static void rds_iw_flush_mr_pool(struct rds_iw_mr_pool *pool, int free_all) { struct rds_iw_mr *ibmr, *next; LIST_HEAD(unmap_list); LIST_HEAD(kill_list); unsigned long flags; unsigned int nfreed = 0, ncleaned = 0, unpinned = 0; - int ret = 0; rds_iw_stats_inc(s_iw_rdma_mr_pool_flush); @@ -538,7 +537,6 @@ static int rds_iw_flush_mr_pool(struct rds_iw_mr_pool *pool, int free_all) atomic_sub(nfreed, &pool->item_count); mutex_unlock(&pool->flush_lock); - return ret; } static void rds_iw_mr_pool_flush_worker(struct work_struct *work) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] NFC: added the sysfs entry for nfcsim workqueue delay
added the sysfs entry for nfcsim workqueue delay, as tx_delay Signed-off-by: Saurabh Sengar --- Hi, As I have understood form TODO comment, I have implemented the sysfs entry for this device. Sorry, in case this patch is not meeting the expectation. I am just finding my way to contribute in linux kernel :) Regards, Saurabh drivers/nfc/nfcsim.c | 38 +++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/drivers/nfc/nfcsim.c b/drivers/nfc/nfcsim.c index 93111fa..d1ace87 100644 --- a/drivers/nfc/nfcsim.c +++ b/drivers/nfc/nfcsim.c @@ -32,6 +32,8 @@ #define NFCSIM_POLL_TARGET 2 #define NFCSIM_POLL_DUAL (NFCSIM_POLL_INITIATOR | NFCSIM_POLL_TARGET) +#define TX_DEFAULT_DELAY 5 + struct nfcsim { struct nfc_dev *nfc_dev; @@ -62,12 +64,41 @@ static struct nfcsim *dev1; static struct workqueue_struct *wq; + +static int tx_delay = TX_DEFAULT_DELAY; + +static ssize_t show_tx_delay(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + int n; + + n = scnprintf(buf, PAGE_SIZE, "%d\n", tx_delay); + return n; +} + +static ssize_t store_tx_delay(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + if (kstrtouint(buf, 0, &tx_delay) < 0) + return -EINVAL; + + if (tx_delay < 0) + return -EINVAL; + + return count; +} + +static DEVICE_ATTR(tx_delay, 0644, show_tx_delay, store_tx_delay); + static void nfcsim_cleanup_dev(struct nfcsim *dev, u8 shutdown) { DEV_DBG(dev, "shutdown=%d\n", shutdown); mutex_lock(&dev->lock); + device_remove_file(&dev->nfc_dev->dev, &dev_attr_tx_delay); dev->polling_mode = NFCSIM_POLL_NONE; dev->shutting_down = shutdown; dev->cb = NULL; @@ -320,10 +351,8 @@ static int nfcsim_tx(struct nfc_dev *nfc_dev, struct nfc_target *target, * If packet transmission occurs immediately between them, we have a * non-stop flow of several tens of thousands SYMM packets per second * and a burning cpu. -* -* TODO: Add support for a sysfs entry to control this delay. */ - queue_delayed_work(wq, &peer->recv_work, msecs_to_jiffies(5)); + queue_delayed_work(wq, &peer->recv_work, msecs_to_jiffies(tx_delay)); mutex_unlock(&peer->lock); @@ -461,6 +490,9 @@ static struct nfcsim *nfcsim_init_dev(void) if (rc) goto free_nfc_dev; + rc = device_create_file(&dev->nfc_dev->dev, &dev_attr_tx_delay); + if (rc) + pr_err("error creating sysfs entry\n"); return dev; free_nfc_dev: -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] KVM: x86: removing unused variable
removing unused variables, found by coccinelle Signed-off-by: Saurabh Sengar --- arch/x86/kvm/x86.c | 16 +--- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 9a9a198..ec15294 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3424,41 +3424,35 @@ static int kvm_vm_ioctl_set_irqchip(struct kvm *kvm, struct kvm_irqchip *chip) static int kvm_vm_ioctl_get_pit(struct kvm *kvm, struct kvm_pit_state *ps) { - int r = 0; - mutex_lock(&kvm->arch.vpit->pit_state.lock); memcpy(ps, &kvm->arch.vpit->pit_state, sizeof(struct kvm_pit_state)); mutex_unlock(&kvm->arch.vpit->pit_state.lock); - return r; + return 0; } static int kvm_vm_ioctl_set_pit(struct kvm *kvm, struct kvm_pit_state *ps) { - int r = 0; - mutex_lock(&kvm->arch.vpit->pit_state.lock); memcpy(&kvm->arch.vpit->pit_state, ps, sizeof(struct kvm_pit_state)); kvm_pit_load_count(kvm, 0, ps->channels[0].count, 0); mutex_unlock(&kvm->arch.vpit->pit_state.lock); - return r; + return 0; } static int kvm_vm_ioctl_get_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps) { - int r = 0; - mutex_lock(&kvm->arch.vpit->pit_state.lock); memcpy(ps->channels, &kvm->arch.vpit->pit_state.channels, sizeof(ps->channels)); ps->flags = kvm->arch.vpit->pit_state.flags; mutex_unlock(&kvm->arch.vpit->pit_state.lock); memset(&ps->reserved, 0, sizeof(ps->reserved)); - return r; + return 0; } static int kvm_vm_ioctl_set_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps) { - int r = 0, start = 0; + int start = 0; u32 prev_legacy, cur_legacy; mutex_lock(&kvm->arch.vpit->pit_state.lock); prev_legacy = kvm->arch.vpit->pit_state.flags & KVM_PIT_FLAGS_HPET_LEGACY; @@ -3470,7 +3464,7 @@ static int kvm_vm_ioctl_set_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps) kvm->arch.vpit->pit_state.flags = ps->flags; kvm_pit_load_count(kvm, 0, kvm->arch.vpit->pit_state.channels[0].count, start); mutex_unlock(&kvm->arch.vpit->pit_state.lock); - return r; + return 0; } static int kvm_vm_ioctl_reinject(struct kvm *kvm, -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] net: rds: chnaging the return type from int to void
as return type of function rds_iw_flush_mr_pool no where checked, chnaging its return type from int to void. also removing the unused variable rc as there is nothing to return. Signed-off-by: Saurabh Sengar --- net/rds/iw_rdma.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/rds/iw_rdma.c b/net/rds/iw_rdma.c index 6a8fbd6..d3d4454f 100644 --- a/net/rds/iw_rdma.c +++ b/net/rds/iw_rdma.c @@ -75,7 +75,7 @@ struct rds_iw_mr_pool { int max_pages; }; -static int rds_iw_flush_mr_pool(struct rds_iw_mr_pool *pool, int free_all); +static void rds_iw_flush_mr_pool(struct rds_iw_mr_pool *pool, int free_all); static void rds_iw_mr_pool_flush_worker(struct work_struct *work); static int rds_iw_init_fastreg(struct rds_iw_mr_pool *pool, struct rds_iw_mr *ibmr); static int rds_iw_map_fastreg(struct rds_iw_mr_pool *pool, @@ -479,14 +479,13 @@ void rds_iw_sync_mr(void *trans_private, int direction) * If the number of MRs allocated exceeds the limit, we also try * to free as many MRs as needed to get back to this limit. */ -static int rds_iw_flush_mr_pool(struct rds_iw_mr_pool *pool, int free_all) +static void rds_iw_flush_mr_pool(struct rds_iw_mr_pool *pool, int free_all) { struct rds_iw_mr *ibmr, *next; LIST_HEAD(unmap_list); LIST_HEAD(kill_list); unsigned long flags; unsigned int nfreed = 0, ncleaned = 0, unpinned = 0; - int ret = 0; rds_iw_stats_inc(s_iw_rdma_mr_pool_flush); @@ -538,7 +537,6 @@ static int rds_iw_flush_mr_pool(struct rds_iw_mr_pool *pool, int free_all) atomic_sub(nfreed, &pool->item_count); mutex_unlock(&pool->flush_lock); - return ret; } static void rds_iw_mr_pool_flush_worker(struct work_struct *work) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4] um: net: replace GFP_KERNEL with GFP_ATOMIC when spinlock is held
since GFP_KERNEL with GFP_ATOMIC while spinlock is held, as code while holding a spinlock should be atomic. GFP_KERNEL may sleep and can cause deadlock, where as GFP_ATOMIC may fail but certainly avoids deadlockdex f70dd54..d898f6c 100644 Signed-off-by: Saurabh Sengar --- v4: fixing comments from Joe and Richard - removed variable gfp_mask in caller function - changed its type from int to gfp_t in called function arch/um/drivers/net_kern.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c index f70dd54..9ef669d 100644 --- a/arch/um/drivers/net_kern.c +++ b/arch/um/drivers/net_kern.c @@ -388,7 +388,7 @@ static const struct net_device_ops uml_netdev_ops = { static int driver_registered; static void eth_configure(int n, void *init, char *mac, - struct transport *transport) + struct transport *transport, gfp_t gfp_mask) { struct uml_net *device; struct net_device *dev; @@ -397,7 +397,7 @@ static void eth_configure(int n, void *init, char *mac, size = transport->private_size + sizeof(struct uml_net_private); - device = kzalloc(sizeof(*device), GFP_KERNEL); + device = kzalloc(sizeof(*device), gfp_mask); if (device == NULL) { printk(KERN_ERR "eth_configure failed to allocate struct " "uml_net\n"); @@ -568,7 +568,7 @@ static LIST_HEAD(transports); static LIST_HEAD(eth_cmd_line); static int check_transport(struct transport *transport, char *eth, int n, - void **init_out, char **mac_out) + void **init_out, char **mac_out, gfp_t gfp_mask) { int len; @@ -582,7 +582,7 @@ static int check_transport(struct transport *transport, char *eth, int n, else if (*eth != '\0') return 0; - *init_out = kmalloc(transport->setup_size, GFP_KERNEL); + *init_out = kmalloc(transport->setup_size, gfp_mask); if (*init_out == NULL) return 1; @@ -609,11 +609,11 @@ void register_transport(struct transport *new) list_for_each_safe(ele, next, ð_cmd_line) { eth = list_entry(ele, struct eth_init, list); match = check_transport(new, eth->init, eth->index, &init, - &mac); + &mac, GFP_KERNEL); if (!match) continue; else if (init != NULL) { - eth_configure(eth->index, init, mac, new); + eth_configure(eth->index, init, mac, new, GFP_KERNEL); kfree(init); } list_del(ð->list); @@ -631,10 +631,11 @@ static int eth_setup_common(char *str, int index) spin_lock(&transports_lock); list_for_each(ele, &transports) { transport = list_entry(ele, struct transport, list); - if (!check_transport(transport, str, index, &init, &mac)) + if (!check_transport(transport, str, index, &init, + &mac, GFP_ATOMIC)) continue; if (init != NULL) { - eth_configure(index, init, mac, transport); + eth_configure(index, init, mac, transport, GFP_ATOMIC); kfree(init); } found = 1; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3] um: net: replace GFP_KERNEL with GFP_ATOMIC when spinlock is held
replace GFP_KERNEL with GFP_ATOMIC while spinlock is held, as code while holding a spinlock should be atomic. GFP_KERNEL may sleep and can cause deadlock, where as GFP_ATOMIC may fail but certainly avoids deadlock Signed-off-by: Saurabh Sengar --- v3: removed the atomic variable, as per Richard comment arch/um/drivers/net_kern.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c index f70dd54..d898f6c 100644 --- a/arch/um/drivers/net_kern.c +++ b/arch/um/drivers/net_kern.c @@ -388,7 +388,7 @@ static const struct net_device_ops uml_netdev_ops = { static int driver_registered; static void eth_configure(int n, void *init, char *mac, - struct transport *transport) + struct transport *transport, int gfp_mask) { struct uml_net *device; struct net_device *dev; @@ -397,7 +397,7 @@ static void eth_configure(int n, void *init, char *mac, size = transport->private_size + sizeof(struct uml_net_private); - device = kzalloc(sizeof(*device), GFP_KERNEL); + device = kzalloc(sizeof(*device), gfp_mask); if (device == NULL) { printk(KERN_ERR "eth_configure failed to allocate struct " "uml_net\n"); @@ -568,7 +568,7 @@ static LIST_HEAD(transports); static LIST_HEAD(eth_cmd_line); static int check_transport(struct transport *transport, char *eth, int n, - void **init_out, char **mac_out) + void **init_out, char **mac_out, int gfp_mask) { int len; @@ -582,7 +582,7 @@ static int check_transport(struct transport *transport, char *eth, int n, else if (*eth != '\0') return 0; - *init_out = kmalloc(transport->setup_size, GFP_KERNEL); + *init_out = kmalloc(transport->setup_size, gfp_mask); if (*init_out == NULL) return 1; @@ -600,20 +600,22 @@ void register_transport(struct transport *new) void *init; char *mac = NULL; int match; + int gfp_mask; spin_lock(&transports_lock); BUG_ON(!list_empty(&new->list)); list_add(&new->list, &transports); spin_unlock(&transports_lock); + gfp_mask = GFP_KERNEL; list_for_each_safe(ele, next, ð_cmd_line) { eth = list_entry(ele, struct eth_init, list); match = check_transport(new, eth->init, eth->index, &init, - &mac); + &mac, gfp_mask); if (!match) continue; else if (init != NULL) { - eth_configure(eth->index, init, mac, new); + eth_configure(eth->index, init, mac, new, gfp_mask); kfree(init); } list_del(ð->list); @@ -627,14 +629,17 @@ static int eth_setup_common(char *str, int index) void *init; char *mac = NULL; int found = 0; + int gfp_mask; spin_lock(&transports_lock); + gfp_mask = GFP_ATOMIC; list_for_each(ele, &transports) { transport = list_entry(ele, struct transport, list); - if (!check_transport(transport, str, index, &init, &mac)) + if (!check_transport(transport, str, index, &init, + &mac, gfp_mask)) continue; if (init != NULL) { - eth_configure(index, init, mac, transport); + eth_configure(index, init, mac, transport, gfp_mask); kfree(init); } found = 1; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] um: net: replace GFP_KERNEL with GFP_ATOMIC when spinlock is held
replace GFP_KERNEL with GFP_ATOMIC while spinlock is held, as code while holding a spinlock should be atomic. GFP_KERNEL may sleep and can cause deadlock, where as GFP_ATOMIC may fail but certainly avoids deadlock Signed-off-by: Saurabh Sengar --- v2: correcting the subject arch/um/drivers/net_kern.c | 31 +++ 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c index f70dd54..7d4b709 100644 --- a/arch/um/drivers/net_kern.c +++ b/arch/um/drivers/net_kern.c @@ -388,16 +388,22 @@ static const struct net_device_ops uml_netdev_ops = { static int driver_registered; static void eth_configure(int n, void *init, char *mac, - struct transport *transport) + struct transport *transport, bool atomic) { struct uml_net *device; struct net_device *dev; struct uml_net_private *lp; int err, size; + int gfp_mask; size = transport->private_size + sizeof(struct uml_net_private); - device = kzalloc(sizeof(*device), GFP_KERNEL); + if (atomic) + gfp_mask = GFP_ATOMIC; + else + gfp_mask = GFP_KERNEL; + + device = kzalloc(sizeof(*device), gfp_mask); if (device == NULL) { printk(KERN_ERR "eth_configure failed to allocate struct " "uml_net\n"); @@ -568,9 +574,10 @@ static LIST_HEAD(transports); static LIST_HEAD(eth_cmd_line); static int check_transport(struct transport *transport, char *eth, int n, - void **init_out, char **mac_out) + void **init_out, char **mac_out, bool atomic) { int len; + int gfp_mask; len = strlen(transport->name); if (strncmp(eth, transport->name, len)) @@ -582,7 +589,12 @@ static int check_transport(struct transport *transport, char *eth, int n, else if (*eth != '\0') return 0; - *init_out = kmalloc(transport->setup_size, GFP_KERNEL); + if (atomic) + gfp_mask = GFP_ATOMIC; + else + gfp_mask = GFP_KERNEL; + + *init_out = kmalloc(transport->setup_size, gfp_mask); if (*init_out == NULL) return 1; @@ -600,6 +612,7 @@ void register_transport(struct transport *new) void *init; char *mac = NULL; int match; + bool atomic = false; spin_lock(&transports_lock); BUG_ON(!list_empty(&new->list)); @@ -609,11 +622,11 @@ void register_transport(struct transport *new) list_for_each_safe(ele, next, ð_cmd_line) { eth = list_entry(ele, struct eth_init, list); match = check_transport(new, eth->init, eth->index, &init, - &mac); + &mac, atomic); if (!match) continue; else if (init != NULL) { - eth_configure(eth->index, init, mac, new); + eth_configure(eth->index, init, mac, new, atomic); kfree(init); } list_del(ð->list); @@ -627,14 +640,16 @@ static int eth_setup_common(char *str, int index) void *init; char *mac = NULL; int found = 0; + bool atomic = false; spin_lock(&transports_lock); + atomic = true; list_for_each(ele, &transports) { transport = list_entry(ele, struct transport, list); - if (!check_transport(transport, str, index, &init, &mac)) + if (!check_transport(transport, str, index, &init, &mac, atomic)) continue; if (init != NULL) { - eth_configure(index, init, mac, transport); + eth_configure(index, init, mac, transport, atomic); kfree(init); } found = 1; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] git: um: replace GFP_KERNEL with GFP_ATOMIC while spinlock is held
replace GFP_KERNEL with GFP_ATOMIC while spinlock is held, as code while holding a spinlock should be atomic. GFP_KERNEL may sleep and can cause deadlock, where as GFP_ATOMIC may fail but certainly avoids deadlock Signed-off-by: Saurabh Sengar --- arch/um/drivers/net_kern.c | 31 +++ 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c index f70dd54..7d4b709 100644 --- a/arch/um/drivers/net_kern.c +++ b/arch/um/drivers/net_kern.c @@ -388,16 +388,22 @@ static const struct net_device_ops uml_netdev_ops = { static int driver_registered; static void eth_configure(int n, void *init, char *mac, - struct transport *transport) + struct transport *transport, bool atomic) { struct uml_net *device; struct net_device *dev; struct uml_net_private *lp; int err, size; + int gfp_mask; size = transport->private_size + sizeof(struct uml_net_private); - device = kzalloc(sizeof(*device), GFP_KERNEL); + if (atomic) + gfp_mask = GFP_ATOMIC; + else + gfp_mask = GFP_KERNEL; + + device = kzalloc(sizeof(*device), gfp_mask); if (device == NULL) { printk(KERN_ERR "eth_configure failed to allocate struct " "uml_net\n"); @@ -568,9 +574,10 @@ static LIST_HEAD(transports); static LIST_HEAD(eth_cmd_line); static int check_transport(struct transport *transport, char *eth, int n, - void **init_out, char **mac_out) + void **init_out, char **mac_out, bool atomic) { int len; + int gfp_mask; len = strlen(transport->name); if (strncmp(eth, transport->name, len)) @@ -582,7 +589,12 @@ static int check_transport(struct transport *transport, char *eth, int n, else if (*eth != '\0') return 0; - *init_out = kmalloc(transport->setup_size, GFP_KERNEL); + if (atomic) + gfp_mask = GFP_ATOMIC; + else + gfp_mask = GFP_KERNEL; + + *init_out = kmalloc(transport->setup_size, gfp_mask); if (*init_out == NULL) return 1; @@ -600,6 +612,7 @@ void register_transport(struct transport *new) void *init; char *mac = NULL; int match; + bool atomic = false; spin_lock(&transports_lock); BUG_ON(!list_empty(&new->list)); @@ -609,11 +622,11 @@ void register_transport(struct transport *new) list_for_each_safe(ele, next, ð_cmd_line) { eth = list_entry(ele, struct eth_init, list); match = check_transport(new, eth->init, eth->index, &init, - &mac); + &mac, atomic); if (!match) continue; else if (init != NULL) { - eth_configure(eth->index, init, mac, new); + eth_configure(eth->index, init, mac, new, atomic); kfree(init); } list_del(ð->list); @@ -627,14 +640,16 @@ static int eth_setup_common(char *str, int index) void *init; char *mac = NULL; int found = 0; + bool atomic = false; spin_lock(&transports_lock); + atomic = true; list_for_each(ele, &transports) { transport = list_entry(ele, struct transport, list); - if (!check_transport(transport, str, index, &init, &mac)) + if (!check_transport(transport, str, index, &init, &mac, atomic)) continue; if (init != NULL) { - eth_configure(index, init, mac, transport); + eth_configure(index, init, mac, transport, atomic); kfree(init); } found = 1; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3] audit: removing unused variable
variable rc is unnecessary hence removing it, also as the return type of function audit_log_common_recv_msg is no where used changing it to void. Signed-off-by: Saurabh Sengar --- kernel/audit.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/kernel/audit.c b/kernel/audit.c index 662c007..a89b2b1 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -684,25 +684,22 @@ static int audit_netlink_ok(struct sk_buff *skb, u16 msg_type) return err; } -static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type) +static void audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type) { - int rc = 0; uid_t uid = from_kuid(&init_user_ns, current_uid()); pid_t pid = task_tgid_nr(current); if (!audit_enabled && msg_type != AUDIT_USER_AVC) { *ab = NULL; - return rc; + return; } *ab = audit_log_start(NULL, GFP_KERNEL, msg_type); if (unlikely(!*ab)) - return rc; + return; audit_log_format(*ab, "pid=%d uid=%u", pid, uid); audit_log_session_info(*ab); audit_log_task_context(*ab); - - return rc; } int is_audit_feature_set(int i) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] audit: removing unused variable
variable rc is unnecessary hence removing it, also as the return type of function audit_log_common_recv_msg is no where used changing it to void. Signed-off-by: Saurabh Sengar --- kernel/audit.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/kernel/audit.c b/kernel/audit.c index 662c007..b572115 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -684,25 +684,24 @@ static int audit_netlink_ok(struct sk_buff *skb, u16 msg_type) return err; } -static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type) +static void audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type) { - int rc = 0; uid_t uid = from_kuid(&init_user_ns, current_uid()); pid_t pid = task_tgid_nr(current); if (!audit_enabled && msg_type != AUDIT_USER_AVC) { *ab = NULL; - return rc; + return ; } *ab = audit_log_start(NULL, GFP_KERNEL, msg_type); if (unlikely(!*ab)) - return rc; + return ; audit_log_format(*ab, "pid=%d uid=%u", pid, uid); audit_log_session_info(*ab); audit_log_task_context(*ab); - return rc; + return ; } int is_audit_feature_set(int i) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] tty: serial: sa1100.c: use UPIO_MEM rather than SERIAL_IO_MEM
Thank you Peter, for your explanation. Regards, Saurabh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] usb : replace dma_pool_alloc and memset with dma_pool_zalloc
replace dma_pool_alloc and memset with a single call to dma_pool_zalloc Signed-off-by: Saurabh Sengar --- drivers/usb/chipidea/udc.c | 3 +-- drivers/usb/gadget/udc/gr_udc.c | 3 +-- drivers/usb/host/uhci-q.c | 3 +-- drivers/usb/host/whci/qset.c| 3 +-- drivers/usb/host/xhci-mem.c | 6 ++ 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 8223fe7..235b948f 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -349,14 +349,13 @@ static int add_td_to_list(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq, if (node == NULL) return -ENOMEM; - node->ptr = dma_pool_alloc(hwep->td_pool, GFP_ATOMIC, + node->ptr = dma_pool_zalloc(hwep->td_pool, GFP_ATOMIC, &node->dma); if (node->ptr == NULL) { kfree(node); return -ENOMEM; } - memset(node->ptr, 0, sizeof(struct ci_hw_td)); node->ptr->token = cpu_to_le32(length << __ffs(TD_TOTAL_BYTES)); node->ptr->token &= cpu_to_le32(TD_TOTAL_BYTES); node->ptr->token |= cpu_to_le32(TD_STATUS_ACTIVE); diff --git a/drivers/usb/gadget/udc/gr_udc.c b/drivers/usb/gadget/udc/gr_udc.c index b9429bc..39b7136 100644 --- a/drivers/usb/gadget/udc/gr_udc.c +++ b/drivers/usb/gadget/udc/gr_udc.c @@ -253,13 +253,12 @@ static struct gr_dma_desc *gr_alloc_dma_desc(struct gr_ep *ep, gfp_t gfp_flags) dma_addr_t paddr; struct gr_dma_desc *dma_desc; - dma_desc = dma_pool_alloc(ep->dev->desc_pool, gfp_flags, &paddr); + dma_desc = dma_pool_zalloc(ep->dev->desc_pool, gfp_flags, &paddr); if (!dma_desc) { dev_err(ep->dev->dev, "Could not allocate from DMA pool\n"); return NULL; } - memset(dma_desc, 0, sizeof(*dma_desc)); dma_desc->paddr = paddr; return dma_desc; diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c index da6f56d..c17ea15 100644 --- a/drivers/usb/host/uhci-q.c +++ b/drivers/usb/host/uhci-q.c @@ -248,11 +248,10 @@ static struct uhci_qh *uhci_alloc_qh(struct uhci_hcd *uhci, dma_addr_t dma_handle; struct uhci_qh *qh; - qh = dma_pool_alloc(uhci->qh_pool, GFP_ATOMIC, &dma_handle); + qh = dma_pool_zalloc(uhci->qh_pool, GFP_ATOMIC, &dma_handle); if (!qh) return NULL; - memset(qh, 0, sizeof(*qh)); qh->dma_handle = dma_handle; qh->element = UHCI_PTR_TERM(uhci); diff --git a/drivers/usb/host/whci/qset.c b/drivers/usb/host/whci/qset.c index dc31c42..3297473 100644 --- a/drivers/usb/host/whci/qset.c +++ b/drivers/usb/host/whci/qset.c @@ -30,10 +30,9 @@ struct whc_qset *qset_alloc(struct whc *whc, gfp_t mem_flags) struct whc_qset *qset; dma_addr_t dma; - qset = dma_pool_alloc(whc->qset_pool, mem_flags, &dma); + qset = dma_pool_zalloc(whc->qset_pool, mem_flags, &dma); if (qset == NULL) return NULL; - memset(qset, 0, sizeof(struct whc_qset)); qset->qset_dma = dma; qset->whc = whc; diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 41f841f..060c20c 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -47,13 +47,12 @@ static struct xhci_segment *xhci_segment_alloc(struct xhci_hcd *xhci, if (!seg) return NULL; - seg->trbs = dma_pool_alloc(xhci->segment_pool, flags, &dma); + seg->trbs = dma_pool_zalloc(xhci->segment_pool, flags, &dma); if (!seg->trbs) { kfree(seg); return NULL; } - memset(seg->trbs, 0, TRB_SEGMENT_SIZE); /* If the cycle state is 0, set the cycle bit to 1 for all the TRBs */ if (cycle_state == 0) { for (i = 0; i < TRBS_PER_SEGMENT; i++) @@ -517,12 +516,11 @@ static struct xhci_container_ctx *xhci_alloc_container_ctx(struct xhci_hcd *xhci if (type == XHCI_CTX_TYPE_INPUT) ctx->size += CTX_SIZE(xhci->hcc_params); - ctx->bytes = dma_pool_alloc(xhci->device_pool, flags, &ctx->dma); + ctx->bytes = dma_pool_zalloc(xhci->device_pool, flags, &ctx->dma); if (!ctx->bytes) { kfree(ctx); return NULL; } - memset(ctx->bytes, 0, ctx->size); return ctx; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] lpfc: replaced kmalloc + memset with kzalloc
replacing kmalloc and memset by a single call of kzalloc Signed-off-by: Saurabh Sengar --- drivers/scsi/lpfc/lpfc_els.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 36bf58b..9729ab1 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -4990,13 +4990,12 @@ lpfc_els_rcv_rdp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, if (RDP_NPORT_ID_SIZE != be32_to_cpu(rdp_req->nport_id_desc.length)) goto rjt_logerr; - rdp_context = kmalloc(sizeof(struct lpfc_rdp_context), GFP_KERNEL); + rdp_context = kzalloc(sizeof(struct lpfc_rdp_context), GFP_KERNEL); if (!rdp_context) { rjt_err = LSRJT_UNABLE_TPC; goto error; } - memset(rdp_context, 0, sizeof(struct lpfc_rdp_context)); cmd = &cmdiocb->iocb; rdp_context->ndlp = lpfc_nlp_get(ndlp); rdp_context->ox_id = cmd->unsli3.rcvsli3.ox_id; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] tty/vt/keyboard: use memdup_user to simplify code
use memdup_user rather than duplicating implementation. found by coccinelle Signed-off-by: Saurabh Sengar --- drivers/tty/vt/keyboard.c | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c index 6f0336f..f973bfc 100644 --- a/drivers/tty/vt/keyboard.c +++ b/drivers/tty/vt/keyboard.c @@ -1706,16 +1706,12 @@ int vt_do_diacrit(unsigned int cmd, void __user *udp, int perm) return -EINVAL; if (ct) { - dia = kmalloc(sizeof(struct kbdiacr) * ct, - GFP_KERNEL); - if (!dia) - return -ENOMEM; - if (copy_from_user(dia, a->kbdiacr, - sizeof(struct kbdiacr) * ct)) { - kfree(dia); - return -EFAULT; - } + dia = memdup_user(a->kbdiacr, + sizeof(struct kbdiacr) * ct); + if (IS_ERR(dia)) + return PTR_ERR(dia); + } spin_lock_irqsave(&kbd_event_lock, flags); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: power: always set IRQF_ONESHOT if no primary handler is specified
If no primary handler is specified then a default one is assigned which always returns IRQ_WAKE_THREAD. This handler requires the IRQF_ONESHOT, because the source of interrupt is not disabled. Signed-off-by: Saurabh Sengar --- drivers/power/max8903_charger.c | 9 ++--- drivers/power/wm831x_power.c| 13 ++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/power/max8903_charger.c b/drivers/power/max8903_charger.c index bf2b4b3..0488e74 100644 --- a/drivers/power/max8903_charger.c +++ b/drivers/power/max8903_charger.c @@ -301,7 +301,8 @@ static int max8903_probe(struct platform_device *pdev) if (pdata->dc_valid) { ret = request_threaded_irq(gpio_to_irq(pdata->dok), NULL, max8903_dcin, - IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, + IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING + | IRQF_ONESHOT, "MAX8903 DC IN", data); if (ret) { dev_err(dev, "Cannot request irq %d for DC (%d)\n", @@ -313,7 +314,8 @@ static int max8903_probe(struct platform_device *pdev) if (pdata->usb_valid) { ret = request_threaded_irq(gpio_to_irq(pdata->uok), NULL, max8903_usbin, - IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, + IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING + | IRQF_ONESHOT, "MAX8903 USB IN", data); if (ret) { dev_err(dev, "Cannot request irq %d for USB (%d)\n", @@ -325,7 +327,8 @@ static int max8903_probe(struct platform_device *pdev) if (pdata->flt) { ret = request_threaded_irq(gpio_to_irq(pdata->flt), NULL, max8903_fault, - IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, + IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING + | IRQF_ONESHOT, "MAX8903 Fault", data); if (ret) { dev_err(dev, "Cannot request irq %d for Fault (%d)\n", diff --git a/drivers/power/wm831x_power.c b/drivers/power/wm831x_power.c index db11ae6..f2f5bae 100644 --- a/drivers/power/wm831x_power.c +++ b/drivers/power/wm831x_power.c @@ -572,8 +572,8 @@ static int wm831x_power_probe(struct platform_device *pdev) irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "SYSLO")); ret = request_threaded_irq(irq, NULL, wm831x_syslo_irq, - IRQF_TRIGGER_RISING, "System power low", - power); + IRQF_TRIGGER_RISING | IRQF_ONESHOT, + "System power low", power); if (ret != 0) { dev_err(&pdev->dev, "Failed to request SYSLO IRQ %d: %d\n", irq, ret); @@ -582,8 +582,8 @@ static int wm831x_power_probe(struct platform_device *pdev) irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "PWR SRC")); ret = request_threaded_irq(irq, NULL, wm831x_pwr_src_irq, - IRQF_TRIGGER_RISING, "Power source", - power); + IRQF_TRIGGER_RISING | IRQF_ONESHOT, + "Power source", power); if (ret != 0) { dev_err(&pdev->dev, "Failed to request PWR SRC IRQ %d: %d\n", irq, ret); @@ -595,9 +595,8 @@ static int wm831x_power_probe(struct platform_device *pdev) platform_get_irq_byname(pdev, wm831x_bat_irqs[i])); ret = request_threaded_irq(irq, NULL, wm831x_bat_irq, - IRQF_TRIGGER_RISING, - wm831x_bat_irqs[i], - power); + IRQF_TRIGGER_RISING | IRQF_ONESHOT, + wm831x_bat_irqs[i], power); if (ret != 0) { dev_err(&pdev->dev, "Failed to request %s IRQ %d: %d\n", -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] audit: removing unused variable
variavle rc in not required as it is just used for unchanged for return, and return is always 0 in the function. Signed-off-by: Saurabh Sengar --- kernel/audit.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kernel/audit.c b/kernel/audit.c index 662c007..409482f 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -686,23 +686,22 @@ static int audit_netlink_ok(struct sk_buff *skb, u16 msg_type) static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type) { - int rc = 0; uid_t uid = from_kuid(&init_user_ns, current_uid()); pid_t pid = task_tgid_nr(current); if (!audit_enabled && msg_type != AUDIT_USER_AVC) { *ab = NULL; - return rc; + return 0; } *ab = audit_log_start(NULL, GFP_KERNEL, msg_type); if (unlikely(!*ab)) - return rc; + return 0; audit_log_format(*ab, "pid=%d uid=%u", pid, uid); audit_log_session_info(*ab); audit_log_task_context(*ab); - return rc; + return 0; } int is_audit_feature_set(int i) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] efi: replace GFP_KERNEL with GFP_ATOMIC
replace GFP_KERNEL with GFP_ATOMIC, as code while holding a spinlock should be atomic GFP_KERNEL may sleep and can cause deadlock, where as GFP_ATOMIC may fail but certainly avoids deadlock Signed-off-by: Saurabh Sengar --- drivers/firmware/efi/vars.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c index 70a0fb1..d4eeebf 100644 --- a/drivers/firmware/efi/vars.c +++ b/drivers/firmware/efi/vars.c @@ -322,10 +322,11 @@ static unsigned long var_name_strnsize(efi_char16_t *variable_name, * disable the sysfs workqueue since the firmware is buggy. */ static void dup_variable_bug(efi_char16_t *str16, efi_guid_t *vendor_guid, -unsigned long len16) +unsigned long len16, bool atomic) { size_t i, len8 = len16 / sizeof(efi_char16_t); char *str8; + int gfp_mask; /* * Disable the workqueue since the algorithm it uses for @@ -334,7 +335,12 @@ static void dup_variable_bug(efi_char16_t *str16, efi_guid_t *vendor_guid, */ efivar_wq_enabled = false; - str8 = kzalloc(len8, GFP_KERNEL); + if (atomic) + gfp_mask = GFP_ATOMIC; + else + gfp_mask = GFP_KERNEL; + + str8 = kzalloc(len8, gfp_mask); if (!str8) return; @@ -408,7 +414,7 @@ int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *), if (duplicates && variable_is_present(variable_name, &vendor_guid, head)) { dup_variable_bug(variable_name, &vendor_guid, -variable_name_size); +variable_name_size, atomic); if (!atomic) spin_lock_irq(&__efivars->lock); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3] PM / suspend: replacing printk
replacing printk(s) with appropriate pr_info and pr_err in order to fix checkpatch.pl warnings Signed-off-by: Saurabh Sengar --- kernel/power/suspend.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 7e4cda4..7fec885 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -245,7 +245,7 @@ static int suspend_test(int level) { #ifdef CONFIG_PM_DEBUG if (pm_test_level == level) { - printk(KERN_INFO "suspend debug: Waiting for %d second(s).\n", + pr_info("suspend debug: Waiting for %d second(s).\n", pm_test_delay); mdelay(pm_test_delay * 1000); return 1; @@ -317,7 +317,7 @@ static int suspend_enter(suspend_state_t state, bool *wakeup) error = dpm_suspend_late(PMSG_SUSPEND); if (error) { - printk(KERN_ERR "PM: late suspend of devices failed\n"); + pr_err("PM: late suspend of devices failed\n"); goto Platform_finish; } error = platform_suspend_prepare_late(state); @@ -326,7 +326,7 @@ static int suspend_enter(suspend_state_t state, bool *wakeup) error = dpm_suspend_noirq(PMSG_SUSPEND); if (error) { - printk(KERN_ERR "PM: noirq suspend of devices failed\n"); + pr_err("PM: noirq suspend of devices failed\n"); goto Platform_early_resume; } error = platform_suspend_prepare_noirq(state); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3] PM / suspend: replacing printk
replacing printk(s) with appropriate pr_info and pr_err in order to fix checkpatch.pl warnings. Signed-off-by: Saurabh Sengar --- kernel/power/suspend.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 7e4cda4..7fec885 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -245,7 +245,7 @@ static int suspend_test(int level) { #ifdef CONFIG_PM_DEBUG if (pm_test_level == level) { - printk(KERN_INFO "suspend debug: Waiting for %d second(s).\n", + pr_info("suspend debug: Waiting for %d second(s).\n", pm_test_delay); mdelay(pm_test_delay * 1000); return 1; @@ -317,7 +317,7 @@ static int suspend_enter(suspend_state_t state, bool *wakeup) error = dpm_suspend_late(PMSG_SUSPEND); if (error) { - printk(KERN_ERR "PM: late suspend of devices failed\n"); + pr_err("PM: late suspend of devices failed\n"); goto Platform_finish; } error = platform_suspend_prepare_late(state); @@ -326,7 +326,7 @@ static int suspend_enter(suspend_state_t state, bool *wakeup) error = dpm_suspend_noirq(PMSG_SUSPEND); if (error) { - printk(KERN_ERR "PM: noirq suspend of devices failed\n"); + pr_err("PM: noirq suspend of devices failed\n"); goto Platform_early_resume; } error = platform_suspend_prepare_noirq(state); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] PM / suspend: replacing printk
replacing prink(s) with appropriate pr_info and pr_err Signed-off-by: Saurabh Sengar --- kernel/power/suspend.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 7e4cda4..2d8856b 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -245,7 +245,7 @@ static int suspend_test(int level) { #ifdef CONFIG_PM_DEBUG if (pm_test_level == level) { - printk(KERN_INFO "suspend debug: Waiting for %d second(s).\n", + pr_info("suspend debug: Waiting for %d second(s).", pm_test_delay); mdelay(pm_test_delay * 1000); return 1; @@ -317,7 +317,7 @@ static int suspend_enter(suspend_state_t state, bool *wakeup) error = dpm_suspend_late(PMSG_SUSPEND); if (error) { - printk(KERN_ERR "PM: late suspend of devices failed\n"); + pr_err("PM: late suspend of devices failed"); goto Platform_finish; } error = platform_suspend_prepare_late(state); @@ -326,7 +326,7 @@ static int suspend_enter(suspend_state_t state, bool *wakeup) error = dpm_suspend_noirq(PMSG_SUSPEND); if (error) { - printk(KERN_ERR "PM: noirq suspend of devices failed\n"); + pr_err("PM: noirq suspend of devices failed"); goto Platform_early_resume; } error = platform_suspend_prepare_noirq(state); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] efi: replace GFP_KERNEL with GFP_ATOMIC
replace GFP_KERNEL with GFP_ATOMIC, as code while holding a spinlock should be atomic GFP_KERNEL may sleep and can cause deadlock, where as GFP_ATOMIC may fail but certainly avoids deadlock Signed-off-by: Saurabh Sengar --- drivers/firmware/efi/vars.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c index 70a0fb1..c07de85 100644 --- a/drivers/firmware/efi/vars.c +++ b/drivers/firmware/efi/vars.c @@ -334,7 +334,7 @@ static void dup_variable_bug(efi_char16_t *str16, efi_guid_t *vendor_guid, */ efivar_wq_enabled = false; - str8 = kzalloc(len8, GFP_KERNEL); + str8 = kzalloc(len8, GFP_ATOMIC); if (!str8) return; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] IB/sa: replace GFP_KERNEL with GFP_ATOMIC
replace GFP_KERNEL with GFP_ATOMIC, as code while holding a spinlock should be atomic GFP_KERNEL may sleep and can cause deadlock, where as GFP_ATOMIC may fail but certainly avoids deadlock Signed-off-by: Saurabh Sengar --- drivers/infiniband/core/sa_query.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index 8c014b3..cd1f911 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c @@ -526,7 +526,7 @@ static int ib_nl_send_msg(struct ib_sa_query *query) if (len <= 0) return -EMSGSIZE; - skb = nlmsg_new(len, GFP_KERNEL); + skb = nlmsg_new(len, GFP_ATOMIC); if (!skb) return -ENOMEM; @@ -544,7 +544,7 @@ static int ib_nl_send_msg(struct ib_sa_query *query) /* Repair the nlmsg header length */ nlmsg_end(skb, nlh); - ret = ibnl_multicast(skb, nlh, RDMA_NL_GROUP_LS, GFP_KERNEL); + ret = ibnl_multicast(skb, nlh, RDMA_NL_GROUP_LS, GFP_ATOMIC); if (!ret) ret = len; else -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/