mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 14:24:11 +08:00
Amlogic drivers changes for v6.7:
- correct meson_sm_* API retval handling - Use device_get_match_data() in meson SM -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEPVPGJshWBf4d9CyLd9zb2sjISdEFAmUs83IACgkQd9zb2sjI SdFGzw//VNykb/lkcMbPSG9FB0q5rUHfZqiqn9OEdd8rk2ygUzHSbjxSl91rJYJl LnmtoB1I0ojJbkwYxPDsvpJrd5TaDS2nRhzxtk4PfZVn6SbHA1gEXlYAi1sgOpa7 G0wJ2jNT+jocS5868UyZCiOojxhD3TKsSCtPk7qvb9ywRBq4lKW5Ci6HIJHxcwL+ AzhozwO8vio93oSRd72GXlH48HpL4MR7GWyYl483rGEQIM5LvhNP0CWUMoRmPRqr WtwiXsH7uth8l5mCxSb5HTdFTLFcFh301UgXovFDg+qudK8Kk8fspX+KQJt/Rpo1 vyEI/Hc2PeEFUz2pHPOGVdeo8cPjN0Kph2jeT/s8B9UYSUFxPoRfESea68g6/gHt TQuuu+Nfy0FVJAVOwq24aAzxQ3bETCmEvVcGQhNfXINTMpEZZmr75jeq7j5PJVuY +b7KEqY9PzJIThGimZknbbrjEpeSvF+5w+/Ao7KhSh1ezuGgHQ5Pxt3T2SVwsKq7 zlzXTupfqNu6Jcd7gpFQARWv2qOXTZha71eG+sAjXtmz3TglSZc8S2bJg9CD0VSI O0nBggXNKoAmCLZFcX2Dvvvj47WBqX2AP530dQUT0ZjO8Wh9Duf9cSAdgOI98/TD IIaW9QXpTYeD9I9zmMsQ2zKZpHpMMvM9DUZ87ocmYgC/AcpguLs= =EiNc -----END PGP SIGNATURE----- gpgsig -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmUtpKwACgkQYKtH/8kJ UieslhAAvIqH0Tx7Lsu2XPP41UbYB3Wxa0uFSGGYihrkA8/ZrmZ7a+xzGvL131fu +Y/KA+g6uHVct3kPTvq6wry8gJI48JMGlVzAGalH+66PuPr7FYv+ZQVs2GVcBuB7 c5Lv0Nbu/7LVMuTf/sKcoSRwx8w4nKpL7UGZVb46uGM4z41abdzzcb3+K95vUZ4M HaCiFbrBtEIZl1YXSsOWat7K5gvyVQQ9TFamD6HEmq2MRXRubvAueX0w/Z/fydaR 0l1vIfTadRf4YIDLuBkXieKAsYwQ2ShAiC2/oRgBc7+Rg9BDoh3MFW8TTu36nGFM Ufe845X1JrUl6r2J0hYAU4qb7nwpNQmXZuUeyBNPYXw+Ovsy8fWWqZ9MB8XCdkag yGweDUcp/KAMHafVLWEI18Jjy5oYHoLsG5geQeyerIhbTpx834RC8mpVYe5kAiXA D99dYa2dIzpgo5OShx/Q62vW7OK8/RLXs71V2+WrmyvWjlQMFWYIKAE1Tt9pRc5K hIVKAzioMQM9kh3J0t6MZhtvqe9A9in4P3knS+91MH6TiQcwqj5IoyVtHNt5g+Ed EjuZa9rK1sqwjUT4uJfmiHrW9AY4RrSB9Bz1mr8NmSbv53cUqcDcBf55RMVS48Fi i6v7IKWBloPl27ixHZRi2xbWBOzvWUqopiTYRE2g1W2bw/j3XUs= =C6PQ -----END PGP SIGNATURE----- Merge tag 'amlogic-drivers-for-v6.7' of https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux into soc/drivers Amlogic drivers changes for v6.7: - correct meson_sm_* API retval handling - Use device_get_match_data() in meson SM * tag 'amlogic-drivers-for-v6.7' of https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux: firmware: meson: Use device_get_match_data() drivers: meson: sm: correct meson_sm_* API retval handling Link: https://lore.kernel.org/r/00ef6ab3-59c1-484a-9d70-50f16e4cc584@linaro.org Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
commit
15c46d85f0
@ -13,9 +13,10 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/printk.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/sizes.h>
|
||||
#include <linux/slab.h>
|
||||
@ -67,7 +68,7 @@ static u32 meson_sm_get_cmd(const struct meson_sm_chip *chip,
|
||||
return cmd->smc_id;
|
||||
}
|
||||
|
||||
static u32 __meson_sm_call(u32 cmd, u32 arg0, u32 arg1, u32 arg2,
|
||||
static s32 __meson_sm_call(u32 cmd, u32 arg0, u32 arg1, u32 arg2,
|
||||
u32 arg3, u32 arg4)
|
||||
{
|
||||
struct arm_smccc_res res;
|
||||
@ -102,9 +103,10 @@ static void __iomem *meson_sm_map_shmem(u32 cmd_shmem, unsigned int size)
|
||||
* Return: 0 on success, a negative value on error
|
||||
*/
|
||||
int meson_sm_call(struct meson_sm_firmware *fw, unsigned int cmd_index,
|
||||
u32 *ret, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
|
||||
s32 *ret, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
|
||||
{
|
||||
u32 cmd, lret;
|
||||
u32 cmd;
|
||||
s32 lret;
|
||||
|
||||
if (!fw->chip)
|
||||
return -ENOENT;
|
||||
@ -143,7 +145,7 @@ int meson_sm_call_read(struct meson_sm_firmware *fw, void *buffer,
|
||||
unsigned int bsize, unsigned int cmd_index, u32 arg0,
|
||||
u32 arg1, u32 arg2, u32 arg3, u32 arg4)
|
||||
{
|
||||
u32 size;
|
||||
s32 size;
|
||||
int ret;
|
||||
|
||||
if (!fw->chip)
|
||||
@ -158,11 +160,16 @@ int meson_sm_call_read(struct meson_sm_firmware *fw, void *buffer,
|
||||
if (meson_sm_call(fw, cmd_index, &size, arg0, arg1, arg2, arg3, arg4) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (size > bsize)
|
||||
if (size < 0 || size > bsize)
|
||||
return -EINVAL;
|
||||
|
||||
ret = size;
|
||||
|
||||
/* In some cases (for example GET_CHIP_ID command),
|
||||
* SMC doesn't return the number of bytes read, even
|
||||
* though the bytes were actually read into sm_shmem_out.
|
||||
* So this check is needed.
|
||||
*/
|
||||
if (!size)
|
||||
size = bsize;
|
||||
|
||||
@ -192,7 +199,7 @@ int meson_sm_call_write(struct meson_sm_firmware *fw, void *buffer,
|
||||
unsigned int size, unsigned int cmd_index, u32 arg0,
|
||||
u32 arg1, u32 arg2, u32 arg3, u32 arg4)
|
||||
{
|
||||
u32 written;
|
||||
s32 written;
|
||||
|
||||
if (!fw->chip)
|
||||
return -ENOENT;
|
||||
@ -208,7 +215,7 @@ int meson_sm_call_write(struct meson_sm_firmware *fw, void *buffer,
|
||||
if (meson_sm_call(fw, cmd_index, &written, arg0, arg1, arg2, arg3, arg4) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (!written)
|
||||
if (written <= 0 || written > size)
|
||||
return -EINVAL;
|
||||
|
||||
return written;
|
||||
@ -291,7 +298,7 @@ static int __init meson_sm_probe(struct platform_device *pdev)
|
||||
if (!fw)
|
||||
return -ENOMEM;
|
||||
|
||||
chip = of_match_device(meson_sm_ids, dev)->data;
|
||||
chip = device_get_match_data(dev);
|
||||
if (!chip)
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -19,7 +19,7 @@ enum {
|
||||
struct meson_sm_firmware;
|
||||
|
||||
int meson_sm_call(struct meson_sm_firmware *fw, unsigned int cmd_index,
|
||||
u32 *ret, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4);
|
||||
s32 *ret, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4);
|
||||
int meson_sm_call_write(struct meson_sm_firmware *fw, void *buffer,
|
||||
unsigned int b_size, unsigned int cmd_index, u32 arg0,
|
||||
u32 arg1, u32 arg2, u32 arg3, u32 arg4);
|
||||
|
Loading…
Reference in New Issue
Block a user