[PATCH v2 1/2] staging: vt6656: Refactor the assignment of the phy->signal variable
Create a constant array with the values of the "phy->signal" for every rate. Remove all "phy->signal" assignments inside the switch statement and replace these with a single reading from the new vnt_phy_signal array. The constant array can be of one dimension because the OR mask with BIT(3) or BIT(4) allow obtain a second value according to the rate, the preamble_type and the pkt_type. Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 105 -- 1 file changed, 26 insertions(+), 79 deletions(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index a19a563d8bcc..05cc4797df52 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -115,6 +115,21 @@ static const u16 vnt_frame_time[MAX_RATE] = { 10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216 }; +static const u8 vnt_phy_signal[] = { + 0x00, /* RATE_1M */ + 0x01, /* RATE_2M */ + 0x02, /* RATE_5M */ + 0x03, /* RATE_11M */ + 0x8b, /* RATE_6M */ + 0x8f, /* RATE_9M */ + 0x8a, /* RATE_12M */ + 0x8e, /* RATE_18M */ + 0x89, /* RATE_24M */ + 0x8d, /* RATE_36M */ + 0x88, /* RATE_48M */ + 0x8c/* RATE_54M */ +}; + /* * Description: Calculate data frame transmitting time * @@ -183,6 +198,8 @@ void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length, u32 count = 0; u32 tmp; int ext_bit; + int i; + u8 mask = 0; u8 preamble_type = priv->preamble_type; bit_count = frame_length * 8; @@ -191,27 +208,12 @@ void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length, switch (tx_rate) { case RATE_1M: count = bit_count; - - phy->signal = 0x00; - break; case RATE_2M: count = bit_count / 2; - - if (preamble_type == 1) - phy->signal = 0x09; - else - phy->signal = 0x01; - break; case RATE_5M: count = DIV_ROUND_UP(bit_count * 10, 55); - - if (preamble_type == 1) - phy->signal = 0x0a; - else - phy->signal = 0x02; - break; case RATE_11M: count = bit_count / 11; @@ -224,75 +226,20 @@ void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length, ext_bit = true; } - if (preamble_type == 1) - phy->signal = 0x0b; - else - phy->signal = 0x03; - - break; - case RATE_6M: - if (pkt_type == PK_TYPE_11A) - phy->signal = 0x9b; - else - phy->signal = 0x8b; - break; - case RATE_9M: - if (pkt_type == PK_TYPE_11A) - phy->signal = 0x9f; - else - phy->signal = 0x8f; - - break; - case RATE_12M: - if (pkt_type == PK_TYPE_11A) - phy->signal = 0x9a; - else - phy->signal = 0x8a; - - break; - case RATE_18M: - if (pkt_type == PK_TYPE_11A) - phy->signal = 0x9e; - else - phy->signal = 0x8e; - - break; - case RATE_24M: - if (pkt_type == PK_TYPE_11A) - phy->signal = 0x99; - else - phy->signal = 0x89; - - break; - case RATE_36M: - if (pkt_type == PK_TYPE_11A) - phy->signal = 0x9d; - else - phy->signal = 0x8d; - - break; - case RATE_48M: - if (pkt_type == PK_TYPE_11A) - phy->signal = 0x98; - else - phy->signal = 0x88; + } - break; - case RATE_54M: + if (tx_rate > RATE_11M) { if (pkt_type == PK_TYPE_11A) - phy->signal = 0x9c; - else - phy->signal = 0x8c; - break; - default: - if (pkt_type == PK_TYPE_11A) - phy->signal = 0x9c; - else - phy->signal = 0x8c; - break; + mask = BIT(4); + } else if (tx_rate > RATE_1M) { + if (preamble_type == PREAMBLE_SHORT) + mask = BIT(3); } + i = tx_rate > RATE_54M ? RATE_54M : tx_rate; + phy->signal = vnt_phy_signal[i] | mask; + if (pkt_type == PK_TYPE_11B) { phy->service = 0x00; if (ext_bit) -
[PATCH v2 0/2] staging: vt6656: Refactor the vnt_get_phy_field function
This patch series makes a refactor of the vnt_get_phy_field function through two patches. The first one refactors the assignment of the "phy->signal" variable using a constant array with the correct values for every rate. The second patch removes duplicate code for the assignment of the "phy->service" variable by putting it outside the if-else statement due to it's the same for the two branches. Changelog v1 -> v2: - Remove one dimension from the constant array for the "phy->signal" values and use an OR mask instead of the second array dimension as Malcolm Priestley has suggested. Oscar Carter (2): staging: vt6656: Refactor the assignment of the phy->signal variable staging: vt6656: Remove duplicate code for the phy->service assignment drivers/staging/vt6656/baseband.c | 108 -- 1 file changed, 27 insertions(+), 81 deletions(-) -- 2.20.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 2/2] staging: vt6656: Remove duplicate code for the phy->service assignment
Take out the "phy->service" assignment from the if-else statement due to it's the same for the two branches. Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index 05cc4797df52..c8b3cc84da6c 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -239,14 +239,13 @@ void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length, i = tx_rate > RATE_54M ? RATE_54M : tx_rate; phy->signal = vnt_phy_signal[i] | mask; + phy->service = 0x00; if (pkt_type == PK_TYPE_11B) { - phy->service = 0x00; if (ext_bit) phy->service |= 0x80; phy->len = cpu_to_le16((u16)count); } else { - phy->service = 0x00; phy->len = cpu_to_le16((u16)frame_length); } } -- 2.20.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/2] staging: vt6656: Refactor the vnt_vt3184_init function
This patch series makes a refactor of the vnt_vt3184_init function through two patches. The first one removes duplicate code in the if statements because different branches are almost the same. The second patch remove unnecessary local variable initialization. Oscar Carter (2): staging: vt6656: Remove duplicate code in vnt_vt3184_init function staging: vt6656: Remove unnecessary local variable initialization drivers/staging/vt6656/baseband.c | 54 --- 1 file changed, 13 insertions(+), 41 deletions(-) -- 2.20.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2] staging: vt6656: Remove unnecessary local variable initialization
Don't initialize the ret variable as it is set a few lines later. Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index 276210a7284e..10d1f2cbb3d9 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -352,7 +352,7 @@ int vnt_set_antenna_mode(struct vnt_private *priv, u8 antenna_mode) int vnt_vt3184_init(struct vnt_private *priv) { - int ret = 0; + int ret; u16 length; u8 *addr; u8 data; -- 2.20.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/2] staging: vt6656: Remove duplicate code in vnt_vt3184_init function
Remove duplicate code in "if" statements because different branches are almost the same. Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 52 +++ 1 file changed, 12 insertions(+), 40 deletions(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index a19a563d8bcc..276210a7284e 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -366,23 +366,15 @@ int vnt_vt3184_init(struct vnt_private *priv) dev_dbg(&priv->usb->dev, "RF Type %d\n", priv->rf_type); - if (priv->rf_type == RF_AL2230 || - priv->rf_type == RF_AL2230S) { + if ((priv->rf_type == RF_AL2230) || + (priv->rf_type == RF_AL2230S) || + (priv->rf_type == RF_AIROHA7230)) { priv->bb_rx_conf = vnt_vt3184_al2230[10]; length = sizeof(vnt_vt3184_al2230); addr = vnt_vt3184_al2230; - priv->bb_vga[0] = 0x1C; - priv->bb_vga[1] = 0x10; - priv->bb_vga[2] = 0x0; - priv->bb_vga[3] = 0x0; - - } else if (priv->rf_type == RF_AIROHA7230) { - priv->bb_rx_conf = vnt_vt3184_al2230[10]; - length = sizeof(vnt_vt3184_al2230); - addr = vnt_vt3184_al2230; - - addr[0xd7] = 0x06; + if (priv->rf_type == RF_AIROHA7230) + addr[0xd7] = 0x06; priv->bb_vga[0] = 0x1c; priv->bb_vga[1] = 0x10; @@ -390,22 +382,8 @@ int vnt_vt3184_init(struct vnt_private *priv) priv->bb_vga[3] = 0x0; } else if ((priv->rf_type == RF_VT3226) || - (priv->rf_type == RF_VT3226D0)) { - priv->bb_rx_conf = vnt_vt3184_vt3226d0[10]; - length = sizeof(vnt_vt3184_vt3226d0); - addr = vnt_vt3184_vt3226d0; - - priv->bb_vga[0] = 0x20; - priv->bb_vga[1] = 0x10; - priv->bb_vga[2] = 0x0; - priv->bb_vga[3] = 0x0; - - /* Fix VT3226 DFC system timing issue */ - ret = vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL2, - SOFTPWRCTL_RFLEOPT); - if (ret) - goto end; - } else if (priv->rf_type == RF_VT3342A0) { + (priv->rf_type == RF_VT3226D0) || + (priv->rf_type == RF_VT3342A0)) { priv->bb_rx_conf = vnt_vt3184_vt3226d0[10]; length = sizeof(vnt_vt3184_vt3226d0); addr = vnt_vt3184_vt3226d0; @@ -435,19 +413,13 @@ int vnt_vt3184_init(struct vnt_private *priv) if (ret) goto end; - if (priv->rf_type == RF_VT3226 || - priv->rf_type == RF_VT3342A0) { - ret = vnt_control_out_u8(priv, MESSAGE_REQUEST_MACREG, -MAC_REG_ITRTMSET, 0x23); - if (ret) - goto end; + if ((priv->rf_type == RF_VT3226) || + (priv->rf_type == RF_VT3342A0) || + (priv->rf_type == RF_VT3226D0)) { + data = (priv->rf_type == RF_VT3226D0) ? 0x11 : 0x23; - ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, BIT(0)); - if (ret) - goto end; - } else if (priv->rf_type == RF_VT3226D0) { ret = vnt_control_out_u8(priv, MESSAGE_REQUEST_MACREG, -MAC_REG_ITRTMSET, 0x11); +MAC_REG_ITRTMSET, data); if (ret) goto end; -- 2.20.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] binderfs: Fix binderfs.c selftest compilation warning
Fix missing braces compilation warning in the ARM compiler environment: drivers/android/binderfs.c: In function 'binderfs_fill_super': drivers/android/binderfs.c:650:9: warning: missing braces around initializer [-Wmissing-braces] struct binderfs_device device_info = { 0 }; drivers/android/binderfs.c:650:9: warning: (near initialization for ‘device_info.name’) [-Wmissing-braces] Signed-off-by: Tang Bin --- drivers/android/binderfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c index 9ecad7418..78528e1 100644 --- a/drivers/android/binderfs.c +++ b/drivers/android/binderfs.c @@ -650,7 +650,7 @@ static int binderfs_fill_super(struct super_block *sb, struct fs_context *fc) struct binderfs_info *info; struct binderfs_mount_opts *ctx = fc->fs_private; struct inode *inode = NULL; - struct binderfs_device device_info = { 0 }; + struct binderfs_device device_info = {}; const char *name; size_t len; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] binderfs: Fix binderfs.c selftest compilation warning
On Sat, Apr 11, 2020 at 10:51:51PM +0800, Tang Bin wrote: > Fix missing braces compilation warning in the ARM > compiler environment: > drivers/android/binderfs.c: In function 'binderfs_fill_super': > drivers/android/binderfs.c:650:9: warning: missing braces around > initializer [-Wmissing-braces] > struct binderfs_device device_info = { 0 }; > drivers/android/binderfs.c:650:9: warning: (near initialization for > ‘device_info.name’) [-Wmissing-braces] > > Signed-off-by: Tang Bin > --- Thanks! Acked-by: Christian Brauner ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[staging:staging-testing] BUILD SUCCESS 134c0700a05174f2520d51ba4dd95698ffa779de
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-testing branch HEAD: 134c0700a05174f2520d51ba4dd95698ffa779de staging: rtl8723bs: hal: Correct misspelled symbolic name elapsed time: 484m configs tested: 166 configs skipped: 0 The following configs have been built successfully. More configs may be tested in the coming days. arm64allyesconfig arm64 allnoconfig arm allnoconfig arm efm32_defconfig arm at91_dt_defconfig armshmobile_defconfig arm64 defconfig arm exynos_defconfig armmulti_v5_defconfig arm sunxi_defconfig armmulti_v7_defconfig sparcallyesconfig ia64defconfig powerpc defconfig powerpc allnoconfig i386 allnoconfig i386 allyesconfig i386 alldefconfig i386defconfig i386 debian-10.3 ia64 allmodconfig ia64 allnoconfig ia64 allyesconfig ia64 alldefconfig c6x allyesconfig c6xevmc6678_defconfig nios2 10m50_defconfig nios2 3c120_defconfig openriscor1ksim_defconfig openrisc simple_smp_defconfig xtensa common_defconfig xtensa iss_defconfig nds32 defconfig nds32 allnoconfig cskydefconfig alpha defconfig h8300 h8s-sim_defconfig h8300 edosk2674_defconfig m68k m5475evb_defconfig m68k allmodconfig h8300h8300h-sim_defconfig m68k sun3_defconfig m68k multi_defconfig arc allyesconfig arc defconfig microblaze mmu_defconfig microblazenommu_defconfig powerpc ppc64_defconfig powerpc rhel-kconfig mips fuloong2e_defconfig mips malta_kvm_defconfig mips allyesconfig mips 64r6el_defconfig mips allnoconfig mips 32r2_defconfig mips allmodconfig pariscallnoconfig pariscgeneric-64bit_defconfig pariscgeneric-32bit_defconfig parisc allyesconfig x86_64 randconfig-a001-20200410 x86_64 randconfig-a002-20200410 x86_64 randconfig-a003-20200410 i386 randconfig-a001-20200410 i386 randconfig-a002-20200410 i386 randconfig-a003-20200410 alpharandconfig-a001-20200410 m68k randconfig-a001-20200410 mips randconfig-a001-20200410 nds32randconfig-a001-20200410 parisc randconfig-a001-20200410 riscvrandconfig-a001-20200410 c6x randconfig-a001-20200410 h8300randconfig-a001-20200410 microblaze randconfig-a001-20200410 nios2randconfig-a001-20200410 sparc64 randconfig-a001-20200410 c6x randconfig-a001-20200412 h8300randconfig-a001-20200412 microblaze randconfig-a001-20200412 nios2randconfig-a001-20200412 sparc64 randconfig-a001-20200412 s390 randconfig-a001-20200411 xtensa randconfig-a001-20200411 sh randconfig-a001-20200411 openrisc randconfig-a001-20200411 csky randconfig-a001-20200411 x86_64 randconfig-b002-20200410 i386 randconfig-b001-20200410 x86_64 randconfig-b001-20200410 x86_64 randconfig-b003-20200410 i386 randconfig-b003-20200410 i386 randconfig-b002-20200410 x86_64 randconfig-c001-20200410 x86_64 randconfig-c002-20200410 x86_64 randconfig-c003-20200410 i386 randconfig-c001-20200410 i386 randconfig-c002-20200410 i386 randconfig-c003-20200410 x86_64 randconfig-d001-20200410 x86_64
[PATCH] media: staging: ipu3: Fix stale list entries on parameter queue failure
When queuing parameters fails, current code bails out without deleting the corresponding vb2 buffer from the driver buffer list, but the buffer is returned to vb2. This leads to stale list entries and a crash when the driver stops streaming: [ 224.935561] ipu3-imgu :00:05.0: set parameters failed. [ 224.998932] ipu3-imgu :00:05.0: set parameters failed. [ 225.064430] ipu3-imgu :00:05.0: set parameters failed. [ 225.128534] ipu3-imgu :00:05.0: set parameters failed. [ 225.194945] ipu3-imgu :00:05.0: set parameters failed. [ 225.360363] [ cut here ] [ 225.360372] WARNING: CPU: 0 PID: 6704 at drivers/media/common/videobuf2/videobuf2-core.c:927 vb2_buffer_done+0x20f/0x21a [videobuf2_common] [ 225.360374] Modules linked in: snd_seq_dummy snd_seq snd_seq_device veth bridge stp llc tun nf_nat_tftp nf_conntrack_tftp nf_nat_ftp nf_conntrack_ftp esp6 ah6 ip6t_REJECT ip6t_ipv6header cmac rfcomm uinput ipu3_imgu(C) ipu3_cio2 iova videobuf2_v4l2 videobuf2_common videobuf2_dma_sg videobuf2_memops ov13858 ov5670 v4l2_fwnode dw9714 acpi_als xt_MASQUERADE fuse iio_trig_sysfs cros_ec_sensors_ring cros_ec_light_prox cros_ec_sensors cros_ec_sensors_core industrialio_triggered_buffer kfifo_buf industrialio cros_ec_sensorsupport cdc_ether btusb btrtl btintel btbcm usbnet bluetooth ecdh_generic ecc hid_google_hammer iwlmvm iwl7000_mac80211 r8152 mii lzo_rle lzo_compress iwlwifi zram cfg80211 joydev [ 225.360400] CPU: 0 PID: 6704 Comm: CameraDeviceOps Tainted: G C5.4.30 #5 [ 225.360402] Hardware name: HP Soraka/Soraka, BIOS Google_Soraka.10431.106.0 12/03/2019 [ 225.360405] RIP: 0010:vb2_buffer_done+0x20f/0x21a [videobuf2_common] [ 225.360408] Code: 5e 41 5f 5d e9 e0 16 5a d4 41 8b 55 08 48 c7 c7 8f 8b 5c c0 48 c7 c6 36 9a 5c c0 44 89 f9 31 c0 e8 a5 1c 5b d4 e9 53 fe ff ff <0f> 0b eb a3 e8 12 d7 43 d4 eb 97 0f 1f 44 00 00 55 48 89 e5 41 56 [ 225.360410] RSP: 0018:9468ab32fba8 EFLAGS: 00010297 [ 225.360412] RAX: 8aa7a51577a8 RBX: dead0122 RCX: 8aa7a51577a8 [ 225.360414] RDX: RSI: 0006 RDI: 8aa7a5157400 [ 225.360416] RBP: 9468ab32fbd8 R08: 8aa64e47e600 R09: [ 225.360418] R10: R11: c06036e6 R12: dead0100 [ 225.360420] R13: 8aa7820f1940 R14: 8aa7a51577a8 R15: 0006 [ 225.360422] FS: 7c1146ffd700() GS:8aa7baa0() knlGS: [ 225.360424] CS: 0010 DS: ES: CR0: 80050033 [ 225.360426] CR2: 7aea3473a000 CR3: 537d6004 CR4: 003606f0 [ 225.360427] Call Trace: [ 225.360434] imgu_return_all_buffers+0x6f/0x8e [ipu3_imgu] [ 225.360438] imgu_vb2_stop_streaming+0xd6/0xf0 [ipu3_imgu] [ 225.360441] __vb2_queue_cancel+0x33/0x22d [videobuf2_common] [ 225.360443] vb2_core_streamoff+0x16/0x78 [videobuf2_common] [ 225.360448] __video_do_ioctl+0x33d/0x42a [ 225.360452] video_usercopy+0x34a/0x615 [ 225.360455] ? video_ioctl2+0x16/0x16 [ 225.360458] v4l2_ioctl+0x46/0x53 [ 225.360462] do_vfs_ioctl+0x50a/0x787 [ 225.360465] ksys_ioctl+0x58/0x83 [ 225.360468] __x64_sys_ioctl+0x1a/0x1e [ 225.360470] do_syscall_64+0x54/0x68 [ 225.360474] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 225.360476] RIP: 0033:0x7c118030f497 [ 225.360479] Code: 8a 66 90 48 8b 05 d1 d9 2b 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d a1 d9 2b 00 f7 d8 64 89 01 48 [ 225.360480] RSP: 002b:7c1146ffa5a8 EFLAGS: 0246 ORIG_RAX: 0010 [ 225.360483] RAX: ffda RBX: 7c1140010018 RCX: 7c118030f497 [ 225.360484] RDX: 7c114001019c RSI: 40045613 RDI: 004c [ 225.360486] RBP: 7c1146ffa700 R08: 7c1140010048 R09: [ 225.360488] R10: R11: 0246 R12: 7c11400101b0 [ 225.360489] R13: 7c1140010200 R14: 7c1140010048 R15: 0001 [ 225.360492] ---[ end trace 73625ecfbd1c930e ]--- [ 225.360498] general protection fault: [#1] PREEMPT SMP PTI [ 225.360501] CPU: 0 PID: 6704 Comm: CameraDeviceOps Tainted: G WC5.4.30 #5 [ 225.360502] Hardware name: HP Soraka/Soraka, BIOS Google_Soraka.10431.106.0 12/03/2019 [ 225.360505] RIP: 0010:imgu_return_all_buffers+0x52/0x8e [ipu3_imgu] [ 225.360507] Code: d4 49 8b 85 70 0a 00 00 49 81 c5 70 0a 00 00 49 39 c5 74 3b 49 bc 00 01 00 00 00 00 ad de 49 8d 5c 24 22 4c 8b 30 48 8b 48 08 <49> 89 4e 08 4c 89 31 4c 89 20 48 89 58 08 48 8d b8 58 fc ff ff 44 [ 225.360509] RSP: 0018:9468ab32fbe8 EFLAGS: 00010293 [ 225.360511] RAX: 8aa7a51577a8 RBX: dead0122 RCX: dead0122 [ 225.360512] RDX: RSI: 0006 RDI: 8aa7a5157400 [ 225.360514] RBP: 9468ab32fc18 R08: 8aa64e47e600 R09: [ 225.360515] R10: R11: c06036e6 R12: dead0100 [ 225.36051
[PATCH] staging: vt6656: formulate rspinf values into tables
Four tables can be extracted from RSPINF_A_* based on BB_TYPE_11A or else being GB rates. Preamble short or long tables from fixed size len of 14 for RSPINF_B rates. Remove function vnt_calculate_ofdm_rate and replace with the tables calling RSPINF_A and RSPINF_B separately. Signed-off-by: Malcolm Priestley --- drivers/staging/vt6656/card.c | 196 +++--- 1 file changed, 40 insertions(+), 156 deletions(-) diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index 82c775bd20d2..dedb343f3ef3 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c @@ -74,99 +74,25 @@ void vnt_set_channel(struct vnt_private *priv, u32 connection_channel) (u8)(connection_channel | 0x80)); } -/* - * Description: Calculate TxRate and RsvTime fields for RSPINF in OFDM mode. - * - * Parameters: - * In: - * rate- Tx Rate - * bb_type - Tx Packet type - * Out: - * tx_rate - pointer to RSPINF TxRate field - * rsv_time- pointer to RSPINF RsvTime field - * - * Return Value: none - * - */ -static void vnt_calculate_ofdm_rate(u16 rate, u8 bb_type, - u8 *tx_rate, u8 *rsv_time) -{ - switch (rate) { - case RATE_6M: - if (bb_type == BB_TYPE_11A) { - *tx_rate = 0x9b; - *rsv_time = 24; - } else { - *tx_rate = 0x8b; - *rsv_time = 30; - } - break; - case RATE_9M: - if (bb_type == BB_TYPE_11A) { - *tx_rate = 0x9f; - *rsv_time = 16; - } else { - *tx_rate = 0x8f; - *rsv_time = 22; - } - break; - case RATE_12M: - if (bb_type == BB_TYPE_11A) { - *tx_rate = 0x9a; - *rsv_time = 12; - } else { - *tx_rate = 0x8a; - *rsv_time = 18; - } - break; - case RATE_18M: - if (bb_type == BB_TYPE_11A) { - *tx_rate = 0x9e; - *rsv_time = 8; - } else { - *tx_rate = 0x8e; - *rsv_time = 14; - } - break; - case RATE_36M: - if (bb_type == BB_TYPE_11A) { - *tx_rate = 0x9d; - *rsv_time = 4; - } else { - *tx_rate = 0x8d; - *rsv_time = 10; - } - break; - case RATE_48M: - if (bb_type == BB_TYPE_11A) { - *tx_rate = 0x98; - *rsv_time = 4; - } else { - *tx_rate = 0x88; - *rsv_time = 10; - } - break; - case RATE_54M: - if (bb_type == BB_TYPE_11A) { - *tx_rate = 0x9c; - *rsv_time = 4; - } else { - *tx_rate = 0x8c; - *rsv_time = 10; - } - break; - case RATE_24M: - default: - if (bb_type == BB_TYPE_11A) { - *tx_rate = 0x99; - *rsv_time = 8; - } else { - *tx_rate = 0x89; - *rsv_time = 14; - } - break; - } -} +static const u8 vnt_rspinf_b_short_table[] = { + 0x70, 0x00, 0x00, 0x00, 0x38, 0x00, 0x09, 0x00, + 0x15, 0x00, 0x0a, 0x00, 0x0b, 0x00, 0x0b, 0x80 +}; + +static const u8 vnt_rspinf_b_long_table[] = { + 0x70, 0x00, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, + 0x15, 0x00, 0x02, 0x00, 0x0b, 0x00, 0x03, 0x80 +}; + +static const u8 vnt_rspinf_a_table[] = { + 0x9b, 0x1e, 0x9f, 0x16, 0x9a, 0x12, 0x9e, 0x0e, 0x99, + 0x0e, 0x9d, 0x0a, 0x98, 0x0a, 0x9c, 0x0a, 0x9c, 0x0a +}; + +static const u8 vnt_rspinf_gb_table[] = { + 0x8b, 0x1e, 0x8f, 0x16, 0x8a, 0x12, 0x8e, 0x0e, 0x89, + 0x0e, 0x8d, 0x0a, 0x88, 0x0a, 0x8c, 0x0a, 0x8c, 0x0a +}; /* * Description: Set RSPINF @@ -183,74 +109,32 @@ static void vnt_calculate_ofdm_rate(u16 rate, u8 bb_type, void vnt_set_rspinf(struct vnt_private *priv, u8 bb_type) { - struct vnt_phy_field phy[4]; - u8 tx_rate[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; /* For OFDM */ - u8 rsv_time[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; - u8 data[34]; - int i; - - /*RSPINF_b_1*/ - vnt_get_phy_field(priv, 14, RATE_1M, PK_TYPE_11B, &phy[0]); - - /*RSPINF_b_2*/ - vnt_get_phy_field(priv, 14, RATE_2M, PK_TYPE_11B, &phy[1]); - - /*RSPINF_b_5*/ - vnt_get_phy_field(priv, 14, RATE_5M, PK_TYPE_11B, &phy[2]); - - /*RSPINF_b_11*/ -
[PATCH] taging: android: ashmem: Declared const key
From: mugil2301 <110117...@nitt.edu> Signed-off-by: mugil2301 <110117...@nitt.edu> --- drivers/staging/android/ashmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 8044510..50f882a 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -367,7 +367,7 @@ ashmem_vmfile_get_unmapped_area(struct file *file, unsigned long addr, static int ashmem_mmap(struct file *file, struct vm_area_struct *vma) { - static struct file_operations vmfile_fops; + static const struct file_operations vmfile_fops; struct ashmem_area *asma = file->private_data; int ret = 0; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] taging: android: ashmem: Declared const key
On Sun, 2020-04-12 at 00:59 +0530, MugilRaj wrote: > From: mugil2301 <110117...@nitt.edu> You need to verify the patch subject. You need a change log message too. > Signed-off-by: mugil2301 <110117...@nitt.edu> You need to put your legal name here > diff --git a/drivers/staging/android/ashmem.c > b/drivers/staging/android/ashmem.c [] > @@ -367,7 +367,7 @@ ashmem_vmfile_get_unmapped_area(struct file *file, > unsigned long addr, > > static int ashmem_mmap(struct file *file, struct vm_area_struct *vma) > { > - static struct file_operations vmfile_fops; > + static const struct file_operations vmfile_fops; > struct ashmem_area *asma = file->private_data; > int ret = 0; (this won't compile) checkpatch is not always right. Do please compile the files changed by your patch and verify change correctness before sending any proposed patch. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] taging: android: ashmem: Declared const key
Hi MugilRaj, Thank you for the patch! Yet something to improve: [auto build test ERROR on staging/staging-testing] [also build test ERROR on v5.6 next-20200411] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/MugilRaj/taging-android-ashmem-Declared-const-key/20200412-033150 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 134c0700a05174f2520d51ba4dd95698ffa779de config: alpha-allmodconfig (attached as .config) compiler: alpha-linux-gcc (GCC) 9.3.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=9.3.0 make.cross ARCH=alpha If you fix the issue, kindly add following tag as appropriate Reported-by: kbuild test robot All errors (new ones prefixed by >>): drivers/staging/android/ashmem.c: In function 'ashmem_mmap': >> drivers/staging/android/ashmem.c:418:16: error: assignment of read-only >> variable 'vmfile_fops' 418 |vmfile_fops = *vmfile->f_op; |^ >> drivers/staging/android/ashmem.c:419:21: error: assignment of member 'mmap' >> in read-only object 419 |vmfile_fops.mmap = ashmem_vmfile_mmap; | ^ >> drivers/staging/android/ashmem.c:420:34: error: assignment of member >> 'get_unmapped_area' in read-only object 420 |vmfile_fops.get_unmapped_area = | ^ vim +/vmfile_fops +418 drivers/staging/android/ashmem.c 6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 367 11980c2ac4ccfa Robert Love2011-12-20 368 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma) 11980c2ac4ccfa Robert Love2011-12-20 369 { d5d1ae9cc69f62 mugil2301 2020-04-12 370 static const struct file_operations vmfile_fops; 11980c2ac4ccfa Robert Love2011-12-20 371 struct ashmem_area *asma = file->private_data; 11980c2ac4ccfa Robert Love2011-12-20 372 int ret = 0; 11980c2ac4ccfa Robert Love2011-12-20 373 11980c2ac4ccfa Robert Love2011-12-20 374 mutex_lock(&ashmem_mutex); 11980c2ac4ccfa Robert Love2011-12-20 375 11980c2ac4ccfa Robert Love2011-12-20 376 /* user needs to SET_SIZE before mapping */ 59848d6aded59a Alistair Strachan 2018-06-19 377 if (!asma->size) { 11980c2ac4ccfa Robert Love2011-12-20 378 ret = -EINVAL; 11980c2ac4ccfa Robert Love2011-12-20 379 goto out; 11980c2ac4ccfa Robert Love2011-12-20 380 } 11980c2ac4ccfa Robert Love2011-12-20 381 8632c614565d0c Alistair Strachan 2018-06-19 382 /* requested mapping size larger than object size */ 8632c614565d0c Alistair Strachan 2018-06-19 383 if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) { 11980c2ac4ccfa Robert Love2011-12-20 384 ret = -EINVAL; 11980c2ac4ccfa Robert Love2011-12-20 385 goto out; 11980c2ac4ccfa Robert Love2011-12-20 386 } 11980c2ac4ccfa Robert Love2011-12-20 387 11980c2ac4ccfa Robert Love2011-12-20 388 /* requested protection bits must match our allowed protection mask */ 59848d6aded59a Alistair Strachan 2018-06-19 389 if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) & 59848d6aded59a Alistair Strachan 2018-06-19 390 calc_vm_prot_bits(PROT_MASK, 0)) { 11980c2ac4ccfa Robert Love2011-12-20 391 ret = -EPERM; 11980c2ac4ccfa Robert Love2011-12-20 392 goto out; 11980c2ac4ccfa Robert Love2011-12-20 393 } 56f76fc68492af Arve Hjønnevåg 2011-12-20 394 vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask); 11980c2ac4ccfa Robert Love2011-12-20 395 11980c2ac4ccfa Robert Love2011-12-20 396 if (!asma->file) { 11980c2ac4ccfa Robert Love2011-12-20 397 char *name = ASHMEM_NAME_DEF; 11980c2ac4ccfa Robert Love2011-12-20 398 struct file *vmfile; 11980c2ac4ccfa Robert Love2011-12-20 399 11980c2ac4ccfa Robert Love2011-12-20 400 if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0') 11980c2ac4ccfa Robert Love2011-12-20 401 name = asma->name; 11980c2ac4ccfa Robert Love2011-12-20 402 11980c2ac4ccfa Robert Love2011-12-20 403 /* ... and allocate the backing shmem file */ 11980c2ac