* [PATCH 1/2] staging: kpc2000: resolve various code style issues
@ 2020-10-21 3:03 Deepak R Varma
2020-10-21 3:04 ` [PATCH 2/2] staging: kpc2000: Use BIT macro instead of bit masking Deepak R Varma
2020-10-21 4:41 ` [Outreachy kernel] [PATCH 1/2] staging: kpc2000: resolve various code style issues Vaishali Thakkar
0 siblings, 2 replies; 5+ messages in thread
From: Deepak R Varma @ 2020-10-21 3:03 UTC (permalink / raw)
To: Greg Kroah-Hartman, outreachy-kernel, devel; +Cc: mh12gx2825
Multiple issues reported by checkpatch script around lines exceeding 100
columns, indentation of function parameters, extra blank lines. These
code formatting changes improves the code readability.
Signed-off-by: Deepak R Varma <mh12gx2825@gmail.com>
---
drivers/staging/kpc2000/kpc2000/cell_probe.c | 71 ++++++++++++++-----
drivers/staging/kpc2000/kpc2000/core.c | 3 +-
.../staging/kpc2000/kpc2000/dma_common_defs.h | 3 +-
3 files changed, 58 insertions(+), 19 deletions(-)
diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c b/drivers/staging/kpc2000/kpc2000/cell_probe.c
index 738122afc2ae..e7e963d62699 100644
--- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
+++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
@@ -30,9 +30,12 @@
*
*/
-#define KPC_OLD_DMA_CH_NUM(present, channel) ((present) ? (0x8 | ((channel) & 0x7)) : 0)
-#define KPC_OLD_S2C_DMA_CH_NUM(cte) KPC_OLD_DMA_CH_NUM(cte.s2c_dma_present, cte.s2c_dma_channel_num)
-#define KPC_OLD_C2S_DMA_CH_NUM(cte) KPC_OLD_DMA_CH_NUM(cte.c2s_dma_present, cte.c2s_dma_channel_num)
+#define KPC_OLD_DMA_CH_NUM(present, channel) \
+ ((present) ? (0x8 | ((channel) & 0x7)) : 0)
+#define KPC_OLD_S2C_DMA_CH_NUM(cte) \
+ KPC_OLD_DMA_CH_NUM(cte.s2c_dma_present, cte.s2c_dma_channel_num)
+#define KPC_OLD_C2S_DMA_CH_NUM(cte) \
+ KPC_OLD_DMA_CH_NUM(cte.c2s_dma_present, cte.c2s_dma_channel_num)
#define KP_CORE_ID_INVALID 0
#define KP_CORE_ID_I2C 3
@@ -67,7 +70,8 @@ void parse_core_table_entry_v0(struct core_table_entry *cte, const u64 read_val
static
void dbg_cte(struct kp2000_device *pcard, struct core_table_entry *cte)
{
- dev_dbg(&pcard->pdev->dev, "CTE: type:%3d offset:%3d (%3d) length:%3d (%3d) s2c:%d c2s:%d irq_count:%d base_irq:%d\n",
+ dev_dbg(&pcard->pdev->dev,
+ "CTE: type:%3d offset:%3d (%3d) length:%3d (%3d) s2c:%d c2s:%d irq_count:%d base_irq:%d\n",
cte->type,
cte->offset,
cte->offset / 4096,
@@ -107,7 +111,14 @@ static int probe_core_basic(unsigned int core_num, struct kp2000_device *pcard,
.ddna = pcard->ddna,
};
- dev_dbg(&pcard->pdev->dev, "Found Basic core: type = %02d dma = %02x / %02x offset = 0x%x length = 0x%x (%d regs)\n", cte.type, KPC_OLD_S2C_DMA_CH_NUM(cte), KPC_OLD_C2S_DMA_CH_NUM(cte), cte.offset, cte.length, cte.length / 8);
+ dev_dbg(&pcard->pdev->dev,
+ "Found Basic core: type = %02d dma = %02x / %02x offset = 0x%x length = 0x%x (%d regs)\n",
+ cte.type,
+ KPC_OLD_S2C_DMA_CH_NUM(cte),
+ KPC_OLD_C2S_DMA_CH_NUM(cte),
+ cte.offset,
+ cte.length,
+ cte.length / 8);
cell.platform_data = &core_pdata;
cell.pdata_size = sizeof(struct kpc_core_device_platdata);
@@ -290,7 +301,14 @@ static int probe_core_uio(unsigned int core_num, struct kp2000_device *pcard,
struct kpc_uio_device *kudev;
int rv;
- dev_dbg(&pcard->pdev->dev, "Found UIO core: type = %02d dma = %02x / %02x offset = 0x%x length = 0x%x (%d regs)\n", cte.type, KPC_OLD_S2C_DMA_CH_NUM(cte), KPC_OLD_C2S_DMA_CH_NUM(cte), cte.offset, cte.length, cte.length / 8);
+ dev_dbg(&pcard->pdev->dev,
+ "Found UIO core: type = %02d dma = %02x / %02x offset = 0x%x length = 0x%x (%d regs)\n",
+ cte.type,
+ KPC_OLD_S2C_DMA_CH_NUM(cte),
+ KPC_OLD_C2S_DMA_CH_NUM(cte),
+ cte.offset,
+ cte.length,
+ cte.length / 8);
kudev = kzalloc(sizeof(*kudev), GFP_KERNEL);
if (!kudev)
@@ -315,10 +333,14 @@ static int probe_core_uio(unsigned int core_num, struct kp2000_device *pcard,
kudev->uioinfo.mem[0].name = "uiomap";
kudev->uioinfo.mem[0].addr = pci_resource_start(pcard->pdev, REG_BAR) + cte.offset;
- kudev->uioinfo.mem[0].size = (cte.length + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1); // Round up to nearest PAGE_SIZE boundary
+
+ // Round up to nearest PAGE_SIZE boundary
+ kudev->uioinfo.mem[0].size = (cte.length + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
kudev->uioinfo.mem[0].memtype = UIO_MEM_PHYS;
- kudev->dev = device_create(kpc_uio_class, &pcard->pdev->dev, MKDEV(0, 0), kudev, "%s.%d.%d.%d", kudev->uioinfo.name, pcard->card_num, cte.type, kudev->core_num);
+ kudev->dev = device_create(kpc_uio_class,
+ &pcard->pdev->dev, MKDEV(0, 0), kudev, "%s.%d.%d.%d",
+ kudev->uioinfo.name, pcard->card_num, cte.type, kudev->core_num);
if (IS_ERR(kudev->dev)) {
dev_err(&pcard->pdev->dev, "%s: device_create failed!\n",
__func__);
@@ -341,7 +363,9 @@ static int probe_core_uio(unsigned int core_num, struct kp2000_device *pcard,
return 0;
}
-static int create_dma_engine_core(struct kp2000_device *pcard, size_t engine_regs_offset, int engine_num, int irq_num)
+static int create_dma_engine_core(struct kp2000_device *pcard,
+ size_t engine_regs_offset,
+ int engine_num, int irq_num)
{
struct mfd_cell cell = { .id = engine_num };
struct resource resources[2];
@@ -380,18 +404,28 @@ static int kp2000_setup_dma_controller(struct kp2000_device *pcard)
// S2C Engines
for (i = 0 ; i < 32 ; i++) {
- capabilities_reg = readq(pcard->dma_bar_base + KPC_DMA_S2C_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i));
+ capabilities_reg = readq(pcard->dma_bar_base +
+ KPC_DMA_S2C_BASE_OFFSET +
+ (KPC_DMA_ENGINE_SIZE * i));
+
if (capabilities_reg & ENGINE_CAP_PRESENT_MASK) {
- err = create_dma_engine_core(pcard, (KPC_DMA_S2C_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i)), i, pcard->pdev->irq);
+ err = create_dma_engine_core(pcard, (KPC_DMA_S2C_BASE_OFFSET +
+ (KPC_DMA_ENGINE_SIZE * i)),
+ i, pcard->pdev->irq);
if (err)
goto err_out;
}
}
// C2S Engines
for (i = 0 ; i < 32 ; i++) {
- capabilities_reg = readq(pcard->dma_bar_base + KPC_DMA_C2S_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i));
+ capabilities_reg = readq(pcard->dma_bar_base +
+ KPC_DMA_C2S_BASE_OFFSET +
+ (KPC_DMA_ENGINE_SIZE * i));
+
if (capabilities_reg & ENGINE_CAP_PRESENT_MASK) {
- err = create_dma_engine_core(pcard, (KPC_DMA_C2S_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i)), 32 + i, pcard->pdev->irq);
+ err = create_dma_engine_core(pcard, (KPC_DMA_C2S_BASE_OFFSET +
+ (KPC_DMA_ENGINE_SIZE * i)),
+ 32 + i, pcard->pdev->irq);
if (err)
goto err_out;
}
@@ -433,10 +467,15 @@ int kp2000_probe_cores(struct kp2000_device *pcard)
// Then, iterate over the possible core types.
for (current_type_id = 1 ; current_type_id <= highest_core_id ; current_type_id++) {
unsigned int core_num = 0;
- // Foreach core type, iterate the whole table and instantiate subdevices for each core.
- // Yes, this is O(n*m) but the actual runtime is small enough that it's an acceptable tradeoff.
+ /*
+ * Foreach core type, iterate the whole table and instantiate
+ * subdevices for each core.
+ * Yes, this is O(n*m) but the actual runtime is small enough
+ * that it's an acceptable tradeoff.
+ */
for (i = 0 ; i < pcard->core_table_length ; i++) {
- read_val = readq(pcard->sysinfo_regs_base + ((pcard->core_table_offset + i) * 8));
+ read_val = readq(pcard->sysinfo_regs_base +
+ ((pcard->core_table_offset + i) * 8));
parse_core_table_entry(&cte, read_val, pcard->core_table_rev);
if (cte.type != current_type_id)
diff --git a/drivers/staging/kpc2000/kpc2000/core.c b/drivers/staging/kpc2000/kpc2000/core.c
index 358d7b2f4ad1..6462a3059fb0 100644
--- a/drivers/staging/kpc2000/kpc2000/core.c
+++ b/drivers/staging/kpc2000/kpc2000/core.c
@@ -124,6 +124,7 @@ static ssize_t cpld_reconfigure(struct device *dev,
writeq(wr_val, pcard->sysinfo_regs_base + REG_CPLD_CONFIG);
return count;
}
+
static DEVICE_ATTR(cpld_reconfigure, 0220, NULL, cpld_reconfigure);
static ssize_t irq_mask_reg_show(struct device *dev,
@@ -367,7 +368,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
dma_bar_phys_len = pci_resource_len(pcard->pdev, DMA_BAR);
pcard->dma_bar_base = ioremap(dma_bar_phys_addr,
- dma_bar_phys_len);
+ dma_bar_phys_len);
if (!pcard->dma_bar_base) {
dev_err(&pcard->pdev->dev,
"probe: DMA_BAR could not remap memory to virtual space\n");
diff --git a/drivers/staging/kpc2000/kpc2000/dma_common_defs.h b/drivers/staging/kpc2000/kpc2000/dma_common_defs.h
index 21450e3d408f..8bc78be3c259 100644
--- a/drivers/staging/kpc2000/kpc2000/dma_common_defs.h
+++ b/drivers/staging/kpc2000/kpc2000/dma_common_defs.h
@@ -6,8 +6,7 @@
#define KPC_DMA_S2C_BASE_OFFSET 0x0000
#define KPC_DMA_C2S_BASE_OFFSET 0x2000
#define KPC_DMA_ENGINE_SIZE 0x0100
-#define ENGINE_CAP_PRESENT_MASK 0x1
-
+#define ENGINE_CAP_PRESENT_MASK 0x1
#define KPC_DMA_CARD_IRQ_ENABLE (1 << 0)
#define KPC_DMA_CARD_IRQ_ACTIVE (1 << 1)
--
2.25.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] staging: kpc2000: Use BIT macro instead of bit masking
2020-10-21 3:03 [PATCH 1/2] staging: kpc2000: resolve various code style issues Deepak R Varma
@ 2020-10-21 3:04 ` Deepak R Varma
2020-10-21 7:53 ` [Outreachy kernel] " Julia Lawall
2020-10-21 4:41 ` [Outreachy kernel] [PATCH 1/2] staging: kpc2000: resolve various code style issues Vaishali Thakkar
1 sibling, 1 reply; 5+ messages in thread
From: Deepak R Varma @ 2020-10-21 3:04 UTC (permalink / raw)
To: Greg Kroah-Hartman, devel, outreachy-kernel; +Cc: mh12gx2825
Replace bit masking by BIT macro. This resolves checkpatch issue
"CHECK: Prefer using the BIT macro"
Signed-off-by: Deepak R Varma <mh12gx2825@gmail.com>
---
drivers/staging/kpc2000/kpc2000/dma_common_defs.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/kpc2000/kpc2000/dma_common_defs.h b/drivers/staging/kpc2000/kpc2000/dma_common_defs.h
index 8bc78be3c259..613c4898f65e 100644
--- a/drivers/staging/kpc2000/kpc2000/dma_common_defs.h
+++ b/drivers/staging/kpc2000/kpc2000/dma_common_defs.h
@@ -8,13 +8,13 @@
#define KPC_DMA_ENGINE_SIZE 0x0100
#define ENGINE_CAP_PRESENT_MASK 0x1
-#define KPC_DMA_CARD_IRQ_ENABLE (1 << 0)
-#define KPC_DMA_CARD_IRQ_ACTIVE (1 << 1)
-#define KPC_DMA_CARD_IRQ_PENDING (1 << 2)
-#define KPC_DMA_CARD_IRQ_MSI (1 << 3)
-#define KPC_DMA_CARD_USER_INTERRUPT_MODE (1 << 4)
-#define KPC_DMA_CARD_USER_INTERRUPT_ACTIVE (1 << 5)
-#define KPC_DMA_CARD_IRQ_MSIX_MODE (1 << 6)
+#define KPC_DMA_CARD_IRQ_ENABLE BIT(0)
+#define KPC_DMA_CARD_IRQ_ACTIVE BIT(1)
+#define KPC_DMA_CARD_IRQ_PENDING BIT(2)
+#define KPC_DMA_CARD_IRQ_MSI BIT(3)
+#define KPC_DMA_CARD_USER_INTERRUPT_MODE BIT(4)
+#define KPC_DMA_CARD_USER_INTERRUPT_ACTIVE BIT(5)
+#define KPC_DMA_CARD_IRQ_MSIX_MODE BIT(6)
#define KPC_DMA_CARD_MAX_PAYLOAD_SIZE_MASK 0x0700
#define KPC_DMA_CARD_MAX_READ_REQUEST_SIZE_MASK 0x7000
#define KPC_DMA_CARD_S2C_INTERRUPT_STATUS_MASK 0x00FF0000
--
2.25.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Outreachy kernel] [PATCH 1/2] staging: kpc2000: resolve various code style issues
2020-10-21 3:03 [PATCH 1/2] staging: kpc2000: resolve various code style issues Deepak R Varma
2020-10-21 3:04 ` [PATCH 2/2] staging: kpc2000: Use BIT macro instead of bit masking Deepak R Varma
@ 2020-10-21 4:41 ` Vaishali Thakkar
2020-10-21 5:47 ` Deepak R Varma
1 sibling, 1 reply; 5+ messages in thread
From: Vaishali Thakkar @ 2020-10-21 4:41 UTC (permalink / raw)
To: Deepak R Varma; +Cc: devel, Greg Kroah-Hartman, Outreachy
On Wed, Oct 21, 2020 at 8:33 AM Deepak R Varma <mh12gx2825@gmail.com> wrote:
>
> Multiple issues reported by checkpatch script around lines exceeding 100
> columns, indentation of function parameters, extra blank lines. These
> code formatting changes improves the code readability.
Please send separate patches while fixing different checkpatch
warnings. It's a good idea to fix different warnings together if
it's for the same block of code but otherwise your patch should
handle one similar change at a time.
> Signed-off-by: Deepak R Varma <mh12gx2825@gmail.com>
> ---
> drivers/staging/kpc2000/kpc2000/cell_probe.c | 71 ++++++++++++++-----
> drivers/staging/kpc2000/kpc2000/core.c | 3 +-
> .../staging/kpc2000/kpc2000/dma_common_defs.h | 3 +-
> 3 files changed, 58 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c b/drivers/staging/kpc2000/kpc2000/cell_probe.c
> index 738122afc2ae..e7e963d62699 100644
> --- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
> +++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
> @@ -30,9 +30,12 @@
> *
> */
>
> -#define KPC_OLD_DMA_CH_NUM(present, channel) ((present) ? (0x8 | ((channel) & 0x7)) : 0)
> -#define KPC_OLD_S2C_DMA_CH_NUM(cte) KPC_OLD_DMA_CH_NUM(cte.s2c_dma_present, cte.s2c_dma_channel_num)
> -#define KPC_OLD_C2S_DMA_CH_NUM(cte) KPC_OLD_DMA_CH_NUM(cte.c2s_dma_present, cte.c2s_dma_channel_num)
> +#define KPC_OLD_DMA_CH_NUM(present, channel) \
> + ((present) ? (0x8 | ((channel) & 0x7)) : 0)
> +#define KPC_OLD_S2C_DMA_CH_NUM(cte) \
> + KPC_OLD_DMA_CH_NUM(cte.s2c_dma_present, cte.s2c_dma_channel_num)
> +#define KPC_OLD_C2S_DMA_CH_NUM(cte) \
> + KPC_OLD_DMA_CH_NUM(cte.c2s_dma_present, cte.c2s_dma_channel_num)
>
> #define KP_CORE_ID_INVALID 0
> #define KP_CORE_ID_I2C 3
> @@ -67,7 +70,8 @@ void parse_core_table_entry_v0(struct core_table_entry *cte, const u64 read_val
> static
> void dbg_cte(struct kp2000_device *pcard, struct core_table_entry *cte)
> {
> - dev_dbg(&pcard->pdev->dev, "CTE: type:%3d offset:%3d (%3d) length:%3d (%3d) s2c:%d c2s:%d irq_count:%d base_irq:%d\n",
> + dev_dbg(&pcard->pdev->dev,
> + "CTE: type:%3d offset:%3d (%3d) length:%3d (%3d) s2c:%d c2s:%d irq_count:%d base_irq:%d\n",
> cte->type,
> cte->offset,
> cte->offset / 4096,
> @@ -107,7 +111,14 @@ static int probe_core_basic(unsigned int core_num, struct kp2000_device *pcard,
> .ddna = pcard->ddna,
> };
>
> - dev_dbg(&pcard->pdev->dev, "Found Basic core: type = %02d dma = %02x / %02x offset = 0x%x length = 0x%x (%d regs)\n", cte.type, KPC_OLD_S2C_DMA_CH_NUM(cte), KPC_OLD_C2S_DMA_CH_NUM(cte), cte.offset, cte.length, cte.length / 8);
> + dev_dbg(&pcard->pdev->dev,
> + "Found Basic core: type = %02d dma = %02x / %02x offset = 0x%x length = 0x%x (%d regs)\n",
> + cte.type,
> + KPC_OLD_S2C_DMA_CH_NUM(cte),
> + KPC_OLD_C2S_DMA_CH_NUM(cte),
> + cte.offset,
> + cte.length,
> + cte.length / 8);
>
> cell.platform_data = &core_pdata;
> cell.pdata_size = sizeof(struct kpc_core_device_platdata);
> @@ -290,7 +301,14 @@ static int probe_core_uio(unsigned int core_num, struct kp2000_device *pcard,
> struct kpc_uio_device *kudev;
> int rv;
>
> - dev_dbg(&pcard->pdev->dev, "Found UIO core: type = %02d dma = %02x / %02x offset = 0x%x length = 0x%x (%d regs)\n", cte.type, KPC_OLD_S2C_DMA_CH_NUM(cte), KPC_OLD_C2S_DMA_CH_NUM(cte), cte.offset, cte.length, cte.length / 8);
> + dev_dbg(&pcard->pdev->dev,
> + "Found UIO core: type = %02d dma = %02x / %02x offset = 0x%x length = 0x%x (%d regs)\n",
> + cte.type,
> + KPC_OLD_S2C_DMA_CH_NUM(cte),
> + KPC_OLD_C2S_DMA_CH_NUM(cte),
> + cte.offset,
> + cte.length,
> + cte.length / 8);
>
> kudev = kzalloc(sizeof(*kudev), GFP_KERNEL);
> if (!kudev)
> @@ -315,10 +333,14 @@ static int probe_core_uio(unsigned int core_num, struct kp2000_device *pcard,
>
> kudev->uioinfo.mem[0].name = "uiomap";
> kudev->uioinfo.mem[0].addr = pci_resource_start(pcard->pdev, REG_BAR) + cte.offset;
> - kudev->uioinfo.mem[0].size = (cte.length + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1); // Round up to nearest PAGE_SIZE boundary
> +
> + // Round up to nearest PAGE_SIZE boundary
> + kudev->uioinfo.mem[0].size = (cte.length + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
> kudev->uioinfo.mem[0].memtype = UIO_MEM_PHYS;
>
> - kudev->dev = device_create(kpc_uio_class, &pcard->pdev->dev, MKDEV(0, 0), kudev, "%s.%d.%d.%d", kudev->uioinfo.name, pcard->card_num, cte.type, kudev->core_num);
> + kudev->dev = device_create(kpc_uio_class,
> + &pcard->pdev->dev, MKDEV(0, 0), kudev, "%s.%d.%d.%d",
> + kudev->uioinfo.name, pcard->card_num, cte.type, kudev->core_num);
> if (IS_ERR(kudev->dev)) {
> dev_err(&pcard->pdev->dev, "%s: device_create failed!\n",
> __func__);
> @@ -341,7 +363,9 @@ static int probe_core_uio(unsigned int core_num, struct kp2000_device *pcard,
> return 0;
> }
>
> -static int create_dma_engine_core(struct kp2000_device *pcard, size_t engine_regs_offset, int engine_num, int irq_num)
> +static int create_dma_engine_core(struct kp2000_device *pcard,
> + size_t engine_regs_offset,
> + int engine_num, int irq_num)
> {
> struct mfd_cell cell = { .id = engine_num };
> struct resource resources[2];
> @@ -380,18 +404,28 @@ static int kp2000_setup_dma_controller(struct kp2000_device *pcard)
>
> // S2C Engines
> for (i = 0 ; i < 32 ; i++) {
> - capabilities_reg = readq(pcard->dma_bar_base + KPC_DMA_S2C_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i));
> + capabilities_reg = readq(pcard->dma_bar_base +
> + KPC_DMA_S2C_BASE_OFFSET +
> + (KPC_DMA_ENGINE_SIZE * i));
> +
> if (capabilities_reg & ENGINE_CAP_PRESENT_MASK) {
> - err = create_dma_engine_core(pcard, (KPC_DMA_S2C_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i)), i, pcard->pdev->irq);
> + err = create_dma_engine_core(pcard, (KPC_DMA_S2C_BASE_OFFSET +
> + (KPC_DMA_ENGINE_SIZE * i)),
> + i, pcard->pdev->irq);
> if (err)
> goto err_out;
> }
> }
> // C2S Engines
> for (i = 0 ; i < 32 ; i++) {
> - capabilities_reg = readq(pcard->dma_bar_base + KPC_DMA_C2S_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i));
> + capabilities_reg = readq(pcard->dma_bar_base +
> + KPC_DMA_C2S_BASE_OFFSET +
> + (KPC_DMA_ENGINE_SIZE * i));
> +
> if (capabilities_reg & ENGINE_CAP_PRESENT_MASK) {
> - err = create_dma_engine_core(pcard, (KPC_DMA_C2S_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i)), 32 + i, pcard->pdev->irq);
> + err = create_dma_engine_core(pcard, (KPC_DMA_C2S_BASE_OFFSET +
> + (KPC_DMA_ENGINE_SIZE * i)),
> + 32 + i, pcard->pdev->irq);
> if (err)
> goto err_out;
> }
> @@ -433,10 +467,15 @@ int kp2000_probe_cores(struct kp2000_device *pcard)
> // Then, iterate over the possible core types.
> for (current_type_id = 1 ; current_type_id <= highest_core_id ; current_type_id++) {
> unsigned int core_num = 0;
> - // Foreach core type, iterate the whole table and instantiate subdevices for each core.
> - // Yes, this is O(n*m) but the actual runtime is small enough that it's an acceptable tradeoff.
> + /*
> + * Foreach core type, iterate the whole table and instantiate
> + * subdevices for each core.
> + * Yes, this is O(n*m) but the actual runtime is small enough
> + * that it's an acceptable tradeoff.
> + */
> for (i = 0 ; i < pcard->core_table_length ; i++) {
> - read_val = readq(pcard->sysinfo_regs_base + ((pcard->core_table_offset + i) * 8));
> + read_val = readq(pcard->sysinfo_regs_base +
> + ((pcard->core_table_offset + i) * 8));
> parse_core_table_entry(&cte, read_val, pcard->core_table_rev);
>
> if (cte.type != current_type_id)
> diff --git a/drivers/staging/kpc2000/kpc2000/core.c b/drivers/staging/kpc2000/kpc2000/core.c
> index 358d7b2f4ad1..6462a3059fb0 100644
> --- a/drivers/staging/kpc2000/kpc2000/core.c
> +++ b/drivers/staging/kpc2000/kpc2000/core.c
> @@ -124,6 +124,7 @@ static ssize_t cpld_reconfigure(struct device *dev,
> writeq(wr_val, pcard->sysinfo_regs_base + REG_CPLD_CONFIG);
> return count;
> }
> +
> static DEVICE_ATTR(cpld_reconfigure, 0220, NULL, cpld_reconfigure);
>
> static ssize_t irq_mask_reg_show(struct device *dev,
> @@ -367,7 +368,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
> dma_bar_phys_len = pci_resource_len(pcard->pdev, DMA_BAR);
>
> pcard->dma_bar_base = ioremap(dma_bar_phys_addr,
> - dma_bar_phys_len);
> + dma_bar_phys_len);
> if (!pcard->dma_bar_base) {
> dev_err(&pcard->pdev->dev,
> "probe: DMA_BAR could not remap memory to virtual space\n");
> diff --git a/drivers/staging/kpc2000/kpc2000/dma_common_defs.h b/drivers/staging/kpc2000/kpc2000/dma_common_defs.h
> index 21450e3d408f..8bc78be3c259 100644
> --- a/drivers/staging/kpc2000/kpc2000/dma_common_defs.h
> +++ b/drivers/staging/kpc2000/kpc2000/dma_common_defs.h
> @@ -6,8 +6,7 @@
> #define KPC_DMA_S2C_BASE_OFFSET 0x0000
> #define KPC_DMA_C2S_BASE_OFFSET 0x2000
> #define KPC_DMA_ENGINE_SIZE 0x0100
> -#define ENGINE_CAP_PRESENT_MASK 0x1
> -
> +#define ENGINE_CAP_PRESENT_MASK 0x1
>
> #define KPC_DMA_CARD_IRQ_ENABLE (1 << 0)
> #define KPC_DMA_CARD_IRQ_ACTIVE (1 << 1)
> --
> 2.25.1
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/bce6824343f7a10919be5130b5a6276ed186701c.1603248984.git.mh12gx2825%40gmail.com.
--
Vaishali
--
Vaishali
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Outreachy kernel] [PATCH 1/2] staging: kpc2000: resolve various code style issues
2020-10-21 4:41 ` [Outreachy kernel] [PATCH 1/2] staging: kpc2000: resolve various code style issues Vaishali Thakkar
@ 2020-10-21 5:47 ` Deepak R Varma
0 siblings, 0 replies; 5+ messages in thread
From: Deepak R Varma @ 2020-10-21 5:47 UTC (permalink / raw)
To: Vaishali Thakkar; +Cc: devel, Greg Kroah-Hartman, Outreachy
On Wed, Oct 21, 2020 at 10:11:52AM +0530, Vaishali Thakkar wrote:
> On Wed, Oct 21, 2020 at 8:33 AM Deepak R Varma <mh12gx2825@gmail.com> wrote:
> >
> > Multiple issues reported by checkpatch script around lines exceeding 100
> > columns, indentation of function parameters, extra blank lines. These
> > code formatting changes improves the code readability.
>
> Please send separate patches while fixing different checkpatch
> warnings. It's a good idea to fix different warnings together if
> it's for the same block of code but otherwise your patch should
> handle one similar change at a time.
>
Okay. Will change my old commit and resend the patch set.
Thank you,
Deepak.
> > Signed-off-by: Deepak R Varma <mh12gx2825@gmail.com>
> > ---
> > drivers/staging/kpc2000/kpc2000/cell_probe.c | 71 ++++++++++++++-----
> > drivers/staging/kpc2000/kpc2000/core.c | 3 +-
> > .../staging/kpc2000/kpc2000/dma_common_defs.h | 3 +-
> > 3 files changed, 58 insertions(+), 19 deletions(-)
> >
> > diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c b/drivers/staging/kpc2000/kpc2000/cell_probe.c
> > index 738122afc2ae..e7e963d62699 100644
> > --- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
> > +++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
> > @@ -30,9 +30,12 @@
> > *
> > */
> >
> > -#define KPC_OLD_DMA_CH_NUM(present, channel) ((present) ? (0x8 | ((channel) & 0x7)) : 0)
> > -#define KPC_OLD_S2C_DMA_CH_NUM(cte) KPC_OLD_DMA_CH_NUM(cte.s2c_dma_present, cte.s2c_dma_channel_num)
> > -#define KPC_OLD_C2S_DMA_CH_NUM(cte) KPC_OLD_DMA_CH_NUM(cte.c2s_dma_present, cte.c2s_dma_channel_num)
> > +#define KPC_OLD_DMA_CH_NUM(present, channel) \
> > + ((present) ? (0x8 | ((channel) & 0x7)) : 0)
> > +#define KPC_OLD_S2C_DMA_CH_NUM(cte) \
> > + KPC_OLD_DMA_CH_NUM(cte.s2c_dma_present, cte.s2c_dma_channel_num)
> > +#define KPC_OLD_C2S_DMA_CH_NUM(cte) \
> > + KPC_OLD_DMA_CH_NUM(cte.c2s_dma_present, cte.c2s_dma_channel_num)
> >
> > #define KP_CORE_ID_INVALID 0
> > #define KP_CORE_ID_I2C 3
> > @@ -67,7 +70,8 @@ void parse_core_table_entry_v0(struct core_table_entry *cte, const u64 read_val
> > static
> > void dbg_cte(struct kp2000_device *pcard, struct core_table_entry *cte)
> > {
> > - dev_dbg(&pcard->pdev->dev, "CTE: type:%3d offset:%3d (%3d) length:%3d (%3d) s2c:%d c2s:%d irq_count:%d base_irq:%d\n",
> > + dev_dbg(&pcard->pdev->dev,
> > + "CTE: type:%3d offset:%3d (%3d) length:%3d (%3d) s2c:%d c2s:%d irq_count:%d base_irq:%d\n",
> > cte->type,
> > cte->offset,
> > cte->offset / 4096,
> > @@ -107,7 +111,14 @@ static int probe_core_basic(unsigned int core_num, struct kp2000_device *pcard,
> > .ddna = pcard->ddna,
> > };
> >
> > - dev_dbg(&pcard->pdev->dev, "Found Basic core: type = %02d dma = %02x / %02x offset = 0x%x length = 0x%x (%d regs)\n", cte.type, KPC_OLD_S2C_DMA_CH_NUM(cte), KPC_OLD_C2S_DMA_CH_NUM(cte), cte.offset, cte.length, cte.length / 8);
> > + dev_dbg(&pcard->pdev->dev,
> > + "Found Basic core: type = %02d dma = %02x / %02x offset = 0x%x length = 0x%x (%d regs)\n",
> > + cte.type,
> > + KPC_OLD_S2C_DMA_CH_NUM(cte),
> > + KPC_OLD_C2S_DMA_CH_NUM(cte),
> > + cte.offset,
> > + cte.length,
> > + cte.length / 8);
> >
> > cell.platform_data = &core_pdata;
> > cell.pdata_size = sizeof(struct kpc_core_device_platdata);
> > @@ -290,7 +301,14 @@ static int probe_core_uio(unsigned int core_num, struct kp2000_device *pcard,
> > struct kpc_uio_device *kudev;
> > int rv;
> >
> > - dev_dbg(&pcard->pdev->dev, "Found UIO core: type = %02d dma = %02x / %02x offset = 0x%x length = 0x%x (%d regs)\n", cte.type, KPC_OLD_S2C_DMA_CH_NUM(cte), KPC_OLD_C2S_DMA_CH_NUM(cte), cte.offset, cte.length, cte.length / 8);
> > + dev_dbg(&pcard->pdev->dev,
> > + "Found UIO core: type = %02d dma = %02x / %02x offset = 0x%x length = 0x%x (%d regs)\n",
> > + cte.type,
> > + KPC_OLD_S2C_DMA_CH_NUM(cte),
> > + KPC_OLD_C2S_DMA_CH_NUM(cte),
> > + cte.offset,
> > + cte.length,
> > + cte.length / 8);
> >
> > kudev = kzalloc(sizeof(*kudev), GFP_KERNEL);
> > if (!kudev)
> > @@ -315,10 +333,14 @@ static int probe_core_uio(unsigned int core_num, struct kp2000_device *pcard,
> >
> > kudev->uioinfo.mem[0].name = "uiomap";
> > kudev->uioinfo.mem[0].addr = pci_resource_start(pcard->pdev, REG_BAR) + cte.offset;
> > - kudev->uioinfo.mem[0].size = (cte.length + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1); // Round up to nearest PAGE_SIZE boundary
> > +
> > + // Round up to nearest PAGE_SIZE boundary
> > + kudev->uioinfo.mem[0].size = (cte.length + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
> > kudev->uioinfo.mem[0].memtype = UIO_MEM_PHYS;
> >
> > - kudev->dev = device_create(kpc_uio_class, &pcard->pdev->dev, MKDEV(0, 0), kudev, "%s.%d.%d.%d", kudev->uioinfo.name, pcard->card_num, cte.type, kudev->core_num);
> > + kudev->dev = device_create(kpc_uio_class,
> > + &pcard->pdev->dev, MKDEV(0, 0), kudev, "%s.%d.%d.%d",
> > + kudev->uioinfo.name, pcard->card_num, cte.type, kudev->core_num);
> > if (IS_ERR(kudev->dev)) {
> > dev_err(&pcard->pdev->dev, "%s: device_create failed!\n",
> > __func__);
> > @@ -341,7 +363,9 @@ static int probe_core_uio(unsigned int core_num, struct kp2000_device *pcard,
> > return 0;
> > }
> >
> > -static int create_dma_engine_core(struct kp2000_device *pcard, size_t engine_regs_offset, int engine_num, int irq_num)
> > +static int create_dma_engine_core(struct kp2000_device *pcard,
> > + size_t engine_regs_offset,
> > + int engine_num, int irq_num)
> > {
> > struct mfd_cell cell = { .id = engine_num };
> > struct resource resources[2];
> > @@ -380,18 +404,28 @@ static int kp2000_setup_dma_controller(struct kp2000_device *pcard)
> >
> > // S2C Engines
> > for (i = 0 ; i < 32 ; i++) {
> > - capabilities_reg = readq(pcard->dma_bar_base + KPC_DMA_S2C_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i));
> > + capabilities_reg = readq(pcard->dma_bar_base +
> > + KPC_DMA_S2C_BASE_OFFSET +
> > + (KPC_DMA_ENGINE_SIZE * i));
> > +
> > if (capabilities_reg & ENGINE_CAP_PRESENT_MASK) {
> > - err = create_dma_engine_core(pcard, (KPC_DMA_S2C_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i)), i, pcard->pdev->irq);
> > + err = create_dma_engine_core(pcard, (KPC_DMA_S2C_BASE_OFFSET +
> > + (KPC_DMA_ENGINE_SIZE * i)),
> > + i, pcard->pdev->irq);
> > if (err)
> > goto err_out;
> > }
> > }
> > // C2S Engines
> > for (i = 0 ; i < 32 ; i++) {
> > - capabilities_reg = readq(pcard->dma_bar_base + KPC_DMA_C2S_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i));
> > + capabilities_reg = readq(pcard->dma_bar_base +
> > + KPC_DMA_C2S_BASE_OFFSET +
> > + (KPC_DMA_ENGINE_SIZE * i));
> > +
> > if (capabilities_reg & ENGINE_CAP_PRESENT_MASK) {
> > - err = create_dma_engine_core(pcard, (KPC_DMA_C2S_BASE_OFFSET + (KPC_DMA_ENGINE_SIZE * i)), 32 + i, pcard->pdev->irq);
> > + err = create_dma_engine_core(pcard, (KPC_DMA_C2S_BASE_OFFSET +
> > + (KPC_DMA_ENGINE_SIZE * i)),
> > + 32 + i, pcard->pdev->irq);
> > if (err)
> > goto err_out;
> > }
> > @@ -433,10 +467,15 @@ int kp2000_probe_cores(struct kp2000_device *pcard)
> > // Then, iterate over the possible core types.
> > for (current_type_id = 1 ; current_type_id <= highest_core_id ; current_type_id++) {
> > unsigned int core_num = 0;
> > - // Foreach core type, iterate the whole table and instantiate subdevices for each core.
> > - // Yes, this is O(n*m) but the actual runtime is small enough that it's an acceptable tradeoff.
> > + /*
> > + * Foreach core type, iterate the whole table and instantiate
> > + * subdevices for each core.
> > + * Yes, this is O(n*m) but the actual runtime is small enough
> > + * that it's an acceptable tradeoff.
> > + */
> > for (i = 0 ; i < pcard->core_table_length ; i++) {
> > - read_val = readq(pcard->sysinfo_regs_base + ((pcard->core_table_offset + i) * 8));
> > + read_val = readq(pcard->sysinfo_regs_base +
> > + ((pcard->core_table_offset + i) * 8));
> > parse_core_table_entry(&cte, read_val, pcard->core_table_rev);
> >
> > if (cte.type != current_type_id)
> > diff --git a/drivers/staging/kpc2000/kpc2000/core.c b/drivers/staging/kpc2000/kpc2000/core.c
> > index 358d7b2f4ad1..6462a3059fb0 100644
> > --- a/drivers/staging/kpc2000/kpc2000/core.c
> > +++ b/drivers/staging/kpc2000/kpc2000/core.c
> > @@ -124,6 +124,7 @@ static ssize_t cpld_reconfigure(struct device *dev,
> > writeq(wr_val, pcard->sysinfo_regs_base + REG_CPLD_CONFIG);
> > return count;
> > }
> > +
> > static DEVICE_ATTR(cpld_reconfigure, 0220, NULL, cpld_reconfigure);
> >
> > static ssize_t irq_mask_reg_show(struct device *dev,
> > @@ -367,7 +368,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
> > dma_bar_phys_len = pci_resource_len(pcard->pdev, DMA_BAR);
> >
> > pcard->dma_bar_base = ioremap(dma_bar_phys_addr,
> > - dma_bar_phys_len);
> > + dma_bar_phys_len);
> > if (!pcard->dma_bar_base) {
> > dev_err(&pcard->pdev->dev,
> > "probe: DMA_BAR could not remap memory to virtual space\n");
> > diff --git a/drivers/staging/kpc2000/kpc2000/dma_common_defs.h b/drivers/staging/kpc2000/kpc2000/dma_common_defs.h
> > index 21450e3d408f..8bc78be3c259 100644
> > --- a/drivers/staging/kpc2000/kpc2000/dma_common_defs.h
> > +++ b/drivers/staging/kpc2000/kpc2000/dma_common_defs.h
> > @@ -6,8 +6,7 @@
> > #define KPC_DMA_S2C_BASE_OFFSET 0x0000
> > #define KPC_DMA_C2S_BASE_OFFSET 0x2000
> > #define KPC_DMA_ENGINE_SIZE 0x0100
> > -#define ENGINE_CAP_PRESENT_MASK 0x1
> > -
> > +#define ENGINE_CAP_PRESENT_MASK 0x1
> >
> > #define KPC_DMA_CARD_IRQ_ENABLE (1 << 0)
> > #define KPC_DMA_CARD_IRQ_ACTIVE (1 << 1)
> > --
> > 2.25.1
> >
> > --
> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/bce6824343f7a10919be5130b5a6276ed186701c.1603248984.git.mh12gx2825%40gmail.com.
>
>
>
> --
> Vaishali
>
>
> --
> Vaishali
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Outreachy kernel] [PATCH 2/2] staging: kpc2000: Use BIT macro instead of bit masking
2020-10-21 3:04 ` [PATCH 2/2] staging: kpc2000: Use BIT macro instead of bit masking Deepak R Varma
@ 2020-10-21 7:53 ` Julia Lawall
0 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2020-10-21 7:53 UTC (permalink / raw)
To: Deepak R Varma; +Cc: devel, Greg Kroah-Hartman, outreachy-kernel
On Wed, 21 Oct 2020, Deepak R Varma wrote:
> Replace bit masking by BIT macro. This resolves checkpatch issue
Replace bit masking by the BIT macro. This resolves the checkpatch issue
> "CHECK: Prefer using the BIT macro"
>
> Signed-off-by: Deepak R Varma <mh12gx2825@gmail.com>
> ---
> drivers/staging/kpc2000/kpc2000/dma_common_defs.h | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/staging/kpc2000/kpc2000/dma_common_defs.h b/drivers/staging/kpc2000/kpc2000/dma_common_defs.h
> index 8bc78be3c259..613c4898f65e 100644
> --- a/drivers/staging/kpc2000/kpc2000/dma_common_defs.h
> +++ b/drivers/staging/kpc2000/kpc2000/dma_common_defs.h
> @@ -8,13 +8,13 @@
> #define KPC_DMA_ENGINE_SIZE 0x0100
> #define ENGINE_CAP_PRESENT_MASK 0x1
>
> -#define KPC_DMA_CARD_IRQ_ENABLE (1 << 0)
> -#define KPC_DMA_CARD_IRQ_ACTIVE (1 << 1)
> -#define KPC_DMA_CARD_IRQ_PENDING (1 << 2)
> -#define KPC_DMA_CARD_IRQ_MSI (1 << 3)
> -#define KPC_DMA_CARD_USER_INTERRUPT_MODE (1 << 4)
> -#define KPC_DMA_CARD_USER_INTERRUPT_ACTIVE (1 << 5)
> -#define KPC_DMA_CARD_IRQ_MSIX_MODE (1 << 6)
> +#define KPC_DMA_CARD_IRQ_ENABLE BIT(0)
> +#define KPC_DMA_CARD_IRQ_ACTIVE BIT(1)
> +#define KPC_DMA_CARD_IRQ_PENDING BIT(2)
> +#define KPC_DMA_CARD_IRQ_MSI BIT(3)
> +#define KPC_DMA_CARD_USER_INTERRUPT_MODE BIT(4)
> +#define KPC_DMA_CARD_USER_INTERRUPT_ACTIVE BIT(5)
> +#define KPC_DMA_CARD_IRQ_MSIX_MODE BIT(6)
> #define KPC_DMA_CARD_MAX_PAYLOAD_SIZE_MASK 0x0700
> #define KPC_DMA_CARD_MAX_READ_REQUEST_SIZE_MASK 0x7000
> #define KPC_DMA_CARD_S2C_INTERRUPT_STATUS_MASK 0x00FF0000
> --
> 2.25.1
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/06567509e751655184f4f6aed7570c963b608797.1603248985.git.mh12gx2825%40gmail.com.
>
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-10-21 16:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-21 3:03 [PATCH 1/2] staging: kpc2000: resolve various code style issues Deepak R Varma
2020-10-21 3:04 ` [PATCH 2/2] staging: kpc2000: Use BIT macro instead of bit masking Deepak R Varma
2020-10-21 7:53 ` [Outreachy kernel] " Julia Lawall
2020-10-21 4:41 ` [Outreachy kernel] [PATCH 1/2] staging: kpc2000: resolve various code style issues Vaishali Thakkar
2020-10-21 5:47 ` Deepak R Varma
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).